level /maintenance directory.
Example:
- php clear_stats.php
+ php clearCacheStats.php
The following parameters are available to all maintenance scripts
--help : Print a help message
--quiet : Quiet non-error output
--dbuser : The database user to use for the script (if needed)
--dbpass : Same as above (if needed)
+--conf : Location of LocalSettings.php, if not default
+--wiki : For specifying the wiki ID
+--batch-size : If the script supports batch operations, do this many per batch
3. HOW TO WRITE YOUR OWN
Make a file in the maintenance directory called myScript.php or something.
<?php
-require_once( "Maintenance.php" );
+require_once 'Maintenance.php';
class DemoMaint extends Maintenance {
parent::__construct();
}
- protected function execute() {
+ public function execute() {
}
}
$maintClass = "DemoMaint";
-require_once( DO_MAINTENANCE );
+require_once RUN_MAINTENANCE_IF_MAIN;
==END==
That's it. In the execute() method, you have access to all of the normal
MediaWiki functions, so you can get a DB connection, use the cache, etc.
For full docs on the Maintenance class, see the auto-generated docs at
-http://svn.wikimedia.org/doc/classMaintenance.html
\ No newline at end of file
+https://doc.wikimedia.org/mediawiki-core/master/php/html/classMaintenance.html