53 private $htmlCacheUpdater;
56 private $revisionStore;
79 parent::__construct( $context,
$page,
$ids, $lbFactory );
80 $this->lbFactory = $lbFactory;
81 $this->hookRunner =
new HookRunner( $hookContainer );
82 $this->htmlCacheUpdater = $htmlCacheUpdater;
83 $this->revisionStore = $revisionStore;
95 return 'deleterevision';
99 return RevisionRecord::DELETED_TEXT;
103 $revisionRecord = MediaWikiServices::getInstance()
104 ->getRevisionLookup()
105 ->getRevisionById(
$ids[0] );
107 if ( $revisionRecord ) {
108 return Title::newFromLinkTarget( $revisionRecord->getPageAsLinkTarget() );
118 $ids = array_map(
'intval', $this->ids );
119 $revQuery = $this->revisionStore->getQueryInfo( [
'page',
'user' ] );
121 'tables' => $revQuery[
'tables'],
122 'fields' => $revQuery[
'fields'],
124 'rev_page' => $this->page->getId(),
128 'ORDER BY' =>
'rev_id DESC',
129 'USE INDEX' => [
'revision' =>
'PRIMARY' ]
131 'join_conds' => $revQuery[
'joins'],
134 $queryInfo[
'tables'],
135 $queryInfo[
'fields'],
137 $queryInfo[
'join_conds'],
138 $queryInfo[
'options'],
143 $queryInfo[
'tables'],
144 $queryInfo[
'fields'],
147 $queryInfo[
'options'],
148 $queryInfo[
'join_conds']
150 if ( $live->numRows() >= count(
$ids ) ) {
155 $arQuery = $this->revisionStore->getArchiveQueryInfo();
156 $archiveQueryInfo = [
157 'tables' => $arQuery[
'tables'],
158 'fields' => $arQuery[
'fields'],
162 'options' => [
'ORDER BY' =>
'ar_rev_id DESC' ],
163 'join_conds' => $arQuery[
'joins'],
167 $archiveQueryInfo[
'tables'],
168 $archiveQueryInfo[
'fields'],
169 $archiveQueryInfo[
'conds'],
170 $archiveQueryInfo[
'join_conds'],
171 $archiveQueryInfo[
'options'],
176 $archived = $db->select(
177 $archiveQueryInfo[
'tables'],
178 $archiveQueryInfo[
'fields'],
179 $archiveQueryInfo[
'conds'],
181 $archiveQueryInfo[
'options'],
182 $archiveQueryInfo[
'join_conds']
185 if ( $archived->numRows() == 0 ) {
187 } elseif ( $live->numRows() == 0 ) {
192 foreach ( $live as $row ) {
193 $rows[$row->rev_id] = $row;
195 foreach ( $archived as $row ) {
196 $rows[$row->ar_rev_id] = $row;
204 if ( isset( $row->rev_id ) ) {
206 } elseif ( isset( $row->ar_rev_id ) ) {
210 throw new InvalidArgumentException(
'Invalid row type in RevDelRevisionList' );
215 if ( $this->currentRevId ===
null ) {
216 $dbw = $this->lbFactory->getPrimaryDatabase();
217 $this->currentRevId = $dbw->newSelectQueryBuilder()
218 ->select(
'page_latest' )
220 ->where( [
'page_namespace' => $this->page->getNamespace(),
'page_title' => $this->page->getDBkey() ] )
221 ->caller( __METHOD__ )->fetchField();
227 Title::newFromPageIdentity( $this->page )->invalidateCache();
228 return Status::newGood();
232 $this->htmlCacheUpdater->purgeTitleUrls(
234 HtmlCacheUpdater::PURGE_INTENT_TXROUND_REFLECTED
237 $this->hookRunner->onArticleRevisionVisibilitySet(
238 Title::newFromPageIdentity( $this->page ),
243 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.