MediaWiki REL1_39
MediaWiki\Maintenance\MaintenanceRunner Class Reference

A runner for maintenance scripts. More...

Public Member Functions

 __construct ()
 Default constructor.
 
 cleanup ()
 Handler for register_shutdown_function.
 
 defineSettings ()
 Define how settings are loaded (e.g.
 
 getName ()
 Returns the maintenance script name.
 
 init (string $scriptClass)
 Initialize the runner.
 
 overrideConfig (SettingsBuilder $settingsBuilder)
 MW_SETUP_CALLBACK handler, for overriding config.
 
 run ()
 Run the maintenance script.
 

Static Public Member Functions

static shouldExecute ()
 Should we execute the maintenance script, or just allow it to be included as a standalone class? It checks that the call stack only includes this function and "requires" (meaning was called from the file scope)
 

Protected Member Functions

 addDefaultParams ()
 Add the default parameters to the scripts.
 

Detailed Description

A runner for maintenance scripts.

Since
1.39
Stability: unstable

Definition at line 22 of file MaintenanceRunner.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Maintenance\MaintenanceRunner::__construct ( )

Default constructor.

Children should call this first if implementing their own constructors

Stability: stable
to call

Definition at line 36 of file MaintenanceRunner.php.

References MediaWiki\Maintenance\MaintenanceRunner\addDefaultParams().

Member Function Documentation

◆ addDefaultParams()

MediaWiki\Maintenance\MaintenanceRunner::addDefaultParams ( )
protected

Add the default parameters to the scripts.

Definition at line 44 of file MaintenanceRunner.php.

References Maintenance\GENERIC_MAINTENANCE_PARAMETERS.

Referenced by MediaWiki\Maintenance\MaintenanceRunner\__construct().

◆ cleanup()

MediaWiki\Maintenance\MaintenanceRunner::cleanup ( )

Handler for register_shutdown_function.

Access: internal
Returns
void

Definition at line 398 of file MaintenanceRunner.php.

◆ defineSettings()

MediaWiki\Maintenance\MaintenanceRunner::defineSettings ( )

Define how settings are loaded (e.g.

LocalSettings.php)

Access: internal
Returns
void

Definition at line 180 of file MaintenanceRunner.php.

References $IP, $wgCommandLineMode, and wfDetectLocalSettingsFile().

◆ getName()

MediaWiki\Maintenance\MaintenanceRunner::getName ( )

Returns the maintenance script name.

Safe to call after init().

Returns
string

Definition at line 136 of file MaintenanceRunner.php.

◆ init()

MediaWiki\Maintenance\MaintenanceRunner::init ( string $scriptClass)

Initialize the runner.

Parameters
string$scriptClass

Definition at line 72 of file MaintenanceRunner.php.

References $IP, and $wgCommandLineMode.

◆ overrideConfig()

MediaWiki\Maintenance\MaintenanceRunner::overrideConfig ( SettingsBuilder $settingsBuilder)

MW_SETUP_CALLBACK handler, for overriding config.

Parameters
SettingsBuilder$settingsBuilder
Returns
void

Definition at line 224 of file MaintenanceRunner.php.

References MediaWiki\MainConfigNames\CacheDirectory, Maintenance\DB_NONE, MediaWiki\Settings\SettingsBuilder\getConfig(), MediaWiki\MainConfigNames\LocalisationCacheConf, and MediaWiki\Settings\SettingsBuilder\putConfigValue().

◆ run()

MediaWiki\Maintenance\MaintenanceRunner::run ( )

Run the maintenance script.

Note
The process should exit immediately after this method returns. At that point, MediaWiki will already have been shut down. It is no longer safe to perform any write operations on the database.
Any exceptions thrown by the maintenance script will cause this method to terminate the process after reporting the error to the user, without shutdown and cleanup.
Returns
bool true on success, false on failure, passed through from Maintenance::execute().

Definition at line 292 of file MaintenanceRunner.php.

References MediaWiki\MediaWikiServices\disableStorageBackend().

◆ shouldExecute()

static MediaWiki\Maintenance\MaintenanceRunner::shouldExecute ( )
static

Should we execute the maintenance script, or just allow it to be included as a standalone class? It checks that the call stack only includes this function and "requires" (meaning was called from the file scope)

Returns
bool

Definition at line 367 of file MaintenanceRunner.php.

References $wgCommandLineMode.


The documentation for this class was generated from the following file: