MediaWiki  master
RevDelArchiveList.php
Go to the documentation of this file.
1 <?php
29 
34 
36  private $revisionStore;
37 
47  public function __construct(
48  IContextSource $context,
50  array $ids,
51  LBFactory $lbFactory,
52  HookContainer $hookContainer,
53  HtmlCacheUpdater $htmlCacheUpdater,
54  RevisionStore $revisionStore
55  ) {
56  parent::__construct(
57  $context,
58  $page,
59  $ids,
60  $lbFactory,
61  $hookContainer,
62  $htmlCacheUpdater,
63  $revisionStore
64  );
65  $this->revisionStore = $revisionStore;
66  }
67 
68  public function getType() {
69  return 'archive';
70  }
71 
72  public static function getRelationType() {
73  return 'ar_timestamp';
74  }
75 
80  public function doQuery( $db ) {
81  $timestamps = [];
82  foreach ( $this->ids as $id ) {
83  $timestamps[] = $db->timestamp( $id );
84  }
85 
86  $arQuery = $this->revisionStore->getArchiveQueryInfo();
87  $tables = $arQuery['tables'];
88  $fields = $arQuery['fields'];
89  $conds = [
90  'ar_namespace' => $this->getPage()->getNamespace(),
91  'ar_title' => $this->getPage()->getDBkey(),
92  'ar_timestamp' => $timestamps,
93  ];
94  $join_conds = $arQuery['joins'];
95  $options = [ 'ORDER BY' => 'ar_timestamp DESC' ];
96 
98  $tables,
99  $fields,
100  $conds,
101  $join_conds,
102  $options,
103  ''
104  );
105 
106  return $db->select( $tables,
107  $fields,
108  $conds,
109  __METHOD__,
110  $options,
111  $join_conds
112  );
113  }
114 
115  public function newItem( $row ) {
116  return new RevDelArchiveItem( $this, $row );
117  }
118 
119  public function doPreCommitUpdates() {
120  return Status::newGood();
121  }
122 
123  public function doPostCommitUpdates( array $visibilityChangeMap ) {
124  return Status::newGood();
125  }
126 }
static modifyDisplayQuery(&$tables, &$fields, &$conds, &$join_conds, &$options, $filter_tag='', bool $exclude=false)
Applies all tags-related changes to a query.
Definition: ChangeTags.php:631
Class to invalidate the CDN and HTMLFileCache entries associated with URLs/titles.
Service for looking up page revisions.
Generic operation result class Has warning/error list, boolean status and arbitrary value.
Definition: Status.php:58
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
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
Result wrapper for grabbing data queried from an IDatabase object.