X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FpatchSql.php;h=3ba962f96a1a155f193ea16c4c071d4ad82a228c;hb=8dde433d09d12f7a8a3fee0062448972b4ab41af;hp=5d9fc1b41a5779347e112243d5f8f7954147158c;hpb=96764fbc9a67fa6040c6123d31ac3746fc6fd98f;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/patchSql.php b/maintenance/patchSql.php index 5d9fc1b41a..3ba962f96a 100644 --- a/maintenance/patchSql.php +++ b/maintenance/patchSql.php @@ -32,7 +32,7 @@ require_once __DIR__ . '/Maintenance.php'; class PatchSql extends Maintenance { public function __construct() { parent::__construct(); - $this->mDescription = "Run an SQL file into the DB, replacing prefix and charset vars"; + $this->addDescription( 'Run an SQL file into the DB, replacing prefix and charset vars' ); $this->addArg( 'patch-name', 'Name of the patch file, either full path or in maintenance/archives' @@ -44,13 +44,15 @@ class PatchSql extends Maintenance { } public function execute() { - $dbw = wfGetDB( DB_MASTER ); + $dbw = $this->getDB( DB_MASTER ); + $updater = DatabaseUpdater::newForDB( $dbw, true, $this ); + foreach ( $this->mArgs as $arg ) { - $files = array( + $files = [ $arg, - $dbw->patchPath( $arg ), - $dbw->patchPath( "patch-$arg.sql" ), - ); + $updater->patchPath( $dbw, $arg ), + $updater->patchPath( $dbw, "patch-$arg.sql" ), + ]; foreach ( $files as $file ) { if ( file_exists( $file ) ) { $this->output( "$file ...\n" ); @@ -64,5 +66,5 @@ class PatchSql extends Maintenance { } } -$maintClass = "PatchSql"; +$maintClass = PatchSql::class; require_once RUN_MAINTENANCE_IF_MAIN;