MediaWiki REL1_40
|
Backend logic for performing a page delete action. More...
Public Member Functions | |
__construct (HookContainer $hookContainer, RevisionStore $revisionStore, LBFactory $lbFactory, JobQueueGroup $jobQueueGroup, CommentStore $commentStore, ServiceOptions $serviceOptions, BagOStuff $recentDeletesCache, string $localWikiID, string $webRequestID, WikiPageFactory $wikiPageFactory, UserFactory $userFactory, BacklinkCacheFactory $backlinkCacheFactory, NamespaceInfo $namespaceInfo, ITextFormatter $contLangMsgTextFormatter, ProperPageIdentity $page, Authority $deleter) | |
canProbablyDeleteAssociatedTalk () | |
Tests whether it's probably possible to delete the associated talk page. | |
deleteIfAllowed (string $reason) | |
Same as deleteUnsafe, but checks permissions. | |
deleteInternal (WikiPage $page, string $pageRole, string $reason, ?string $webRequestId=null) | |
deleteUnsafe (string $reason) | |
Back-end article deletion: deletes the article with database consistency, writes logs, purges caches. | |
deletionsWereScheduled () | |
doDeleteUpdates (WikiPage $page, RevisionRecord $revRecord) | |
forceImmediate (bool $forceImmediate) | |
If false, allows deleting over time via the job queue. | |
getDeletionUpdates (WikiPage $page, RevisionRecord $rev) | |
getLegacyHookErrors () | |
getSuccessfulDeletionsIDs () | |
isBatchedDelete (int $safetyMargin=0) | |
Determines if this deletion would be batched (executed over time by the job queue) or not (completed in the same request as the delete call). | |
keepLegacyHookErrorsSeparate () | |
setDeleteAssociatedTalk (bool $delete) | |
If set to true and the page has a talk page, delete that one too. | |
setDeletionAttempted () | |
Called before attempting a deletion, allows the result getters to be used. | |
setIsDeletePageUnitTest (bool $test) | |
setLogSubtype (string $logSubtype) | |
Set a specific log subtype for the deletion log entry. | |
setSuppress (bool $suppress) | |
If true, suppress all revisions and log the deletion in the suppression log instead of the deletion log. | |
setTags (array $tags) | |
Change tags to apply to the deletion action. | |
Public Attributes | |
const | CONSTRUCTOR_OPTIONS |
const | PAGE_BASE = 'base' |
Constants used for the return value of getSuccessfulDeletionsIDs() and deletionsWereScheduled() | |
const | PAGE_TALK = 'talk' |
Backend logic for performing a page delete action.
Definition at line 51 of file DeletePage.php.
MediaWiki\Page\DeletePage::__construct | ( | HookContainer | $hookContainer, |
RevisionStore | $revisionStore, | ||
LBFactory | $lbFactory, | ||
JobQueueGroup | $jobQueueGroup, | ||
CommentStore | $commentStore, | ||
ServiceOptions | $serviceOptions, | ||
BagOStuff | $recentDeletesCache, | ||
string | $localWikiID, | ||
string | $webRequestID, | ||
WikiPageFactory | $wikiPageFactory, | ||
UserFactory | $userFactory, | ||
BacklinkCacheFactory | $backlinkCacheFactory, | ||
NamespaceInfo | $namespaceInfo, | ||
ITextFormatter | $contLangMsgTextFormatter, | ||
ProperPageIdentity | $page, | ||
Authority | $deleter ) |
HookContainer | $hookContainer | |
RevisionStore | $revisionStore | |
LBFactory | $lbFactory | |
JobQueueGroup | $jobQueueGroup | |
CommentStore | $commentStore | |
ServiceOptions | $serviceOptions | |
BagOStuff | $recentDeletesCache | |
string | $localWikiID | |
string | $webRequestID | |
WikiPageFactory | $wikiPageFactory | |
UserFactory | $userFactory | |
BacklinkCacheFactory | $backlinkCacheFactory | |
NamespaceInfo | $namespaceInfo | |
ITextFormatter | $contLangMsgTextFormatter | |
ProperPageIdentity | $page | |
Authority | $deleter |
Definition at line 151 of file DeletePage.php.
References MediaWiki\Config\ServiceOptions\assertRequiredOptions(), and MediaWiki\Page\WikiPageFactory\newFromTitle().
MediaWiki\Page\DeletePage::canProbablyDeleteAssociatedTalk | ( | ) |
Tests whether it's probably possible to delete the associated talk page.
This checks the replica, so it may not see the latest master change, and is useful e.g. for building the UI.
Definition at line 257 of file DeletePage.php.
MediaWiki\Page\DeletePage::deleteIfAllowed | ( | string | $reason | ) |
Same as deleteUnsafe, but checks permissions.
string | $reason |
Definition at line 360 of file DeletePage.php.
MediaWiki\Page\DeletePage::deleteInternal | ( | WikiPage | $page, |
string | $pageRole, | ||
string | $reason, | ||
?string | $webRequestId = null ) |
Only invokes batching via the job queue if necessary per DeleteRevisionsBatchSize. Deletions can often be completed inline without involving the job queue.
Potentially called many times per deletion operation for pages with many revisions.
WikiPage | $page | |
string | $pageRole | |
string | $reason | |
string | null | $webRequestId |
Definition at line 528 of file DeletePage.php.
MediaWiki\Page\DeletePage::deleteUnsafe | ( | string | $reason | ) |
Back-end article deletion: deletes the article with database consistency, writes logs, purges caches.
string | $reason | Delete reason for deletion log |
Definition at line 448 of file DeletePage.php.
MediaWiki\Page\DeletePage::deletionsWereScheduled | ( | ) |
BadMethodCallException | If no deletions were attempted |
Definition at line 349 of file DeletePage.php.
MediaWiki\Page\DeletePage::doDeleteUpdates | ( | WikiPage | $page, |
RevisionRecord | $revRecord ) |
WikiPage | $page | |
RevisionRecord | $revRecord | The current page revision at the time of deletion, used when determining the required updates. This may be needed because $page->getRevisionRecord() may already return null when the page proper was deleted. |
Definition at line 829 of file DeletePage.php.
MediaWiki\Page\DeletePage::forceImmediate | ( | bool | $forceImmediate | ) |
If false, allows deleting over time via the job queue.
bool | $forceImmediate |
Definition at line 246 of file DeletePage.php.
MediaWiki\Page\DeletePage::getDeletionUpdates | ( | WikiPage | $page, |
RevisionRecord | $rev ) |
WikiPage | $page | |
RevisionRecord | $rev | The revision being deleted. |
Definition at line 906 of file DeletePage.php.
MediaWiki\Page\DeletePage::getLegacyHookErrors | ( | ) |
Definition at line 193 of file DeletePage.php.
MediaWiki\Page\DeletePage::getSuccessfulDeletionsIDs | ( | ) |
BadMethodCallException | If no deletions were attempted |
Definition at line 340 of file DeletePage.php.
MediaWiki\Page\DeletePage::isBatchedDelete | ( | int | $safetyMargin = 0 | ) |
Determines if this deletion would be batched (executed over time by the job queue) or not (completed in the same request as the delete call).
It is unlikely but possible that an edit from another request could push the page over the batching threshold after this function is called, but before the caller acts upon the return value. Callers must decide for themselves how to deal with this. $safetyMargin is provided as an unreliable but situationally useful help for some common cases.
int | $safetyMargin | Added to the revision count when checking for batching |
Definition at line 421 of file DeletePage.php.
MediaWiki\Page\DeletePage::keepLegacyHookErrorsSeparate | ( | ) |
Definition at line 201 of file DeletePage.php.
MediaWiki\Page\DeletePage::setDeleteAssociatedTalk | ( | bool | $delete | ) |
If set to true and the page has a talk page, delete that one too.
Callers should call canProbablyDeleteAssociatedTalk first to make sure this is a valid operation. Note that the checks here are laxer than those in canProbablyDeleteAssociatedTalk. In particular, this doesn't check whether the page exists as that may be subject to race condition, and it's checked later on (in deleteInternal, using latest data) anyway.
bool | $delete |
BadMethodCallException | If $delete is true and the given page is not a talk page. |
Definition at line 282 of file DeletePage.php.
MediaWiki\Page\DeletePage::setDeletionAttempted | ( | ) |
Called before attempting a deletion, allows the result getters to be used.
Definition at line 315 of file DeletePage.php.
MediaWiki\Page\DeletePage::setIsDeletePageUnitTest | ( | bool | $test | ) |
bool | $test |
Definition at line 303 of file DeletePage.php.
MediaWiki\Page\DeletePage::setLogSubtype | ( | string | $logSubtype | ) |
Set a specific log subtype for the deletion log entry.
string | $logSubtype |
Definition at line 235 of file DeletePage.php.
MediaWiki\Page\DeletePage::setSuppress | ( | bool | $suppress | ) |
If true, suppress all revisions and log the deletion in the suppression log instead of the deletion log.
bool | $suppress |
Definition at line 213 of file DeletePage.php.
MediaWiki\Page\DeletePage::setTags | ( | array | $tags | ) |
Change tags to apply to the deletion action.
string[] | $tags |
Definition at line 224 of file DeletePage.php.
const MediaWiki\Page\DeletePage::CONSTRUCTOR_OPTIONS |
Definition at line 55 of file DeletePage.php.
const MediaWiki\Page\DeletePage::PAGE_BASE = 'base' |
Constants used for the return value of getSuccessfulDeletionsIDs() and deletionsWereScheduled()
Definition at line 63 of file DeletePage.php.
const MediaWiki\Page\DeletePage::PAGE_TALK = 'talk' |
Definition at line 64 of file DeletePage.php.