46 $forceLinkUpdate =
$params[
'forcelinkupdate'];
47 $forceRecursiveLinkUpdate =
$params[
'forcerecursivelinkupdate'];
51 $result = $pageSet->getInvalidTitlesAndRevisions();
54 foreach ( $pageSet->getGoodTitles() as $title ) {
58 if ( !$user->pingLimiter(
'purge' ) ) {
66 if ( $forceLinkUpdate || $forceRecursiveLinkUpdate ) {
67 if ( !$user->pingLimiter(
'linkpurge' ) ) {
68 $popts = $page->makeParserOptions(
'canonical' );
70 # Parse content; note that HTML generation is only needed if we want to cache the result.
73 $enableParserCache = $this->
getConfig()->get(
'EnableParserCache' );
74 $p_result = $content->getParserOutput(
81 # Logging to better see expensive usage patterns
82 if ( $forceRecursiveLinkUpdate ) {
83 LoggerFactory::getInstance(
'RecursiveLinkPurge' )->info(
84 "Recursive link purge enqueued for {title}",
86 'user' => $this->
getUser()->getName(),
87 'title' => $title->getPrefixedText()
92 # Update the links tables
93 $updates = $content->getSecondaryDataUpdates(
94 $title,
null, $forceRecursiveLinkUpdate, $p_result );
95 foreach ( $updates as $update ) {
96 DeferredUpdates::addUpdate( $update, DeferredUpdates::PRESEND );
99 $r[
'linkupdate'] =
true;
101 if ( $enableParserCache ) {
102 $pcache = MediaWikiServices::getInstance()->getParserCache();
103 $pcache->save( $p_result, $page, $popts );
108 $forceLinkUpdate =
false;
116 $apiResult->addValue(
null, $this->
getModuleName(), $result );
118 $values = $pageSet->getNormalizedTitlesAsResult( $apiResult );
120 $apiResult->addValue(
null,
'normalized', $values );
122 $values = $pageSet->getConvertedTitlesAsResult( $apiResult );
124 $apiResult->addValue(
null,
'converted', $values );
126 $values = $pageSet->getRedirectTitlesAsResult( $apiResult );
128 $apiResult->addValue(
null,
'redirects', $values );
132 $continuationManager->setContinuationIntoResult( $apiResult );
140 if ( !isset( $this->mPageSet ) ) {
157 'forcelinkupdate' =>
false,
158 'forcerecursivelinkupdate' =>
false,
172 'action=purge&titles=Main_Page|API'
173 =>
'apihelp-purge-example-simple',
174 'action=purge&generator=allpages&gapnamespace=0&gaplimit=10'
175 =>
'apihelp-purge-example-generator',
180 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( $manager)
Set the continuation manager.
extractRequestParams( $parseLimit=true)
Using getAllowedParams(), this function makes an array of the values provided by the user,...
getResult()
Get the result object.
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.
getUser()
Get the User object.
getConfig()
Get the Config object.
static factory(Title $title)
Create a WikiPage object of the appropriate class for the given title.
namespace being checked & $result
it s the revision text itself In either if gzip is the revision text is gzipped $flags