Extension:Maintenance

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual
Crystal Clear action run.png
Maintenance

Release status: stable

Implementation Special page
Description Web interface for various maintenance scripts
Author(s) Ryan Schmidt (Skizzerztalk)
Latest version 2.1.1 (current)

1.0.3 (legacy)

MediaWiki 1.16+ use 2.x version

1.13-1.15 use 1.x version

License GPL
Download
Changelog
Added rights

maintenance

Translate the Maintenance extension if it is available at translatewiki.net

Check usage and version matrix; code metrics

The Maintenance extension adds a special page for running various maintenance scripts (see below for the list of currently supported scripts). The user needs the 'maintenance' right to access the special page.

Installation[edit | edit source]

  • Download the correct package for your version of MediaWiki from the Extension Distributor according to the chart below:
MediaWiki Version Get this version from the distributor Maintenance extension version
1.12 and earlier Maintenance will not work on your version of MediaWiki
1.13 to 1.15 1.15.x 1.0.3
1.16 and later Development version (trunk) 2.1.1
  • Upload and unpack the extension to your wiki's extension directory
  • Add the following near the end of your wiki's LocalSettings.php:
//by default all bureaucrats can access this extension.
//change 'bureaucrat' to a different group for allowing a different group instead
$wgGroupPermissions['bureaucrat']['maintenance'] = true;
require_once("$IP/extensions/Maintenance/Maintenance.php");

Configuration[edit | edit source]

The following are all of the configuration variables that Maintenance supports. To configure these, add them after the require_once call in LocalSettings.php

$wgMaintenanceDebug
Whether or not to show the "Output globals at the end of processing for debugging" checkbox (default false)
enabling this can reveal system information such as environment variables

List of supported maintenance scripts[edit | edit source]

2.x branch (current)[edit | edit source]

Some of these scripts appear to time out the browser since there are not meant to be run from a web setting. A future update will address this issue by running these scripts in the background so they are not subjected to time limits.

This extension supports currently the following scripts as of version 2.1.0. Please note that not all of the features of the following scripts may be implemented in the extension:

1.x branch (legacy)[edit | edit source]

The 1.x branch is no longer being updated for features. Critical security vulnerabilities, if any, will be fixed as they are discovered. It is recommended that you update MediaWiki to version 1.23.2 and use the 2.x branch of the Maintenance extension instead of relying on this legacy branch.

This extension supports currently the following scripts as of version 1.0.3. Please note that not all of the features of the following scripts may be implemented in the extension:

Extending the list of scripts[edit | edit source]

As of version 2.0.0, it is possible to extend the list of scripts with a little work. The metadata.ini file bundled with the Maintenance extension contains a list of every supported script. This file holds relational data in order to translate the output of English-only scripts, as well as data stating what sort of options the script has.

Below is an example of a custom script that can be inserted into the file. The script is named scriptName.php, and is either a default script (in the maintenance/ directory), or a script added to the $wgMaintenanceScripts array.

[scriptName]
enabled = 1 (or 0)
;Optional, tells whether this script will appear in the Special:Maintenance page.
;If set to 1, the script is enabled, 0 is disabled. Regardless of this setting, the script will not appear
;on the Special:Maintenance page if the script's file does not exist.
 
option[] = "option_name check [default]"
;Defines a checkbox.
;It will use the message MediaWiki:Maintenance-scriptName-option-option_name as the label.
;If default is set, the box will be checked by default.
 
option[] = "option_name input [size [attributes]]"
;Defines an input element.
;Size is an integer of the size of the input field. Attributes are other attributes to the field
;e.g. option[] = "username input 45 float=right class=someclass"
;While you could use type=password as one of the attributes, it is recommended that you just use
;the password option detailed below
 
option[] = "option_name password [size [attributes]]"
;Defines a password input element. See above for usage.
 
option[] = "option_name textarea [tmpfile]"
;Defines a text area for multiline input.
;The optional tmpfile specifies that the data in the textarea gets saved into a temporary file
;before running the script (in case the script requires a filename to be passed).
 
arg[] = "arg_name <type> [options]"
;Works exactly the same as option above, except these are passed to the script as unnamed arguments
;instead of named options (so for "php myScript.php --opt1=value --opt2 arg1 arg2", opt1 and opt2 are
;options, and arg1 and arg2 are arguments.
;<type> is one of check, input, password, or textarea, with usage being the same as with option[] above.
;arg_name is only important for determining the MediaWiki message to use as the label.
 
output[] = "message_name <type> <match>"
;Matches output from the script so that the output can be translated or edited on-wiki.
;The message shown to the user is MediaWiki:Maintenance-scriptName-output-message_name
;Type is one of string or regex.
;If type is "string", then match will need to be the exact match of the script's output to be used
;If type is "regex", then match is the regular expression fragment to be matched. The regex fragment is automatically
;surrounded by ^ and $, so you'll need to insert .* at the beginning and end if you only care about matching part of
;the message. Capturing groups in the regex are available in the output message as $1, $2, etc.
 
error[] = "message_name <type> <match>"
;Matches an error from the script so that the message can be translated or edited on-wiki.
;The message shown to the user is MediaWiki:Maintenance-scriptName-error-message_name
;Type is one of string or regex, working exactly as it does above with output[].
 
batch = <size>
;If the script runs in batches, this specifies the size of the batch to run.

Changelog[edit | edit source]

Version 2.1.1 (12 April 2012)
If metadata.ini doesn't get parsed correctly (due to syntax errors, etc.), an error page is now displayed stating the fact.
Version 2.1.0 (21 March 2012)
Added $wgMaintenanceDebug global, fixed missing script parsing (no longer fails upon encountering a missing script), added cleanupSpam, clear_interwiki_cache, and createAndPromote scripts.
Version 2.0.0 (5 March 2011)
Updated Maintenance extension to work with MediaWiki 1.16. This change breaks compatibility with MediaWiki 1.15 and below. Now supports adding scripts via an ini file so that expansion upon the script list is somewhat easier.
Version 1.0.3 (28 December 2008)
Added reassignEdits script.
Version 1.0.2 (22 December 2008)
Added eval and sql scripts.
Version 1.0.1 (22 November 2008)
Fixed moveBatch script. Page deletions done by deleteBatch or deleteRevision scripts are now logged to the user called 'Delete page script'.
Version 1.0 (28 April 2008)
Initial release, supports 10 maintenance scripts.