X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FpatchSql.php;h=31ce156622253c1422771cd8b6673725d2676126;hb=ce6f639105d31c1bd61800f8d1e29c1811880b02;hp=18835a47d26c30095668ce5c0be120d6e136c422;hpb=a82c01a4b2e13dcbb0bfb7fef3b089d01420a1cb;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/patchSql.php b/maintenance/patchSql.php index 18835a47d2..31ce156622 100644 --- a/maintenance/patchSql.php +++ b/maintenance/patchSql.php @@ -18,34 +18,40 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * http://www.gnu.org/copyleft/gpl.html * + * @file * @ingroup Maintenance */ -require_once( dirname(__FILE__) . '/Maintenance.php' ); +require_once __DIR__ . '/Maintenance.php'; +/** + * Maintenance script that manually runs an SQL patch outside of the general updaters. + * + * @ingroup Maintenance + */ class PatchSql extends Maintenance { public function __construct() { parent::__construct(); $this->mDescription = "Run an SQL file into the DB, replacing prefix and charset vars"; - $this->addArgs( array( 'patch-name' ) ); + $this->addArg( 'patch-name', 'Name of the patch file, either full path or in maintenance/archives' ); } - protected function getDbType() { + public function getDbType() { return Maintenance::DB_ADMIN; } public function execute() { $dbw = wfGetDB( DB_MASTER ); - foreach( $this->mArgs as $arg ) { + foreach ( $this->mArgs as $arg ) { $files = array( $arg, - DatabaseBase::patchPatch( $arg ), - DatabaseBase::patchPatch( "patch-$arg.sql" ), + $dbw->patchPath( $arg ), + $dbw->patchPath( "patch-$arg.sql" ), ); - foreach( $files as $file ) { - if( file_exists( $file ) ) { + foreach ( $files as $file ) { + if ( file_exists( $file ) ) { $this->output( "$file ...\n" ); - $dbw->fileSource( $file ); + $dbw->sourceFile( $file ); continue 2; } } @@ -56,4 +62,4 @@ class PatchSql extends Maintenance { } $maintClass = "PatchSql"; -require_once( DO_MAINTENANCE ); +require_once RUN_MAINTENANCE_IF_MAIN;