MediaWiki  master
RevDelArchiveList.php
Go to the documentation of this file.
1 <?php
27 
32 
34  private $revisionStore;
35 
46  public function __construct(
47  IContextSource $context,
49  array $ids,
50  LBFactory $lbFactory,
51  HookContainer $hookContainer,
52  HtmlCacheUpdater $htmlCacheUpdater,
53  RevisionStore $revisionStore,
54  WANObjectCache $wanObjectCache
55  ) {
56  parent::__construct(
57  $context,
58  $page,
59  $ids,
60  $lbFactory,
61  $hookContainer,
62  $htmlCacheUpdater,
63  $revisionStore,
64  $wanObjectCache
65  );
66  $this->revisionStore = $revisionStore;
67  }
68 
69  public function getType() {
70  return 'archive';
71  }
72 
73  public static function getRelationType() {
74  return 'ar_timestamp';
75  }
76 
81  public function doQuery( $db ) {
82  $timestamps = [];
83  foreach ( $this->ids as $id ) {
84  $timestamps[] = $db->timestamp( $id );
85  }
86 
87  $arQuery = $this->revisionStore->getArchiveQueryInfo();
88  $tables = $arQuery['tables'];
89  $fields = $arQuery['fields'];
90  $conds = [
91  'ar_namespace' => $this->getPage()->getNamespace(),
92  'ar_title' => $this->getPage()->getDBkey(),
93  'ar_timestamp' => $timestamps,
94  ];
95  $join_conds = $arQuery['joins'];
96  $options = [ 'ORDER BY' => 'ar_timestamp DESC' ];
97 
99  $tables,
100  $fields,
101  $conds,
102  $join_conds,
103  $options,
104  ''
105  );
106 
107  return $db->select( $tables,
108  $fields,
109  $conds,
110  __METHOD__,
111  $options,
112  $join_conds
113  );
114  }
115 
116  public function newItem( $row ) {
117  return new RevDelArchiveItem( $this, $row );
118  }
119 
120  public function doPreCommitUpdates() {
121  return Status::newGood();
122  }
123 
124  public function doPostCommitUpdates( array $visibilityChangeMap ) {
125  return Status::newGood();
126  }
127 }
static modifyDisplayQuery(&$tables, &$fields, &$conds, &$join_conds, &$options, $filter_tag='', bool $exclude=false)
Applies all tags-related changes to a query.
Definition: ChangeTags.php:906
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.
__construct(IContextSource $context, PageIdentity $page, array $ids, LBFactory $lbFactory, HookContainer $hookContainer, HtmlCacheUpdater $htmlCacheUpdater, RevisionStore $revisionStore, WANObjectCache $wanObjectCache)
static getRelationType()
Get the DB field name associated with the ID list.
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
Multi-datacenter aware caching interface.
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:40