jenkins-bot has submitted this change and it was merged.

Change subject: Don't do special page cache updates if --list or --only 
parameters passed
......................................................................


Don't do special page cache updates if --list or --only parameters passed

Change-Id: I06522ea888d2d7f5cbfd22dd70e58011d65fd2c1
---
M maintenance/updateSpecialPages.php
1 file changed, 33 insertions(+), 25 deletions(-)

Approvals:
  IAlex: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/maintenance/updateSpecialPages.php 
b/maintenance/updateSpecialPages.php
index ffb20f5..cf6c0b0 100644
--- a/maintenance/updateSpecialPages.php
+++ b/maintenance/updateSpecialPages.php
@@ -40,33 +40,12 @@
        }
 
        public function execute() {
-               global $IP, $wgSpecialPageCacheUpdates, $wgQueryPages, 
$wgQueryCacheLimit, $wgDisableQueryPageUpdate;
+               global $IP, $wgQueryPages, $wgQueryCacheLimit, 
$wgDisableQueryPageUpdate;
 
-               $dbw = wfGetDB( DB_MASTER );
-
-               foreach ( $wgSpecialPageCacheUpdates as $special => $call ) {
-                       if ( !is_callable( $call ) ) {
-                               $this->error( "Uncallable function $call!" );
-                               continue;
-                       }
-                       $this->output( sprintf( '%-30s ', $special ) );
-                       $t1 = explode( ' ', microtime() );
-                       call_user_func( $call, $dbw );
-                       $t2 = explode( ' ', microtime() );
-                       $elapsed = ( $t2[0] - $t1[0] ) + ( $t2[1] - $t1[1] );
-                       $hours = intval( $elapsed / 3600 );
-                       $minutes = intval( $elapsed % 3600 / 60 );
-                       $seconds = $elapsed - $hours * 3600 - $minutes * 60;
-                       if ( $hours ) {
-                               $this->output( $hours . 'h ' );
-                       }
-                       if ( $minutes ) {
-                               $this->output( $minutes . 'm ' );
-                       }
-                       $this->output( sprintf( "completed in %.2fs\n", 
$seconds ) );
-                       # Wait for the slave to catch up
-                       wfWaitForSlaves();
+               if ( !$this->hasOption( 'list' ) && !$this->hasOption( 'only' ) 
) {
+                       $this->doSpecialPageCacheUpdates();
                }
+               $dbw = wfGetDB( DB_MASTER );
 
                // This is needed to initialise $wgQueryPages
                require_once "$IP/includes/QueryPage.php";
@@ -145,6 +124,35 @@
                        }
                }
        }
+
+       public function doSpecialPageCacheUpdates() {
+               global $wgSpecialPageCacheUpdates;
+               $dbw = wfGetDB( DB_MASTER );
+
+               foreach ( $wgSpecialPageCacheUpdates as $special => $call ) {
+                       if ( !is_callable( $call ) ) {
+                               $this->error( "Uncallable function $call!" );
+                               continue;
+                       }
+                       $this->output( sprintf( '%-30s ', $special ) );
+                       $t1 = explode( ' ', microtime() );
+                       call_user_func( $call, $dbw );
+                       $t2 = explode( ' ', microtime() );
+                       $elapsed = ( $t2[0] - $t1[0] ) + ( $t2[1] - $t1[1] );
+                       $hours = intval( $elapsed / 3600 );
+                       $minutes = intval( $elapsed % 3600 / 60 );
+                       $seconds = $elapsed - $hours * 3600 - $minutes * 60;
+                       if ( $hours ) {
+                               $this->output( $hours . 'h ' );
+                       }
+                       if ( $minutes ) {
+                               $this->output( $minutes . 'm ' );
+                       }
+                       $this->output( sprintf( "completed in %.2fs\n", 
$seconds ) );
+                       # Wait for the slave to catch up
+                       wfWaitForSlaves();
+               }
+       }
 }
 
 $maintClass = "UpdateSpecialPages";

-- 
To view, visit https://gerrit.wikimedia.org/r/79283
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I06522ea888d2d7f5cbfd22dd70e58011d65fd2c1
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Reedy <[email protected]>
Gerrit-Reviewer: IAlex <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to