Manual:Hooks/MaintenanceUpdateAddParams

From MediaWiki.org
Jump to navigation Jump to search
MaintenanceUpdateAddParams
Available from version 1.33.0 (Gerrit change 498296)
allow extensions to add params to the update.php maintenance script.
Define function:
public static function onMaintenanceUpdateAddParams( array &$params ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"MaintenanceUpdateAddParams": "MyExtensionHooks::onMaintenanceUpdateAddParams"
	}
}

For MediaWiki ≤1.25:

$wgHooks['MaintenanceUpdateAddParams'][] = 'MyExtensionHooks::onMaintenanceUpdateAddParams';
Called from:File(s): ../maintenance/update.php
Function(s): validateParamsAndArgs

For more information about attaching hooks, see Manual:Hooks.
For examples of extensions using this hook, see Category:MaintenanceUpdateAddParams extensions.

Details[edit]

  • &$params: array to populate with the params to be added. Array elements are keyed by the param name. Each param is an associative array that must include the following keys:
    • 'desc': The description of the param to show on --help
    • 'require': Is the param required? Defaults to false if not set.
    • 'withArg': Is an argument required with this option? Defaults to false if not set.
    • 'shortName': Character to use as short name, or false if none. Defaults to false if not set.
    • 'multiOccurrence': Can this option be passed multiple times? Defaults to false if not set.