require_once __DIR__ . '/Maintenance.php';
+use MediaWiki\MediaWikiServices;
use Wikimedia\Rdbms\IMaintainableDatabase;
/**
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 );
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 ) {
}
function buildOldImage() {
- $this->buildTable( 'oldimage', 'oi_archive_name', OldLocalFile::selectFields(),
+ $this->buildTable( 'oldimage', 'oi_archive_name', OldLocalFile::getQueryInfo(),
[ $this, 'oldimageCallback' ] );
}
}
function addMissingImage( $filename, $fullpath ) {
- global $wgContLang;
-
$timestamp = $this->dbw->timestamp( $this->getRepo()->getFileTimestamp( $fullpath ) );
- $altname = $wgContLang->checkTitleEncoding( $filename );
+ $altname = MediaWikiServices::getInstance()->getContentLanguage()->
+ checkTitleEncoding( $filename );
if ( $altname != $filename ) {
if ( $this->dryrun ) {
$filename = $altname;
}
}
-$maintClass = 'ImageBuilder';
+$maintClass = ImageBuilder::class;
require_once RUN_MAINTENANCE_IF_MAIN;