MediaWiki  master
RevDelArchiveList.php
Go to the documentation of this file.
1 <?php
27 
32 
34  private $revisionStore;
35 
46  public function __construct(
48  PageIdentity $page,
49  array $ids,
51  HookContainer $hookContainer,
55  ) {
56  parent::__construct(
57  $context,
58  $page,
59  $ids,
60  $lbFactory,
61  $hookContainer,
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 }
Page\PageIdentity
Interface for objects (potentially) representing an editable wiki page.
Definition: PageIdentity.php:64
ContextSource\$context
IContextSource $context
Definition: ContextSource.php:39
RevDelRevisionList\$wanObjectCache
WANObjectCache $wanObjectCache
Definition: RevDelRevisionList.php:56
MediaWiki\Revision\RevisionStore
Service for looking up page revisions.
Definition: RevisionStore.php:89
RevDelArchiveList
List for archive table items, i.e.
Definition: RevDelArchiveList.php:31
Wikimedia\Rdbms\IDatabase
Basic database interface for live and lazy-loaded relation database handles.
Definition: IDatabase.php:38
ChangeTags\modifyDisplayQuery
static modifyDisplayQuery(&$tables, &$fields, &$conds, &$join_conds, &$options, $filter_tag='')
Applies all tags-related changes to a query.
Definition: ChangeTags.php:896
RevDelRevisionList
List for revision table items.
Definition: RevDelRevisionList.php:41
RevDelArchiveList\__construct
__construct(IContextSource $context, PageIdentity $page, array $ids, LBFactory $lbFactory, HookContainer $hookContainer, HtmlCacheUpdater $htmlCacheUpdater, RevisionStore $revisionStore, WANObjectCache $wanObjectCache)
Definition: RevDelArchiveList.php:46
RevDelRevisionList\$htmlCacheUpdater
HtmlCacheUpdater $htmlCacheUpdater
Definition: RevDelRevisionList.php:50
RevDelArchiveList\doPostCommitUpdates
doPostCommitUpdates(array $visibilityChangeMap)
A hook for setVisibility(): do any necessary updates post-commit.
Definition: RevDelArchiveList.php:124
RevDelArchiveList\doQuery
doQuery( $db)
Definition: RevDelArchiveList.php:81
RevDelArchiveItem
Item class for a archive table row.
Definition: RevDelArchiveItem.php:28
RevDelArchiveList\newItem
newItem( $row)
Create an item object from a DB result row.
Definition: RevDelArchiveList.php:116
RevDelArchiveList\getRelationType
static getRelationType()
Get the DB field name associated with the ID list.
Definition: RevDelArchiveList.php:73
StatusValue\newGood
static newGood( $value=null)
Factory function for good results.
Definition: StatusValue.php:82
RevDelRevisionList\$lbFactory
LBFactory $lbFactory
Definition: RevDelRevisionList.php:44
WANObjectCache
Multi-datacenter aware caching interface.
Definition: WANObjectCache.php:131
RevisionListBase\$ids
int[] null $ids
Definition: RevisionListBase.php:37
HtmlCacheUpdater
Class to invalidate the CDN and HTMLFileCache entries associated with URLs/titles.
Definition: HtmlCacheUpdater.php:32
RevisionListBase\getPage
getPage()
Definition: RevisionListBase.php:62
IContextSource
Interface for objects which can provide a MediaWiki context on request.
Definition: IContextSource.php:58
Wikimedia\Rdbms\LBFactory
An interface for generating database load balancers.
Definition: LBFactory.php:42
RevDelArchiveList\doPreCommitUpdates
doPreCommitUpdates()
A hook for setVisibility(): do batch updates pre-commit.
Definition: RevDelArchiveList.php:120
RevDelArchiveList\$revisionStore
RevisionStore $revisionStore
Definition: RevDelArchiveList.php:34
MediaWiki\HookContainer\HookContainer
HookContainer class.
Definition: HookContainer.php:45
RevDelArchiveList\getType
getType()
Get the internal type name of this list.
Definition: RevDelArchiveList.php:69