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 $revQuery = $this->revisionStore->getQueryInfo( [
'page',
'user' ] );
123 'rev_page' => $this->page->getId(),
127 'ORDER BY' =>
'rev_id DESC',
128 'USE INDEX' => [
'revision' =>
'PRIMARY' ]
133 $queryInfo[
'tables'],
134 $queryInfo[
'fields'],
136 $queryInfo[
'join_conds'],
137 $queryInfo[
'options'],
142 $queryInfo[
'tables'],
143 $queryInfo[
'fields'],
146 $queryInfo[
'options'],
147 $queryInfo[
'join_conds']
149 if ( $live->numRows() >= count(
$ids ) ) {
154 $arQuery = $this->revisionStore->getArchiveQueryInfo();
155 $archiveQueryInfo = [
156 'tables' => $arQuery[
'tables'],
157 'fields' => $arQuery[
'fields'],
161 'options' => [
'ORDER BY' =>
'ar_rev_id DESC' ],
162 'join_conds' => $arQuery[
'joins'],
166 $archiveQueryInfo[
'tables'],
167 $archiveQueryInfo[
'fields'],
168 $archiveQueryInfo[
'conds'],
169 $archiveQueryInfo[
'join_conds'],
170 $archiveQueryInfo[
'options'],
175 $archived = $db->select(
176 $archiveQueryInfo[
'tables'],
177 $archiveQueryInfo[
'fields'],
178 $archiveQueryInfo[
'conds'],
180 $archiveQueryInfo[
'options'],
181 $archiveQueryInfo[
'join_conds']
184 if ( $archived->numRows() == 0 ) {
186 } elseif ( $live->numRows() == 0 ) {
191 foreach ( $live as $row ) {
192 $rows[$row->rev_id] = $row;
194 foreach ( $archived as $row ) {
195 $rows[$row->ar_rev_id] = $row;
203 if ( isset( $row->rev_id ) ) {
205 } elseif ( isset( $row->ar_rev_id ) ) {
209 throw new InvalidArgumentException(
'Invalid row type in RevDelRevisionList' );
214 if ( $this->currentRevId ===
null ) {
215 $dbw = $this->lbFactory->getPrimaryDatabase();
216 $this->currentRevId = $dbw->selectField(
219 [
'page_namespace' => $this->page->getNamespace(),
'page_title' => $this->page->getDBkey() ],
227 return RevisionRecord::DELETED_RESTRICTED;
231 Title::castFromPageIdentity( $this->page )->invalidateCache();
236 $this->htmlCacheUpdater->purgeTitleUrls(
238 HtmlCacheUpdater::PURGE_INTENT_TXROUND_REFLECTED
241 $this->hookRunner->onArticleRevisionVisibilitySet(
243 Title::castFromPageIdentity( $this->page ),
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.
__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.
static newGood( $value=null)
Factory function for good results.
Interface for objects which can provide a MediaWiki context on request.
Interface for objects (potentially) representing an editable wiki page.