Don't queue refreshLinks jobs on null edit
authorTim Starling <tstarling@wikimedia.org>
Fri, 5 Jul 2013 04:49:02 +0000 (14:49 +1000)
committerTim Starling <tstarling@wikimedia.org>
Mon, 8 Jul 2013 05:04:38 +0000 (15:04 +1000)
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

includes/WikiPage.php
includes/api/ApiPurge.php

index 398a424..48eaf2b 100644 (file)
@@ -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 );
                }
 
index b68dc5c..e2eae61 100644 (file)
@@ -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() {