MediaWiki  REL1_19
refreshImageCount.php
Go to the documentation of this file.
00001 <?php
00024 require_once( dirname( __FILE__ ) . '/Maintenance.php' );
00025 
00026 class RefreshImageCount extends Maintenance {
00027         public function __construct() {
00028                 parent::__construct();
00029                 $this->mDescription = "Resets ss_image count, forcing slaves to pick it up.";
00030         }
00031 
00032         public function execute() {
00033                 $dbw = wfGetDB( DB_MASTER );
00034 
00035                 // Load the current value from the master
00036                 $count = $dbw->selectField( 'site_stats', 'ss_images' );
00037 
00038                 $this->output( wfWikiID() . ": forcing ss_images to $count\n" );
00039 
00040                 // First set to NULL so that it changes on the master
00041                 $dbw->update( 'site_stats',
00042                         array( 'ss_images' => null ),
00043                         array( 'ss_row_id' => 1 ) );
00044 
00045                 // Now this update will be forced to go out
00046                 $dbw->update( 'site_stats',
00047                         array( 'ss_images' => $count ),
00048                         array( 'ss_row_id' => 1 ) );
00049                         }
00050 }
00051 
00052 $maintClass = "RefreshImageCount";
00053 require_once( RUN_MAINTENANCE_IF_MAIN );
00054