Nothing Special   »   [go: up one dir, main page]

Jump to content

Extension:Maintenance

From mediawiki.org
MediaWiki extensions manual
Maintenance
Release status: unmaintained
Implementation Special page
Description Provides a web interface for various maintenance scripts
Author(s) Ryan Schmidt (Skizzerztalk)
Latest version 2.3.1 (2017-01-26)
MediaWiki 1.25+
PHP 5.3+
License GNU General Public License 2.0 or later
Download
Changelog
  • $wgMaintenanceDebug
maintenance
Quarterly downloads 21 (Ranked 114th)
Public wikis using 1,327 (Ranked 222nd)
Translate the Maintenance extension if it is available at translatewiki.net
Issues Open tasks · (by Skizzerz) Report a bug

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 user right to access the special page.

Installation

[edit]
  • Download and move the extracted Maintenance folder to your extensions/ directory.
    Developers and code contributors should install the extension from Git instead, using:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/Maintenance
  • Add the following code at the bottom of your LocalSettings.php file:
    wfLoadExtension( 'Maintenance' );
    
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Configuration

[edit]

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

To add the maintenance right to all sysops, so they can access the special page, you can use:

$wgGroupPermissions['sysop']['maintenance'] = true;

You probably want to add a new group, add that right to the new group, and add members to this group separately, in case not all sysops are trusted to run those scripts.

List of supported maintenance scripts

[edit]
Some of these scripts appear to time out the browser since they 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:

Extending the list of scripts

[edit]

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 a default script (in the maintenance/ directory).

[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]
Version 2.3.1 (26 January 2017)
Remove deprecated PHP entry point, extension now requires MediaWiki 1.25
Version 2.3.0 (22 November 2014)
Convert to use extension registration
Verion 2.2.0 (1 April 2014)
Migrated to MW 1.23+ I18n handling
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.

See also

[edit]