64 $block = $authority->getBlock();
65 if ( $block && $block->isSitewide() ) {
74 $forceLinkUpdate =
$params[
'forcelinkupdate'];
75 $forceRecursiveLinkUpdate =
$params[
'forcerecursivelinkupdate'];
76 $pageSet = $this->getPageSet();
79 $result = $pageSet->getInvalidTitlesAndRevisions();
80 $userName = $authority->getUser()->getName();
83 foreach ( $pageSet->getGoodPages() as $pageIdentity ) {
84 $title = $this->titleFormatter->getPrefixedText( $pageIdentity );
86 'ns' => $pageIdentity->getNamespace(),
89 $page = $this->wikiPageFactory->newFromTitle( $pageIdentity );
91 $authStatus = PermissionStatus::newEmpty();
92 if ( $authority->authorizeAction(
'purge', $authStatus ) ) {
97 if ( $authStatus->isRateLimitExceeded() ) {
100 $this->
addWarning( Status::wrap( $authStatus )->getMessage() );
104 if ( $forceLinkUpdate || $forceRecursiveLinkUpdate ) {
105 if ( $authority->authorizeAction(
'linkpurge', $authStatus ) ) {
106 # Logging to better see expensive usage patterns
107 if ( $forceRecursiveLinkUpdate ) {
108 LoggerFactory::getInstance(
'RecursiveLinkPurge' )->info(
109 "Recursive link purge enqueued for {title}",
117 $page->updateParserCache( [
118 'causeAction' =>
'api-purge',
119 'causeAgent' => $userName,
121 $page->doSecondaryDataUpdates( [
122 'recursive' => $forceRecursiveLinkUpdate,
123 'causeAction' =>
'api-purge',
124 'causeAgent' => $userName,
125 'defer' => DeferredUpdates::PRESEND,
128 $r[
'linkupdate'] =
true;
130 if ( $authStatus->isRateLimitExceeded() ) {
132 $forceLinkUpdate =
false;
133 $forceRecursiveLinkUpdate =
false;
135 $this->
addWarning( Status::wrap( $authStatus )->getMessage() );
143 ApiResult::setIndexedTagName( $result,
'page' );
144 $apiResult->addValue(
null, $this->
getModuleName(), $result );
146 $values = $pageSet->getNormalizedTitlesAsResult( $apiResult );
148 $apiResult->addValue(
null,
'normalized', $values );
150 $values = $pageSet->getConvertedTitlesAsResult( $apiResult );
152 $apiResult->addValue(
null,
'converted', $values );
154 $values = $pageSet->getRedirectTitlesAsResult( $apiResult );
156 $apiResult->addValue(
null,
'redirects', $values );
160 $continuationManager->setContinuationIntoResult( $apiResult );