1 Prior to version 1.16, maintenance scripts were a hodgepodge of code that
2 had no cohesion or formal method of action. Beginning in 1.16, maintenance
3 scripts have been cleaned up to use a unified class.
7 3. How to write your own
10 The /maintenance directory of a MediaWiki installation contains several
11 subdirectories, all of which have unique purposes.
13 2. HOW TO RUN A SCRIPT
14 Ridiculously simple, just call 'php someScript.php' that's in the top-
15 level /maintenance directory.
20 The following parameters are available to all maintenance scripts
21 --help : Print a help message
22 --quiet : Quiet non-error output
23 --dbuser : The database user to use for the script (if needed)
24 --dbpass : Same as above (if needed)
26 3. HOW TO WRITE YOUR OWN
27 Make a file in the maintenance directory called myScript.php or something.
28 In it, write the following:
34 require_once( "Maintenance.php" );
36 class DemoMaint extends Maintenance {
38 public function __construct() {
39 parent::__construct();
42 protected function execute() {
46 $maintClass = "DemoMaint";
47 require_once( DO_MAINTENANCE );
51 That's it. In the execute() method, you have access to all of the normal
52 MediaWiki functions, so you can get a DB connection, use the cache, etc.
53 For full docs on the Maintenance class, see the auto-generated docs at
54 http://svn.wikimedia.org/doc/classMaintenance.html