22use MediaWiki\HookContainer\ProtectedHookAccessorTrait;
38 use ProtectedHookAccessorTrait;
52 return 'deleterevision';
56 return RevisionRecord::DELETED_TEXT;
60 $revisionRecord = MediaWikiServices::getInstance()
62 ->getRevisionById(
$ids[0] );
64 if ( $revisionRecord ) {
65 return Title::newFromLinkTarget( $revisionRecord->getPageAsLinkTarget() );
75 $revisionStore = MediaWikiServices::getInstance()->getRevisionStore();
76 $ids = array_map(
'intval', $this->ids );
77 $revQuery = $revisionStore->getQueryInfo( [
'page',
'user' ] );
82 'rev_page' => $this->title->getArticleID(),
86 'ORDER BY' =>
'rev_id DESC',
87 'USE INDEX' => [
'revision' =>
'PRIMARY' ]
95 $queryInfo[
'join_conds'],
96 $queryInfo[
'options'],
101 $queryInfo[
'tables'],
102 $queryInfo[
'fields'],
105 $queryInfo[
'options'],
106 $queryInfo[
'join_conds']
108 if ( $live->numRows() >= count(
$ids ) ) {
113 $arQuery = $revisionStore->getArchiveQueryInfo();
114 $archiveQueryInfo = [
115 'tables' => $arQuery[
'tables'],
116 'fields' => $arQuery[
'fields'],
120 'options' => [
'ORDER BY' =>
'ar_rev_id DESC' ],
121 'join_conds' => $arQuery[
'joins'],
125 $archiveQueryInfo[
'tables'],
126 $archiveQueryInfo[
'fields'],
127 $archiveQueryInfo[
'conds'],
128 $archiveQueryInfo[
'join_conds'],
129 $archiveQueryInfo[
'options'],
134 $archived = $db->select(
135 $archiveQueryInfo[
'tables'],
136 $archiveQueryInfo[
'fields'],
137 $archiveQueryInfo[
'conds'],
139 $archiveQueryInfo[
'options'],
140 $archiveQueryInfo[
'join_conds']
143 if ( $archived->numRows() == 0 ) {
145 } elseif ( $live->numRows() == 0 ) {
150 foreach ( $live as $row ) {
151 $rows[$row->rev_id] = $row;
153 foreach ( $archived as $row ) {
154 $rows[$row->ar_rev_id] = $row;
162 if ( isset( $row->rev_id ) ) {
164 } elseif ( isset( $row->ar_rev_id ) ) {
168 throw new MWException(
'Invalid row type in RevDelRevisionList' );
173 if ( $this->currentRevId ===
null ) {
175 $this->currentRevId = $dbw->selectField(
176 'page',
'page_latest', $this->title->pageCond(), __METHOD__ );
182 return RevisionRecord::DELETED_RESTRICTED;
186 $this->title->invalidateCache();
187 return Status::newGood();
191 $hcu = MediaWikiServices::getInstance()->getHtmlCacheUpdater();
192 $hcu->purgeTitleUrls( $this->title, $hcu::PURGE_INTENT_TXROUND_REFLECTED );
194 $this->getHookRunner()->onArticleRevisionVisibilitySet(
195 $this->title, $this->ids, $visibilityChangeMap );
196 MediaWikiServices::getInstance()
197 ->getMainWANObjectCache()
198 ->touchCheckKey(
"RevDelRevisionList:page:{$this->title->getArticleID()}}" );
200 return Status::newGood();
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
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.