Update wfGetDB calls in Maintenance scripts to use getDB()
[lhc/web/wiklou.git] / maintenance / rebuildImages.php
index 5a14967..1b0a27d 100644 (file)
@@ -48,7 +48,7 @@ class ImageBuilder extends Maintenance {
                parent::__construct();
 
                global $wgUpdateCompatibleMetadata;
-               //make sure to update old, but compatible img_metadata fields.
+               // make sure to update old, but compatible img_metadata fields.
                $wgUpdateCompatibleMetadata = true;
 
                $this->mDescription = 'Script to update image metadata records';
@@ -58,8 +58,7 @@ class ImageBuilder extends Maintenance {
        }
 
        public function execute() {
-               $this->dbw = wfGetDB( DB_MASTER );
-               $this->maxLag = 10; # if slaves are lagged more than 10 secs, wait
+               $this->dbw = $this->getDB( DB_MASTER );
                $this->dryrun = $this->hasOption( 'dry-run' );
                if ( $this->dryrun ) {
                        $GLOBALS['wgReadOnly'] = 'Dry run mode, image upgrades are suppressed';
@@ -128,7 +127,7 @@ class ImageBuilder extends Maintenance {
                $this->init( $count, $table );
                $this->output( "Processing $table...\n" );
 
-               $result = wfGetDB( DB_SLAVE )->select( $table, '*', array(), __METHOD__ );
+               $result = $this->getDB( DB_SLAVE )->select( $table, '*', array(), __METHOD__ );
 
                foreach ( $result as $row ) {
                        $update = call_user_func( $callback, $row, null );