docs/README: Updated links, got rid of 2008 date at top of file docs/maintenance.txt: Updated link extensions/README: Some cleanup, added link to new git.wikimedia.org includes/DefaultSettings.php: SVN -> Git for udpprofile includes/profiler/ProfilerSimpleUDP.php: ditto languages/MessagesRo.php: removed link to mime.types on SVN from the mimesearch-summary message. This file seems to have been deleted from the modern-day Git repository maintenance/postgres/mediawiki_mysql2postgres.pl: removed SVN magic words That takes care of most of the remaining references to SVN etc. Bug: 38714 Change-Id: I261921df4b4c0545658d6d38c5f3c1f9dfa63ad1
57 lines
1.6 KiB
Text
57 lines
1.6 KiB
Text
Prior to version 1.16, maintenance scripts were a hodgepodge of code that
|
|
had no cohesion or formal method of action. Beginning in 1.16, maintenance
|
|
scripts have been cleaned up to use a unified class.
|
|
|
|
1. Directory structure
|
|
2. How to run a script
|
|
3. How to write your own
|
|
|
|
1. DIRECTORY STRUCTURE
|
|
The /maintenance directory of a MediaWiki installation contains several
|
|
subdirectories, all of which have unique purposes.
|
|
|
|
2. HOW TO RUN A SCRIPT
|
|
Ridiculously simple, just call 'php someScript.php' that's in the top-
|
|
level /maintenance directory.
|
|
|
|
Example:
|
|
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.
|
|
In it, write the following:
|
|
|
|
==BEGIN==
|
|
|
|
<?php
|
|
|
|
require_once 'Maintenance.php';
|
|
|
|
class DemoMaint extends Maintenance {
|
|
|
|
public function __construct() {
|
|
parent::__construct();
|
|
}
|
|
|
|
public function execute() {
|
|
}
|
|
}
|
|
|
|
$maintClass = "DemoMaint";
|
|
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
|
|
https://doc.wikimedia.org/mediawiki-core/master/php/html/classMaintenance.html
|