* @ingroup Maintenance
*/
+use MediaWiki\MediaWikiServices;
+use MediaWiki\Shell\Shell;
+
require_once __DIR__ . '/Maintenance.php';
/**
__METHOD__
);
if ( !$res ) {
- $this->error( "No such file: $file", true );
-
- return false;
+ $this->fatalError( "No such file: $file" );
}
$this->output( "Populating img_sha1 field for specified files\n" );
} else {
// in the pipe buffer. This can improve performance by up to a
// factor of 2.
global $wgDBuser, $wgDBserver, $wgDBpassword, $wgDBname;
- $cmd = 'mysql -u' . wfEscapeShellArg( $wgDBuser ) .
- ' -h' . wfEscapeShellArg( $wgDBserver ) .
- ' -p' . wfEscapeShellArg( $wgDBpassword, $wgDBname );
+ $cmd = 'mysql -u' . Shell::escape( $wgDBuser ) .
+ ' -h' . Shell::escape( $wgDBserver ) .
+ ' -p' . Shell::escape( $wgDBpassword, $wgDBname );
$this->output( "Using pipe method\n" );
$pipe = popen( $cmd, 'w' );
}
wfWaitForSlaves();
}
- $file = wfLocalFile( $row->img_name );
+ $file = MediaWikiServices::getInstance()->getRepoGroup()->getLocalRepo()
+ ->newFile( $row->img_name );
if ( !$file ) {
continue;
}
}
}
-$maintClass = "PopulateImageSha1";
+$maintClass = PopulateImageSha1::class;
require_once RUN_MAINTENANCE_IF_MAIN;