|MediaWiki file: update.php|
|Source code:||master • 1.40.0 • 1.39.4 • 1.35.11|
The maintenance script update.php checks if the MediaWiki database schema needs to be updated in order to work with the current version of MediaWiki.
You should run
update.php after each upgrade of MediaWiki or after the update or install of an extension that requires a schema update.
Most extensions that require schema updates will say so in their documentation.
From the browser
If you do not have access to the command line of your server, then use the web updater to run the update script.
From the command line
From the command line, or an SSH shell or similar:
- Change to the
- Run the update script:
$ php update.php
$ mwscript update.php
This script offers several parameters (generic, script dependent and script specific) which may be required in some wiki environments.
Generic maintenance parameters
- used to get a prompt of all available script parameters (generic, script dependent and script specific) together with short explanations of their usage. These are less often used parameters.
- update wiki family if database name depends on virtual host, where wikiId - database name (e.g. enwiki, dewiki ...)
Script specific parameters
- skip countdown sequence
- (removed in 1.36) do not purge objectcache table. Normally
update.phppurges the objectcache table (generally contains the parser cache and the messages cache), msg_resource and msg_resource_links (these are used for ResourceLoader message caching and are cleared in 1.21 and later) tables in the database, if you don't want to purge this table, use the
- Update shared tables as well.
- Run this script even if it is disabled by configuration options.
- Specifies the config file (the LocalSettings.php file for the specific wiki). Used for wiki families.
- All changes to the table structure or table additions are skipped. Only data changes are made.
- No schema changes are made to the database, but the schema changes are saved to a separate SQL file that can be run.
- Skips compatibility checks
- when using composer.local.json to let Composer install extensions and their dependencies, you may see an error message saying that there is a mismatch between the installed and required version (e.g. "mediawiki/semantic-breadcrumb-links: 1.3.0 installed, ~1.3 required"). You can use this parameter to ignore the message and run update.php regardless.
Extensions can install/update their schemas using LoadExtensionSchemaUpdates hook.