62 $block = $authority->getBlock();
63 if ( $block && $block->isSitewide() ) {
72 $forceLinkUpdate = $params[
'forcelinkupdate'];
73 $forceRecursiveLinkUpdate = $params[
'forcerecursivelinkupdate'];
74 $pageSet = $this->getPageSet();
77 $result = $pageSet->getInvalidTitlesAndRevisions();
78 $userName = $authority->getUser()->getName();
80 foreach ( $pageSet->getGoodPages() as $pageIdentity ) {
81 $title = $this->titleFormatter->getPrefixedText( $pageIdentity );
83 'ns' => $pageIdentity->getNamespace(),
86 $page = $this->wikiPageFactory->newFromTitle( $pageIdentity );
88 $authStatus = PermissionStatus::newEmpty();
89 if ( $authority->authorizeWrite(
'purge', $pageIdentity, $authStatus ) ) {
94 if ( $authStatus->isRateLimitExceeded() ) {
97 $this->
addWarning( Status::wrap( $authStatus )->getMessage() );
101 if ( $forceLinkUpdate || $forceRecursiveLinkUpdate ) {
102 if ( $authority->authorizeWrite(
'linkpurge', $pageIdentity, $authStatus ) ) {
103 # Logging to better see expensive usage patterns
104 if ( $forceRecursiveLinkUpdate ) {
105 LoggerFactory::getInstance(
'RecursiveLinkPurge' )->info(
106 "Recursive link purge enqueued for {title}",
114 $page->updateParserCache( [
115 'causeAction' =>
'api-purge',
116 'causeAgent' => $userName,
118 $page->doSecondaryDataUpdates( [
119 'recursive' => $forceRecursiveLinkUpdate,
120 'causeAction' =>
'api-purge',
121 'causeAgent' => $userName,
122 'defer' => DeferredUpdates::PRESEND,
124 $r[
'linkupdate'] =
true;
126 if ( $authStatus->isRateLimitExceeded() ) {
129 $this->
addWarning( Status::wrap( $authStatus )->getMessage() );
131 $forceLinkUpdate =
false;
138 ApiResult::setIndexedTagName( $result,
'page' );
139 $apiResult->addValue(
null, $this->
getModuleName(), $result );
141 $values = $pageSet->getNormalizedTitlesAsResult( $apiResult );
143 $apiResult->addValue(
null,
'normalized', $values );
145 $values = $pageSet->getConvertedTitlesAsResult( $apiResult );
147 $apiResult->addValue(
null,
'converted', $values );
149 $values = $pageSet->getRedirectTitlesAsResult( $apiResult );
151 $apiResult->addValue(
null,
'redirects', $values );
155 $continuationManager->setContinuationIntoResult( $apiResult );