52 private $htmlCacheUpdater;
55 private $revisionStore;
78 parent::__construct( $context,
$page,
$ids, $lbFactory );
79 $this->lbFactory = $lbFactory;
80 $this->hookRunner =
new HookRunner( $hookContainer );
81 $this->htmlCacheUpdater = $htmlCacheUpdater;
82 $this->revisionStore = $revisionStore;
94 return 'deleterevision';
98 return RevisionRecord::DELETED_TEXT;
102 $revisionRecord = MediaWikiServices::getInstance()
103 ->getRevisionLookup()
104 ->getRevisionById(
$ids[0] );
106 if ( $revisionRecord ) {
107 return Title::newFromLinkTarget( $revisionRecord->getPageAsLinkTarget() );
117 $ids = array_map(
'intval', $this->ids );
118 $queryBuilder = $this->revisionStore->newSelectQueryBuilder( $db )
122 ->where( [
'rev_page' => $this->page->getId(),
'rev_id' =>
$ids ] )
123 ->orderBy(
'rev_id', \
Wikimedia\Rdbms\SelectQueryBuilder::SORT_DESC )
125 ->useIndex( [
'revision' =>
'PRIMARY' ] );
127 MediaWikiServices::getInstance()->getChangeTagsStore()->modifyDisplayQueryBuilder( $queryBuilder,
'revision' );
129 $live = $queryBuilder->caller( __METHOD__ )->fetchResultSet();
130 if ( $live->numRows() >= count(
$ids ) ) {
135 $queryBuilder = $this->revisionStore->newArchiveSelectQueryBuilder( $db )
137 ->where( [
'ar_rev_id' =>
$ids ] )
138 ->orderBy(
'ar_rev_id', \
Wikimedia\Rdbms\SelectQueryBuilder::SORT_DESC );
140 MediaWikiServices::getInstance()->getChangeTagsStore()->modifyDisplayQueryBuilder( $queryBuilder,
'archive' );
143 $archived = $queryBuilder->caller( __METHOD__ )->fetchResultSet();
145 if ( $archived->numRows() == 0 ) {
147 } elseif ( $live->numRows() == 0 ) {
152 foreach ( $live as $row ) {
153 $rows[$row->rev_id] = $row;
155 foreach ( $archived as $row ) {
156 $rows[$row->ar_rev_id] = $row;
164 if ( isset( $row->rev_id ) ) {
166 } elseif ( isset( $row->ar_rev_id ) ) {
170 throw new InvalidArgumentException(
'Invalid row type in RevDelRevisionList' );
175 if ( $this->currentRevId ===
null ) {
176 $dbw = $this->lbFactory->getPrimaryDatabase();
177 $this->currentRevId = $dbw->newSelectQueryBuilder()
178 ->select(
'page_latest' )
180 ->where( [
'page_namespace' => $this->page->getNamespace(),
'page_title' => $this->page->getDBkey() ] )
181 ->caller( __METHOD__ )->fetchField();
187 Title::newFromPageIdentity( $this->page )->invalidateCache();
188 return Status::newGood();
192 $this->htmlCacheUpdater->purgeTitleUrls(
194 HtmlCacheUpdater::PURGE_INTENT_TXROUND_REFLECTED
197 $this->hookRunner->onArticleRevisionVisibilitySet(
198 Title::newFromPageIdentity( $this->page ),
203 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.
__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.
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.
Interface for objects which can provide a MediaWiki context on request.
Interface for objects (potentially) representing an editable wiki page.