|
MediaWiki master
|
Backend logic for performing a page delete action. More...
Public Member Functions | |
| __construct (HookContainer $hookContainer, private readonly DomainEventDispatcher $eventDispatcher, private readonly RevisionStore $revisionStore, private readonly LBFactory $lbFactory, private readonly JobQueueGroup $jobQueueGroup, private readonly CommentStore $commentStore, private readonly ServiceOptions $options, private readonly BagOStuff $recentDeletesCache, private readonly string $webRequestID, private readonly WikiPageFactory $wikiPageFactory, private readonly UserFactory $userFactory, private readonly BacklinkCacheFactory $backlinkCacheFactory, private readonly NamespaceInfo $namespaceInfo, private readonly ITextFormatter $contLangMsgTextFormatter, private readonly RedirectStore $redirectStore, ProperPageIdentity $page, private readonly Authority $deleter, private readonly WriteDuplicator $linkWriteDuplicator, private readonly UserEditTracker $userEditTracker) | |
| 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 54 of file DeletePage.php.
| MediaWiki\Page\DeletePage::__construct | ( | HookContainer | $hookContainer, |
| private readonly DomainEventDispatcher | $eventDispatcher, | ||
| private readonly RevisionStore | $revisionStore, | ||
| private readonly LBFactory | $lbFactory, | ||
| private readonly JobQueueGroup | $jobQueueGroup, | ||
| private readonly CommentStore | $commentStore, | ||
| private readonly ServiceOptions | $options, | ||
| private readonly BagOStuff | $recentDeletesCache, | ||
| private readonly string | $webRequestID, | ||
| private readonly WikiPageFactory | $wikiPageFactory, | ||
| private readonly UserFactory | $userFactory, | ||
| private readonly BacklinkCacheFactory | $backlinkCacheFactory, | ||
| private readonly NamespaceInfo | $namespaceInfo, | ||
| private readonly ITextFormatter | $contLangMsgTextFormatter, | ||
| private readonly RedirectStore | $redirectStore, | ||
| ProperPageIdentity | $page, | ||
| private readonly Authority | $deleter, | ||
| private readonly WriteDuplicator | $linkWriteDuplicator, | ||
| private readonly UserEditTracker | $userEditTracker ) |
Definition at line 106 of file DeletePage.php.
| 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 198 of file DeletePage.php.
References if.
| MediaWiki\Page\DeletePage::deleteIfAllowed | ( | string | $reason | ) |
Same as deleteUnsafe, but checks permissions.
| string | $reason |
Definition at line 301 of file DeletePage.php.
References setDeletionAttempted().
| 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 463 of file DeletePage.php.
References wfEscapeWikiText().
| 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 383 of file DeletePage.php.
References setDeletionAttempted().
| MediaWiki\Page\DeletePage::deletionsWereScheduled | ( | ) |
| BadMethodCallException | If no deletions were attempted |
Definition at line 290 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 189 of file DeletePage.php.
References forceImmediate().
Referenced by forceImmediate().
| MediaWiki\Page\DeletePage::getLegacyHookErrors | ( | ) |
Definition at line 136 of file DeletePage.php.
| MediaWiki\Page\DeletePage::getSuccessfulDeletionsIDs | ( | ) |
| BadMethodCallException | If no deletions were attempted |
Definition at line 281 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 356 of file DeletePage.php.
References MediaWiki\MainConfigNames\DeleteRevisionsBatchSize, and if.
| MediaWiki\Page\DeletePage::keepLegacyHookErrorsSeparate | ( | ) |
Definition at line 144 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 223 of file DeletePage.php.
References if.
| MediaWiki\Page\DeletePage::setDeletionAttempted | ( | ) |
Called before attempting a deletion, allows the result getters to be used.
Definition at line 256 of file DeletePage.php.
Referenced by deleteIfAllowed(), and deleteUnsafe().
| MediaWiki\Page\DeletePage::setIsDeletePageUnitTest | ( | bool | $test | ) |
| bool | $test |
Definition at line 244 of file DeletePage.php.
References if.
| MediaWiki\Page\DeletePage::setLogSubtype | ( | string | $logSubtype | ) |
Set a specific log subtype for the deletion log entry.
| string | $logSubtype |
Definition at line 178 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 156 of file DeletePage.php.
| MediaWiki\Page\DeletePage::setTags | ( | array | $tags | ) |
Change tags to apply to the deletion action.
| string[] | $tags |
Definition at line 167 of file DeletePage.php.
| const MediaWiki\Page\DeletePage::CONSTRUCTOR_OPTIONS |
Definition at line 58 of file DeletePage.php.
| const MediaWiki\Page\DeletePage::PAGE_BASE = 'base' |
Constants used for the return value of getSuccessfulDeletionsIDs() and deletionsWereScheduled().
Definition at line 66 of file DeletePage.php.
Referenced by MediaWiki\Page\WikiPage\doDeleteArticleReal(), and MediaWiki\Page\DeletePageJob\run().
| const MediaWiki\Page\DeletePage::PAGE_TALK = 'talk' |
Definition at line 67 of file DeletePage.php.