39 $forceLinkUpdate =
$params[
'forcelinkupdate'];
40 $forceRecursiveLinkUpdate =
$params[
'forcerecursivelinkupdate'];
44 $result = $pageSet->getInvalidTitlesAndRevisions();
47 foreach ( $pageSet->getGoodTitles() as $title ) {
50 $page = WikiPage::factory( $title );
51 if ( !$user->pingLimiter(
'purge' ) ) {
59 if ( $forceLinkUpdate || $forceRecursiveLinkUpdate ) {
60 if ( !$user->pingLimiter(
'linkpurge' ) ) {
61 # Logging to better see expensive usage patterns
62 if ( $forceRecursiveLinkUpdate ) {
63 LoggerFactory::getInstance(
'RecursiveLinkPurge' )->info(
64 "Recursive link purge enqueued for {title}",
66 'user' => $this->
getUser()->getName(),
67 'title' => $title->getPrefixedText()
72 $page->updateParserCache( [
73 'causeAction' =>
'api-purge',
74 'causeAgent' => $this->
getUser()->getName(),
76 $page->doSecondaryDataUpdates( [
77 'recursive' => $forceRecursiveLinkUpdate,
78 'causeAction' =>
'api-purge',
79 'causeAgent' => $this->
getUser()->getName(),
80 'defer' => DeferredUpdates::PRESEND,
82 $r[
'linkupdate'] =
true;
85 $forceLinkUpdate =
false;
93 $apiResult->addValue(
null, $this->
getModuleName(), $result );
95 $values = $pageSet->getNormalizedTitlesAsResult( $apiResult );
97 $apiResult->addValue(
null,
'normalized', $values );
99 $values = $pageSet->getConvertedTitlesAsResult( $apiResult );
101 $apiResult->addValue(
null,
'converted', $values );
103 $values = $pageSet->getRedirectTitlesAsResult( $apiResult );
105 $apiResult->addValue(
null,
'redirects', $values );
109 $continuationManager->setContinuationIntoResult( $apiResult );
117 if ( $this->mPageSet ===
null ) {
134 'forcelinkupdate' =>
false,
135 'forcerecursivelinkupdate' =>
false,
141 $result += $this->
getPageSet()->getFinalParams( $flags );
149 'action=purge&titles=Main_Page|API'
150 =>
'apihelp-purge-example-simple',
151 'action=purge&generator=allpages&gapnamespace=0&gaplimit=10'
152 =>
'apihelp-purge-example-generator',
157 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Purge';
This abstract class implements many basic API functions, and is the base of all API classes.
setContinuationManager(ApiContinuationManager $manager=null)
Set the continuation manager.
getResult()
Get the result object.
extractRequestParams( $options=[])
Using getAllowedParams(), this function makes an array of the values provided by the user,...
const PARAM_HELP_MSG
(string|array|Message) Specify an alternative i18n documentation message for this parameter.
addWarning( $msg, $code=null, $data=null)
Add a warning for this module.
getModuleName()
Get the name of the module being executed by this instance.
This manages continuation state.
This class contains a list of pages that the client has requested.
API interface for page purging.
getAllowedParams( $flags=0)
getExamplesMessages()
Returns usage examples for this module.
getPageSet()
Get a cached instance of an ApiPageSet object.
mustBePosted()
Indicates whether this module must be called with a POST request.
execute()
Purges the cache of a page.
getHelpUrls()
Return links to more detailed help pages about the module.
isWriteMode()
Indicates whether this module requires write mode.
static addTitleInfo(&$arr, $title, $prefix='')
Add information (title and namespace) about a Title object to a result array.
static setIndexedTagName(array &$arr, $tag)
Set the tag name for numeric-keyed values in XML format.
namespace being checked & $result