MediaWiki  master
RevDelArchiveList.php
Go to the documentation of this file.
1 <?php
27 
32 
34  private $revisionStore;
35 
45  public function __construct(
46  IContextSource $context,
48  array $ids,
49  LBFactory $lbFactory,
50  HookContainer $hookContainer,
51  HtmlCacheUpdater $htmlCacheUpdater,
52  RevisionStore $revisionStore
53  ) {
54  parent::__construct(
55  $context,
56  $page,
57  $ids,
58  $lbFactory,
59  $hookContainer,
60  $htmlCacheUpdater,
61  $revisionStore
62  );
63  $this->revisionStore = $revisionStore;
64  }
65 
66  public function getType() {
67  return 'archive';
68  }
69 
70  public static function getRelationType() {
71  return 'ar_timestamp';
72  }
73 
78  public function doQuery( $db ) {
79  $timestamps = [];
80  foreach ( $this->ids as $id ) {
81  $timestamps[] = $db->timestamp( $id );
82  }
83 
84  $arQuery = $this->revisionStore->getArchiveQueryInfo();
85  $tables = $arQuery['tables'];
86  $fields = $arQuery['fields'];
87  $conds = [
88  'ar_namespace' => $this->getPage()->getNamespace(),
89  'ar_title' => $this->getPage()->getDBkey(),
90  'ar_timestamp' => $timestamps,
91  ];
92  $join_conds = $arQuery['joins'];
93  $options = [ 'ORDER BY' => 'ar_timestamp DESC' ];
94 
96  $tables,
97  $fields,
98  $conds,
99  $join_conds,
100  $options,
101  ''
102  );
103 
104  return $db->select( $tables,
105  $fields,
106  $conds,
107  __METHOD__,
108  $options,
109  $join_conds
110  );
111  }
112 
113  public function newItem( $row ) {
114  return new RevDelArchiveItem( $this, $row );
115  }
116 
117  public function doPreCommitUpdates() {
118  return Status::newGood();
119  }
120 
121  public function doPostCommitUpdates( array $visibilityChangeMap ) {
122  return Status::newGood();
123  }
124 }
static modifyDisplayQuery(&$tables, &$fields, &$conds, &$join_conds, &$options, $filter_tag='', bool $exclude=false)
Applies all tags-related changes to a query.
Definition: ChangeTags.php:904
Class to invalidate the CDN and HTMLFileCache entries associated with URLs/titles.
Service for looking up page revisions.
Item class for a archive table row.
List for archive table items, i.e.
doPreCommitUpdates()
A hook for setVisibility(): do batch updates pre-commit.
newItem( $row)
Create an item object from a DB result row.
static getRelationType()
Get the DB field name associated with the ID list.
__construct(IContextSource $context, PageIdentity $page, array $ids, LBFactory $lbFactory, HookContainer $hookContainer, HtmlCacheUpdater $htmlCacheUpdater, RevisionStore $revisionStore)
doPostCommitUpdates(array $visibilityChangeMap)
A hook for setVisibility(): do any necessary updates post-commit.
getType()
Get the internal type name of this list.
List for revision table items.
PageIdentity $page
static newGood( $value=null)
Factory function for good results.
Definition: StatusValue.php:85
Interface for objects which can provide a MediaWiki context on request.
Interface for objects (potentially) representing an editable wiki page.
Basic database interface for live and lazy-loaded relation database handles.
Definition: IDatabase.php:36