Manual:Scripts de mantenimiento

This page is a translated version of the page Manual:Maintenance scripts and the translation is 25% complete.
Outdated translations are marked like this.
Other languages:
Bahasa Indonesia • ‎Deutsch • ‎English • ‎Nederlands • ‎Türkçe • ‎dansk • ‎español • ‎français • ‎magyar • ‎polski • ‎português • ‎português do Brasil • ‎čeština • ‎русский • ‎українська • ‎हिन्दी • ‎中文 • ‎日本語 • ‎한국어
  • Community Noun project 2280.svg Usuarios
  • Octicons-terminal.svg Administradores de sistema
  • Source code project 1171.svg Desarrolladores
  • OOjs UI icon language-ltr.svg Traductores

The maintenance scripts are used to perform various administrative, import, maintenance, reporting and upgrade tasks. The scripts are written in PHP and live in the maintenance subdirectory of MediaWiki installs.

There are dozens of scripts with varying degrees of general utility and quality. You should carefully read the documentation on a script before using it; if a script isn't documented, take additional care running it.


The $wgDBadminuser and $wgDBadminpassword configuration variables must be set in order to run maintenance scripts that need to alter the structure of the database (like Manual:Update.php ) if the user configured in Manual: $wgDBuser doesn't have enough permissions. Alternatively, you can pass the --dbuser and --dbpass parameters to the script. The values for these variables differ based on the database engine that is being used to power your installation of MediaWiki. If not configured, it will use the user configured in Manual: $wgDBuser .


Some of the maintenance scripts require database permissions that, for security reasons, the main MediaWiki database account should not have. A separate database account with 'superuser' privileges for just the MediaWiki database should be created (if it does not already exist.) If the database that you use for MediaWiki is called wikidb, then the following SQL would create such a user who can exercise superuser privileges on localhost.:

GRANT ALL PRIVILEGES ON wikidb.* TO 'wikidbadmin'@'localhost' IDENTIFIED BY 'strong-password';

Once the account exists, the account name should be set in the $wgDBadminuser configuration variable. Like other configuration variables, $wgDBadminuser should be set in LocalSettings.php . A password for $wgDBadminuser must be set in the $wgDBadminpassword configuration variable.


PostgreSQL uses a different security model than MySQL and the same PostgreSQL server account used for day-to-day operation of the MediaWiki installation must also be used for running the maintenance scripts. This is necessary to ensure that the owner for new tables created by the maintenance scripts is set correctly. You don't need to set $wgDBadminuser or $wgDBadminpassword at all.

Ejecutar los scripts

Instructions with NameCheap
Example of IP address and FTP user name and password on the hosting site.

Los scripts de mantenimiento deben ejecutarse desde la línea de comandos. Users who do not access the server directly from its terminal will usually establish a connection through ssh. For Linux/Unix users this is by using the ssh client in a shell. For Windows users, one can use the SSH command line tool introduced in Windows 10 or alternatively use a third-party tool such as PuTTY shown below or use Windows Subsystem for Linux.

Programa necesario: PuTTY o cualquier emulador de terminal

Donde dice Nombre del equipo (o dirección IP) escribe la dirección IP de tu sitio de alojamiento web.
  • Paso 2: En PuTTy, donde dice Nombre del equipo (o dirección IP) escribe la dirección IP de tu sitio de alojamiento web (Contacta con tu proveedor de sitio web de ser necesario) y haz clic en Abrir.
At the login as: line enter the FTP user name.
  • Step 3: A command screen will pop up. At the login as: line enter the FTP user name.
On the FTP user name@IP Address's password line: type the FTP password.
  • Paso 4: Escribe la contraseña de FTP.
La línea de commandos de putty.
  • Step 5: Change the current directory to the "maintenance" folder, which is found in the specific MediaWiki folder.

You can type pwd to see what folder you are currently in.

See MediaWiki for instructions or NameCheap on how to change the current directory to the "maintenance" folder.

Remember to type: cd[space]/home/NAME OF MAIN FOLDER/NAME OF WIKI FOLDER/maintenance

$ cd maintenance
  • Paso 6: Ejecuta el script de mantenimiento que necesitas:
$ php rebuildall.php
Si recibes un error (por ejemplo: php.exe is no valid Win32 application), prueba lo siguiente:
$ php-cgi rebuildall.php
En Windows, el comando es;
$ C:\path\to\php\php-win.exe C:\path\to\mediawiki\maintenance\rebuildall.php
If your script fails to run, and spews out a lot of error messages, the first thing to try is to set the MW_INSTALL_PATH environment variable to point to the root of your MediaWiki installation. This will help scripts to find the necessary files, and is particularly relevant when running maintenance scripts provided by third-party extensions.

Opciones estándar de línea de comandos

Casi cualquier script PHP en /maintenance admite varias opciones estándares:

Muestra un mensaje de ayuda
--conf <path>
Location of LocalSettings.php, if not default (at parent directory of the script)
--dbuser <username>
Database account to use instead of the one specified in LocalSettings.php, not used for scripts that don't require a database connection or when SQLite database backend is used
--dbpass <password>
Database password to use instead of the one specified in LocalSettings.php, not used for scripts that don't require a database connection or when SQLite database backend is used
Output globals at the end of processing for debugging
--memory-limit <value>
Set memory limit for the script. Accepts ordinary numbers, standard php.ini abbreviations (1024K, 20M, 1G), max for no limit (will be used by default if omitted) and default for no change. (introducido en 1.17)
Suprime salida sin errores
--wiki <id>
Wiki ID for wiki farms. This may be of the form dbname or dbname-prefix. LocalSettings.php will be run with the MW_DB and MW_PREFIX constants defined accordingly.
Profiler output format (usually "text"). (introducido en 1.22)
Enable built-in MediaWiki development settings. (introducido en 1.31)

MediaWiki installs that use symlinks

In cases where the MediaWiki php files are symlinked to a central installation, you will need to specify to the maintenance script the path of the LocalSettings.php file. For example:

php maintenance/importImages.php --conf /var/wwwdata/ /tmp/wikiimages .jpg .png .svg

Otherwise you will get this error:

A copy of your installation's LocalSettings.php
must exist and be readable in the source directory.

MediaWiki installs that use shared settings (family type)

Sometimes MediaWiki is installed as a family for many languages and settings (LocalSettings.php) are split to common part and language parts (see Manual:Wiki family#Shared Settings ) where common part is located outside of /w directory and accessed using relative link (require_once "../ExtensionSettings.php";). In this case maintenance scripts will not work when running them in /w/maintenance directory. Run them from /w directory instead:

$ php maintenance/rebuildall.php

No shell access

On many shared hosts, you won't have shell access. The following extensions may be useful to run maintenance scripts via the web: Maintenance and MaintenanceShell .

List of maintenance scripts

Instead of this probably-outdated list,

Here is the list of files included in the maintenance subdirectory located at the root of a MediaWiki installation. You can contribute to this manual by keeping this list up to date, adding a description of these files' specific purpose and of how an administrator should use them (command line examples, etc.). Be aware that these were created and named on an ad hoc basis so have some usability issues.









Véase también