X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FrebuildImages.php;h=713492a285963ef3565458c07e181bf74816b3b4;hb=414b703c5842ec47a7809ec039b499f0b0966bb2;hp=a8fb9a3bd06e00689601ae881c2080f697bda78d;hpb=20fcae98034d264bdc1979d543c9ebf1f1b4506b;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/rebuildImages.php b/maintenance/rebuildImages.php index a8fb9a3bd0..713492a285 100644 --- a/maintenance/rebuildImages.php +++ b/maintenance/rebuildImages.php @@ -125,12 +125,14 @@ class ImageBuilder extends Maintenance { flush(); } - function buildTable( $table, $key, $fields, $callback ) { + function buildTable( $table, $key, $queryInfo, $callback ) { $count = $this->dbw->selectField( $table, 'count(*)', '', __METHOD__ ); $this->init( $count, $table ); $this->output( "Processing $table...\n" ); - $result = $this->getDB( DB_REPLICA )->select( $table, $fields, [], __METHOD__ ); + $result = $this->getDB( DB_REPLICA )->select( + $queryInfo['tables'], $queryInfo['fields'], [], __METHOD__, [], $queryInfo['joins'] + ); foreach ( $result as $row ) { $update = call_user_func( $callback, $row, null ); @@ -145,7 +147,7 @@ class ImageBuilder extends Maintenance { function buildImage() { $callback = [ $this, 'imageCallback' ]; - $this->buildTable( 'image', 'img_name', LocalFile::selectFields(), $callback ); + $this->buildTable( 'image', 'img_name', LocalFile::getQueryInfo(), $callback ); } function imageCallback( $row, $copy ) { @@ -157,7 +159,7 @@ class ImageBuilder extends Maintenance { } function buildOldImage() { - $this->buildTable( 'oldimage', 'oi_archive_name', OldLocalFile::selectFields(), + $this->buildTable( 'oldimage', 'oi_archive_name', OldLocalFile::getQueryInfo(), [ $this, 'oldimageCallback' ] ); } @@ -231,5 +233,5 @@ class ImageBuilder extends Maintenance { } } -$maintClass = 'ImageBuilder'; +$maintClass = ImageBuilder::class; require_once RUN_MAINTENANCE_IF_MAIN;