X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FpatchSql.php;h=bc21140945847307719da80a3aaefd5776b11e6a;hb=87a0b17127195742e6c64472dbfdac65b4d254d7;hp=5d9fc1b41a5779347e112243d5f8f7954147158c;hpb=13e33c28983461d5b8bdc1dece0cd0a35347a261;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/patchSql.php b/maintenance/patchSql.php index 5d9fc1b41a..bc21140945 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" );