X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FrebuildImages.php;h=a8fb9a3bd06e00689601ae881c2080f697bda78d;hb=20fcae98034d264bdc1979d543c9ebf1f1b4506b;hp=966864e62ded4ec4ac389633eb5b703e76f3f02b;hpb=fa82f6e0567e4562b3386efaaed30f575d1b1083;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/rebuildImages.php b/maintenance/rebuildImages.php index 966864e62d..a8fb9a3bd0 100644 --- a/maintenance/rebuildImages.php +++ b/maintenance/rebuildImages.php @@ -63,7 +63,8 @@ class ImageBuilder extends Maintenance { $this->dbw = $this->getDB( DB_MASTER ); $this->dryrun = $this->hasOption( 'dry-run' ); if ( $this->dryrun ) { - $GLOBALS['wgReadOnly'] = 'Dry run mode, image upgrades are suppressed'; + MediaWiki\MediaWikiServices::getInstance()->getReadOnlyMode() + ->setReason( 'Dry run mode, image upgrades are suppressed' ); } if ( $this->hasOption( 'missing' ) ) { @@ -124,12 +125,12 @@ class ImageBuilder extends Maintenance { flush(); } - function buildTable( $table, $key, $callback ) { + function buildTable( $table, $key, $fields, $callback ) { $count = $this->dbw->selectField( $table, 'count(*)', '', __METHOD__ ); $this->init( $count, $table ); $this->output( "Processing $table...\n" ); - $result = $this->getDB( DB_REPLICA )->select( $table, '*', [], __METHOD__ ); + $result = $this->getDB( DB_REPLICA )->select( $table, $fields, [], __METHOD__ ); foreach ( $result as $row ) { $update = call_user_func( $callback, $row, null ); @@ -144,7 +145,7 @@ class ImageBuilder extends Maintenance { function buildImage() { $callback = [ $this, 'imageCallback' ]; - $this->buildTable( 'image', 'img_name', $callback ); + $this->buildTable( 'image', 'img_name', LocalFile::selectFields(), $callback ); } function imageCallback( $row, $copy ) { @@ -156,7 +157,8 @@ class ImageBuilder extends Maintenance { } function buildOldImage() { - $this->buildTable( 'oldimage', 'oi_archive_name', [ $this, 'oldimageCallback' ] ); + $this->buildTable( 'oldimage', 'oi_archive_name', OldLocalFile::selectFields(), + [ $this, 'oldimageCallback' ] ); } function oldimageCallback( $row, $copy ) {