e0f22b839d384cba0a9701ea18ef6086be9571d8
[lhc/web/wiklou.git] / maintenance / refreshImageCount.php
1 <?php
2 /**
3 * Quickie hack; patch-ss_images.sql uses variables which don't
4 * replicate properly.
5 *
6 * @file
7 * @ingroup Maintenance
8 */
9
10 require_once( "Maintenance.php" );
11
12 class RefreshImageCount extends Maintenance {
13 public function __construct() {
14 parent::__construct();
15 $this->mDescription = "Resets ss_image count, forcing slaves to pick it up.";
16 }
17
18 public function execute() {
19 $dbw = wfGetDB( DB_MASTER );
20
21 // Load the current value from the master
22 $count = $dbw->selectField( 'site_stats', 'ss_images' );
23
24 $this->output( wfWikiID() . ": forcing ss_images to $count\n" );
25
26 // First set to NULL so that it changes on the master
27 $dbw->update( 'site_stats',
28 array( 'ss_images' => null ),
29 array( 'ss_row_id' => 1 ) );
30
31 // Now this update will be forced to go out
32 $dbw->update( 'site_stats',
33 array( 'ss_images' => $count ),
34 array( 'ss_row_id' => 1 ) );
35 }
36 }
37
38 $maintClass = "RefreshImageCount";
39 require_once( DO_MAINTENANCE );
40