54 private $htmlCacheUpdater;
57 private $revisionStore;
80 parent::__construct( $context,
$page,
$ids, $lbFactory );
81 $this->lbFactory = $lbFactory;
82 $this->hookRunner =
new HookRunner( $hookContainer );
83 $this->htmlCacheUpdater = $htmlCacheUpdater;
84 $this->revisionStore = $revisionStore;
96 return 'deleterevision';
100 return RevisionRecord::DELETED_TEXT;
104 $revisionRecord = MediaWikiServices::getInstance()
105 ->getRevisionLookup()
106 ->getRevisionById(
$ids[0] );
108 if ( $revisionRecord ) {
109 return Title::newFromLinkTarget( $revisionRecord->getPageAsLinkTarget() );
119 $ids = array_map(
'intval', $this->ids );
120 $queryBuilder = $this->revisionStore->newSelectQueryBuilder( $db )
124 ->where( [
'rev_page' => $this->page->getId(),
'rev_id' =>
$ids ] )
125 ->orderBy(
'rev_id', \
Wikimedia\Rdbms\SelectQueryBuilder::SORT_DESC )
127 ->useIndex( [
'revision' =>
'PRIMARY' ] );
129 MediaWikiServices::getInstance()->getChangeTagsStore()->modifyDisplayQueryBuilder( $queryBuilder,
'revision' );
131 $live = $queryBuilder->caller( __METHOD__ )->fetchResultSet();
132 if ( $live->numRows() >= count(
$ids ) ) {
137 $queryBuilder = $this->revisionStore->newArchiveSelectQueryBuilder( $db )
139 ->where( [
'ar_rev_id' =>
$ids ] )
140 ->orderBy(
'ar_rev_id', \
Wikimedia\Rdbms\SelectQueryBuilder::SORT_DESC );
142 MediaWikiServices::getInstance()->getChangeTagsStore()->modifyDisplayQueryBuilder( $queryBuilder,
'archive' );
145 $archived = $queryBuilder->caller( __METHOD__ )->fetchResultSet();
147 if ( $archived->numRows() == 0 ) {
149 } elseif ( $live->numRows() == 0 ) {
154 foreach ( $live as $row ) {
155 $rows[$row->rev_id] = $row;
157 foreach ( $archived as $row ) {
158 $rows[$row->ar_rev_id] = $row;
166 if ( isset( $row->rev_id ) ) {
168 } elseif ( isset( $row->ar_rev_id ) ) {
172 throw new InvalidArgumentException(
'Invalid row type in RevDelRevisionList' );
177 if ( $this->currentRevId ===
null ) {
178 $dbw = $this->lbFactory->getPrimaryDatabase();
179 $this->currentRevId = $dbw->newSelectQueryBuilder()
180 ->select(
'page_latest' )
182 ->where( [
'page_namespace' => $this->page->getNamespace(),
'page_title' => $this->page->getDBkey() ] )
183 ->caller( __METHOD__ )->fetchField();
189 Title::newFromPageIdentity( $this->page )->invalidateCache();
190 return Status::newGood();
194 $this->htmlCacheUpdater->purgeTitleUrls(
196 HTMLCacheUpdater::PURGE_INTENT_TXROUND_REFLECTED
199 $this->hookRunner->onArticleRevisionVisibilitySet(
200 Title::newFromPageIdentity( $this->page ),
205 return Status::newGood();
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.