4 * Maintenance script to update the site_stats.ss_images field
7 * @subpackage Maintenance
8 * @author Rob Church <robchur@gmail.com>
9 * @licence GNU General Public Licence 2.0 or later
12 require_once( 'commandLine.inc' );
14 function recountImages() {
15 $dbw =& wfGetDB( DB_MASTER
);
16 $count = $dbw->selectField( 'images', 'COUNT(*)', '', 'recountImages' );
17 # Replication safe update; set to NULL first to force the change to slaves
18 $dbw->update( 'site_stats', array( 'ss_images' => NULL ), array( 'ss_row_id' => 1 ), 'recountImages' );
19 $dbw->update( 'site_stats', array( 'ss_images' => $count ), array( 'ss_row_id' => 1 ), 'recountImages' );
23 echo( "Updating image count in site statistics..." );
25 echo( "set to {$count}.\n\n" );