29require_once __DIR__ .
'/Maintenance.php';
39 parent::__construct();
40 $this->
addDescription(
'Run an SQL file into the DB, replacing prefix and charset vars' );
43 'Name of the patch file, either full path or in sql/$dbtype/'
48 return Maintenance::DB_ADMIN;
53 $updater = DatabaseUpdater::newForDB( $dbw,
true, $this );
55 foreach ( $this->
getArgs() as $name ) {
58 $updater->patchPath( $dbw, $name ),
59 $updater->patchPath( $dbw,
"patch-$name.sql" ),
61 foreach ( $files as $file ) {
62 if ( file_exists( $file ) ) {
63 $this->
output(
"$file ...\n" );
64 $dbw->sourceFile( $file );
68 $this->
error(
"Could not find $name\n" );
70 $this->
output(
"done.\n" );
76require_once RUN_MAINTENANCE_IF_MAIN;
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
addArg( $arg, $description, $required=true, $multi=false)
Add some args that are needed.
output( $out, $channel=null)
Throw some output to the user.
getArgs( $offset=0)
Get arguments.
getDB( $db, $groups=[], $dbDomain=false)
Returns a database to be used by current maintenance script.
error( $err, $die=0)
Throw an error to the user.
addDescription( $text)
Set the description text.
Maintenance script that manually runs an SQL patch outside of the general updaters.
getDbType()
Does the script need different DB access? By default, we give Maintenance scripts normal rights to th...
__construct()
Default constructor.
execute()
Do the actual work.