MediaWiki
master
|
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. More... | |
deleteIfAllowed (string $reason) | |
Same as deleteUnsafe, but checks permissions. More... | |
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. More... | |
deletionsWereScheduled () | |
deletionWasScheduled () | |
doDeleteUpdates (WikiPage $page, RevisionRecord $revRecord) | |
forceImmediate (bool $forceImmediate) | |
If false, allows deleting over time via the job queue. More... | |
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). More... | |
keepLegacyHookErrorsSeparate () | |
setDeleteAssociatedTalk (bool $delete) | |
If set to true and the page has a talk page, delete that one too. More... | |
setDeletionAttempted () | |
Called before attempting a deletion, allows the result getters to be used. More... | |
setIsDeletePageUnitTest (bool $test) | |
setLogSubtype (string $logSubtype) | |
Set a specific log subtype for the deletion log entry. More... | |
setSuppress (bool $suppress) | |
If true, suppress all revisions and log the deletion in the suppression log instead of the deletion log. More... | |
setTags (array $tags) | |
Change tags to apply to the deletion action. More... | |
Public Attributes | |
const | CONSTRUCTOR_OPTIONS |
const | PAGE_BASE = 'base' |
Constants used for the return value of getSuccessfulDeletionsIDs() and deletionsWereScheduled() More... | |
const | PAGE_TALK = 'talk' |
Private Member Functions | |
archiveRevisions (WikiPage $page, int $id) | |
Archives revisions as part of page deletion. More... | |
assertDeletionAttempted () | |
Asserts that a deletion operation was attempted. More... | |
authorizeDeletion () | |
isBigDeletion () | |
runPreDeleteHooks (WikiPage $page, string &$reason) | |
Private Attributes | |
WikiPage null | $associatedTalk |
If not null, it means that we have to delete it. More... | |
bool | $attemptedDeletion = false |
Whether a deletion was attempted. More... | |
BacklinkCacheFactory | $backlinkCacheFactory |
CommentStore | $commentStore |
ITextFormatter | $contLangMsgTextFormatter |
Authority | $deleter |
bool | $forceImmediate = false |
HookRunner | $hookRunner |
bool | $isDeletePageUnitTest = false |
JobQueueGroup | $jobQueueGroup |
LBFactory | $lbFactory |
string array | $legacyHookErrors = '' |
ILoadBalancer | $loadBalancer |
string | $localWikiID |
string | $logSubtype = 'delete' |
bool | $mergeLegacyHookErrors = true |
NamespaceInfo | $namespaceInfo |
ServiceOptions | $options |
WikiPage | $page |
BagOStuff | $recentDeletesCache |
RevisionStore | $revisionStore |
array< int|null > null | $successfulDeletionsIDs |
Keys are the self::PAGE_* constants. More... | |
bool | $suppress = false |
string[] | $tags = [] |
UserFactory | $userFactory |
array< bool|null > null | $wasScheduled |
Keys are the self::PAGE_* constants. More... | |
string | $webRequestID |
WikiPageFactory | $wikiPageFactory |
Backend logic for performing a page delete action.
Definition at line 52 of file DeletePage.php.
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 155 of file DeletePage.php.
References Page\DeletePage\$backlinkCacheFactory, Page\DeletePage\$commentStore, Page\DeletePage\$contLangMsgTextFormatter, Page\DeletePage\$deleter, Page\DeletePage\$jobQueueGroup, Page\DeletePage\$lbFactory, Page\DeletePage\$localWikiID, Page\DeletePage\$namespaceInfo, Page\DeletePage\$page, Page\DeletePage\$recentDeletesCache, Page\DeletePage\$revisionStore, Page\DeletePage\$userFactory, Page\DeletePage\$webRequestID, Page\DeletePage\$wikiPageFactory, and Page\WikiPageFactory\newFromTitle().
|
private |
Archives revisions as part of page deletion.
WikiPage | $page | |
int | $id |
Definition at line 729 of file DeletePage.php.
References $revQuery.
|
private |
Asserts that a deletion operation was attempted.
BadMethodCallException |
Definition at line 335 of file DeletePage.php.
|
private |
Definition at line 390 of file DeletePage.php.
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 262 of file DeletePage.php.
References StatusValue\newFatal().
Page\DeletePage::deleteIfAllowed | ( | string | $reason | ) |
Same as deleteUnsafe, but checks permissions.
string | $reason |
Definition at line 377 of file DeletePage.php.
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 545 of file DeletePage.php.
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 465 of file DeletePage.php.
Page\DeletePage::deletionsWereScheduled | ( | ) |
BadMethodCallException | If no deletions were attempted |
Definition at line 366 of file DeletePage.php.
Page\DeletePage::deletionWasScheduled | ( | ) |
BadMethodCallException | If no deletions were attempted |
Definition at line 355 of file DeletePage.php.
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 847 of file DeletePage.php.
Page\DeletePage::forceImmediate | ( | bool | $forceImmediate | ) |
If false, allows deleting over time via the job queue.
bool | $forceImmediate |
Definition at line 251 of file DeletePage.php.
Page\DeletePage::getDeletionUpdates | ( | WikiPage | $page, |
RevisionRecord | $rev | ||
) |
WikiPage | $page | |
RevisionRecord | $rev | The revision being deleted. |
Definition at line 924 of file DeletePage.php.
Page\DeletePage::getLegacyHookErrors | ( | ) |
Definition at line 198 of file DeletePage.php.
References Page\DeletePage\$legacyHookErrors.
Page\DeletePage::getSuccessfulDeletionsIDs | ( | ) |
BadMethodCallException | If no deletions were attempted |
Definition at line 345 of file DeletePage.php.
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 438 of file DeletePage.php.
|
private |
Definition at line 411 of file DeletePage.php.
Page\DeletePage::keepLegacyHookErrorsSeparate | ( | ) |
Definition at line 206 of file DeletePage.php.
|
private |
WikiPage | $page | |
string | &$reason |
Definition at line 499 of file DeletePage.php.
References StatusValue\fatal().
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 287 of file DeletePage.php.
Page\DeletePage::setDeletionAttempted | ( | ) |
Called before attempting a deletion, allows the result getters to be used.
Definition at line 320 of file DeletePage.php.
Page\DeletePage::setIsDeletePageUnitTest | ( | bool | $test | ) |
bool | $test |
Definition at line 308 of file DeletePage.php.
Page\DeletePage::setLogSubtype | ( | string | $logSubtype | ) |
Set a specific log subtype for the deletion log entry.
string | $logSubtype |
Definition at line 240 of file DeletePage.php.
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 218 of file DeletePage.php.
Page\DeletePage::setTags | ( | array | $tags | ) |
Change tags to apply to the deletion action.
string[] | $tags |
Definition at line 229 of file DeletePage.php.
|
private |
If not null, it means that we have to delete it.
Definition at line 116 of file DeletePage.php.
|
private |
Whether a deletion was attempted.
Definition at line 134 of file DeletePage.php.
|
private |
Definition at line 91 of file DeletePage.php.
Referenced by Page\DeletePage\__construct().
|
private |
Definition at line 79 of file DeletePage.php.
Referenced by Page\DeletePage\__construct().
|
private |
Definition at line 97 of file DeletePage.php.
Referenced by Page\DeletePage\__construct().
|
private |
Definition at line 105 of file DeletePage.php.
Referenced by Page\DeletePage\__construct().
|
private |
Definition at line 114 of file DeletePage.php.
|
private |
Definition at line 69 of file DeletePage.php.
|
private |
Definition at line 100 of file DeletePage.php.
|
private |
Definition at line 77 of file DeletePage.php.
Referenced by Page\DeletePage\__construct().
|
private |
Definition at line 73 of file DeletePage.php.
Referenced by Page\DeletePage\__construct().
|
private |
Definition at line 119 of file DeletePage.php.
Referenced by Page\DeletePage\getLegacyHookErrors().
|
private |
Definition at line 75 of file DeletePage.php.
|
private |
Definition at line 85 of file DeletePage.php.
Referenced by Page\DeletePage\__construct().
|
private |
Definition at line 112 of file DeletePage.php.
|
private |
Definition at line 121 of file DeletePage.php.
|
private |
Definition at line 95 of file DeletePage.php.
Referenced by Page\DeletePage\__construct().
|
private |
Definition at line 81 of file DeletePage.php.
|
private |
Definition at line 103 of file DeletePage.php.
Referenced by Page\DeletePage\__construct().
|
private |
Definition at line 83 of file DeletePage.php.
Referenced by Page\DeletePage\__construct().
|
private |
Definition at line 71 of file DeletePage.php.
Referenced by Page\DeletePage\__construct().
|
private |
Keys are the self::PAGE_* constants.
Values are null if the deletion couldn't happen (e.g. due to lacking perms) or was scheduled. PAGE_TALK is only set when deleting the associated talk.
Definition at line 127 of file DeletePage.php.
|
private |
Definition at line 108 of file DeletePage.php.
|
private |
Definition at line 110 of file DeletePage.php.
|
private |
Definition at line 89 of file DeletePage.php.
Referenced by Page\DeletePage\__construct().
|
private |
Keys are the self::PAGE_* constants.
Values are null if the deletion couldn't happen (e.g. due to lacking perms). PAGE_TALK is only set when deleting the associated talk.
Definition at line 132 of file DeletePage.php.
|
private |
Definition at line 87 of file DeletePage.php.
Referenced by Page\DeletePage\__construct().
|
private |
Definition at line 93 of file DeletePage.php.
Referenced by Page\DeletePage\__construct().
const Page\DeletePage::CONSTRUCTOR_OPTIONS |
Definition at line 56 of file DeletePage.php.
const Page\DeletePage::PAGE_BASE = 'base' |
Constants used for the return value of getSuccessfulDeletionsIDs() and deletionsWereScheduled()
Definition at line 65 of file DeletePage.php.
const Page\DeletePage::PAGE_TALK = 'talk' |
Definition at line 66 of file DeletePage.php.