50 private $htmlCacheUpdater;
53 private $revisionStore;
56 private $wanObjectCache;
81 parent::__construct( $context,
$page,
$ids, $lbFactory );
82 $this->lbFactory = $lbFactory;
83 $this->hookRunner =
new HookRunner( $hookContainer );
84 $this->htmlCacheUpdater = $htmlCacheUpdater;
85 $this->revisionStore = $revisionStore;
86 $this->wanObjectCache = $wanObjectCache;
98 return 'deleterevision';
102 return RevisionRecord::DELETED_TEXT;
106 $revisionRecord = MediaWikiServices::getInstance()
107 ->getRevisionLookup()
108 ->getRevisionById(
$ids[0] );
110 if ( $revisionRecord ) {
111 return Title::newFromLinkTarget( $revisionRecord->getPageAsLinkTarget() );
121 $ids = array_map(
'intval', $this->ids );
122 $revQuery = $this->revisionStore->getQueryInfo( [
'page',
'user' ] );
127 'rev_page' => $this->page->getId(),
131 'ORDER BY' =>
'rev_id DESC',
132 'USE INDEX' => [
'revision' =>
'PRIMARY' ]
137 $queryInfo[
'tables'],
138 $queryInfo[
'fields'],
140 $queryInfo[
'join_conds'],
141 $queryInfo[
'options'],
146 $queryInfo[
'tables'],
147 $queryInfo[
'fields'],
150 $queryInfo[
'options'],
151 $queryInfo[
'join_conds']
153 if ( $live->numRows() >= count(
$ids ) ) {
158 $arQuery = $this->revisionStore->getArchiveQueryInfo();
159 $archiveQueryInfo = [
160 'tables' => $arQuery[
'tables'],
161 'fields' => $arQuery[
'fields'],
165 'options' => [
'ORDER BY' =>
'ar_rev_id DESC' ],
166 'join_conds' => $arQuery[
'joins'],
170 $archiveQueryInfo[
'tables'],
171 $archiveQueryInfo[
'fields'],
172 $archiveQueryInfo[
'conds'],
173 $archiveQueryInfo[
'join_conds'],
174 $archiveQueryInfo[
'options'],
179 $archived = $db->select(
180 $archiveQueryInfo[
'tables'],
181 $archiveQueryInfo[
'fields'],
182 $archiveQueryInfo[
'conds'],
184 $archiveQueryInfo[
'options'],
185 $archiveQueryInfo[
'join_conds']
188 if ( $archived->numRows() == 0 ) {
190 } elseif ( $live->numRows() == 0 ) {
195 foreach ( $live as $row ) {
196 $rows[$row->rev_id] = $row;
198 foreach ( $archived as $row ) {
199 $rows[$row->ar_rev_id] = $row;
207 if ( isset( $row->rev_id ) ) {
209 } elseif ( isset( $row->ar_rev_id ) ) {
213 throw new MWException(
'Invalid row type in RevDelRevisionList' );
218 if ( $this->currentRevId ===
null ) {
219 $dbw = $this->lbFactory->getMainLB()->getConnectionRef(
DB_PRIMARY );
220 $this->currentRevId = $dbw->selectField(
223 [
'page_namespace' => $this->page->getNamespace(),
'page_title' => $this->page->getDBkey() ],
231 return RevisionRecord::DELETED_RESTRICTED;
235 Title::castFromPageIdentity( $this->page )->invalidateCache();
236 return Status::newGood();
240 $this->htmlCacheUpdater->purgeTitleUrls(
242 HtmlCacheUpdater::PURGE_INTENT_TXROUND_REFLECTED
245 $this->hookRunner->onArticleRevisionVisibilitySet(
247 Title::castFromPageIdentity( $this->page ),
251 $this->wanObjectCache->touchCheckKey(
252 "RevDelRevisionList:page:{$this->page->getID()}}"
255 return Status::newGood();
Class to invalidate the CDN and HTMLFileCache entries associated with URLs/titles.
Item class for a archive table row by ar_rev_id – actually used via RevDelRevisionList.
List for revision table items.
getSuppressBit()
Get the integer value of the flag used for suppression.
doPostCommitUpdates(array $visibilityChangeMap)
A hook for setVisibility(): do any necessary updates post-commit.
static getRevdelConstant()
Get the revision deletion constant for this list type Override this function.
static getRelationType()
Get the DB field name associated with the ID list.
static suggestTarget( $target, array $ids)
Suggest a target for the revision deletion Optionally override this function.
static getRestriction()
Get the user right required for this list type Override this function.
doPreCommitUpdates()
A hook for setVisibility(): do batch updates pre-commit.
getType()
Get the internal type name of this list.
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)
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.