X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=maintenance%2FpopulateImageSha1.php;h=a71abb61ec7a5b6abe98ad9da7013ebd8e96cfd8;hp=2735a1ed8d82b1ebd27f22c7bade112b09dc208f;hb=d46835ef4f877b03a9d48aa392dc23ae37042756;hpb=f5baf27bb89a4306e77e7ad1183791f775888199 diff --git a/maintenance/populateImageSha1.php b/maintenance/populateImageSha1.php index 2735a1ed8d..a71abb61ec 100644 --- a/maintenance/populateImageSha1.php +++ b/maintenance/populateImageSha1.php @@ -21,6 +21,8 @@ * @ingroup Maintenance */ +use MediaWiki\Shell\Shell; + require_once __DIR__ . '/Maintenance.php'; /** @@ -76,9 +78,7 @@ class PopulateImageSha1 extends LoggedUpdateMaintenance { __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 { @@ -109,9 +109,9 @@ class PopulateImageSha1 extends LoggedUpdateMaintenance { // 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' ); } @@ -180,5 +180,5 @@ class PopulateImageSha1 extends LoggedUpdateMaintenance { } } -$maintClass = "PopulateImageSha1"; +$maintClass = PopulateImageSha1::class; require_once RUN_MAINTENANCE_IF_MAIN;