From: Tim Starling Date: Fri, 5 Jul 2013 04:49:02 +0000 (+1000) Subject: Don't queue refreshLinks jobs on null edit X-Git-Tag: 1.31.0-rc.0~19243^2 X-Git-Url: http://git.cyclocoop.org/%7D%7Cconcat%7B?a=commitdiff_plain;h=48828f5c14d2379ba7aff82d0e3b03725471d572;p=lhc%2Fweb%2Fwiklou.git Don't queue refreshLinks jobs on null edit Bug 50785: don't queue refreshLinks jobs on null edit or API action=purge forcelinkupdate=1, since these actions are commonly performed in order to clear the cache of a single page, and queueing millions of jobs is not the response the user usually expects. Change-Id: I2dbb5d21fa6b876adefd6bcfc93a83c5904d8d13 --- diff --git a/includes/WikiPage.php b/includes/WikiPage.php index 398a424cae..48eaf2b827 100644 --- a/includes/WikiPage.php +++ b/includes/WikiPage.php @@ -2071,7 +2071,9 @@ class WikiPage implements Page, IDBAccessObject { // Update the links tables and other secondary data if ( $content ) { - $updates = $content->getSecondaryDataUpdates( $this->getTitle(), null, true, $editInfo->output ); + $recursive = $options['changed']; // bug 50785 + $updates = $content->getSecondaryDataUpdates( + $this->getTitle(), null, $recursive, $editInfo->output ); DataUpdate::runUpdates( $updates ); } diff --git a/includes/api/ApiPurge.php b/includes/api/ApiPurge.php index b68dc5cfa4..e2eae613a5 100644 --- a/includes/api/ApiPurge.php +++ b/includes/api/ApiPurge.php @@ -64,6 +64,7 @@ class ApiPurge extends ApiBase { $params = $this->extractRequestParams(); $forceLinkUpdate = $params['forcelinkupdate']; + $forceRecursiveLinkUpdate = $params['forcerecursivelinkupdate']; $pageSet = $this->getPageSet(); $pageSet->execute(); @@ -82,7 +83,7 @@ class ApiPurge extends ApiBase { $page->doPurge(); // Directly purge and skip the UI part of purge(). $r['purged'] = ''; - if ( $forceLinkUpdate ) { + if ( $forceLinkUpdate || $forceRecursiveLinkUpdate ) { if ( !$this->getUser()->pingLimiter() ) { global $wgEnableParserCache; @@ -93,7 +94,8 @@ class ApiPurge extends ApiBase { $p_result = $content->getParserOutput( $title, $page->getLatest(), $popts, $wgEnableParserCache ); # Update the links tables - $updates = $content->getSecondaryDataUpdates( $title, null, true, $p_result ); + $updates = $content->getSecondaryDataUpdates( + $title, null, $forceRecursiveLinkUpdate, $p_result ); DataUpdate::runUpdates( $updates ); $r['linkupdate'] = ''; @@ -150,7 +152,10 @@ class ApiPurge extends ApiBase { } public function getAllowedParams( $flags = 0 ) { - $result = array( 'forcelinkupdate' => false ); + $result = array( + 'forcelinkupdate' => false, + 'forcerecursivelinkupdate' => false + ); if ( $flags ) { $result += $this->getPageSet()->getFinalParams( $flags ); } @@ -159,7 +164,11 @@ class ApiPurge extends ApiBase { public function getParamDescription() { return $this->getPageSet()->getFinalParamDescription() - + array( 'forcelinkupdate' => 'Update the links tables' ); + + array( + 'forcelinkupdate' => 'Update the links tables', + 'forcerecursivelinkupdate' => 'Update the links table, and update ' . + 'the links tables for any page that uses this page as a template', + ); } public function getResultProperties() {