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, RedirectStore $redirectStore, 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, $ticket=null) | |
deleteUnsafe (string $reason) | |
Back-end article deletion: deletes the article with database consistency, writes logs, purges caches. | |
deletionsWereScheduled () | |
forceImmediate (bool $forceImmediate) | |
If false, allows deleting over time via the job queue. | |
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 52 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, | ||
RedirectStore | $redirectStore, | ||
ProperPageIdentity | $page, | ||
Authority | $deleter ) |
Definition at line 119 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 225 of file DeletePage.php.
MediaWiki\Page\DeletePage::deleteIfAllowed | ( | string | $reason | ) |
Same as deleteUnsafe, but checks permissions.
string | $reason |
Definition at line 328 of file DeletePage.php.
MediaWiki\Page\DeletePage::deleteInternal | ( | WikiPage | $page, |
string | $pageRole, | ||
string | $reason, | ||
?string | $webRequestId = null, | ||
$ticket = 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 | |
mixed | null | $ticket | Result of ILBFactory::getEmptyTransactionTicket() or null |
Definition at line 491 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 410 of file DeletePage.php.
MediaWiki\Page\DeletePage::deletionsWereScheduled | ( | ) |
BadMethodCallException | If no deletions were attempted |
Definition at line 317 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 216 of file DeletePage.php.
MediaWiki\Page\DeletePage::getLegacyHookErrors | ( | ) |
Definition at line 163 of file DeletePage.php.
MediaWiki\Page\DeletePage::getSuccessfulDeletionsIDs | ( | ) |
BadMethodCallException | If no deletions were attempted |
Definition at line 308 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 383 of file DeletePage.php.
MediaWiki\Page\DeletePage::keepLegacyHookErrorsSeparate | ( | ) |
Definition at line 171 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 250 of file DeletePage.php.
MediaWiki\Page\DeletePage::setDeletionAttempted | ( | ) |
Called before attempting a deletion, allows the result getters to be used.
Definition at line 283 of file DeletePage.php.
MediaWiki\Page\DeletePage::setIsDeletePageUnitTest | ( | bool | $test | ) |
bool | $test |
Definition at line 271 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 205 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 183 of file DeletePage.php.
MediaWiki\Page\DeletePage::setTags | ( | array | $tags | ) |
Change tags to apply to the deletion action.
string[] | $tags |
Definition at line 194 of file DeletePage.php.
const MediaWiki\Page\DeletePage::CONSTRUCTOR_OPTIONS |
Definition at line 56 of file DeletePage.php.
const MediaWiki\Page\DeletePage::PAGE_BASE = 'base' |
Constants used for the return value of getSuccessfulDeletionsIDs() and deletionsWereScheduled()
Definition at line 64 of file DeletePage.php.
const MediaWiki\Page\DeletePage::PAGE_TALK = 'talk' |
Definition at line 65 of file DeletePage.php.