Movatterモバイル変換


[0]ホーム

URL:


Jump to content
MediaWiki
Search

Manual:Maintenance scripts/Running the scripts

From mediawiki.org
<Manual:Maintenance scripts
Translate this page
Languages:
Maintenance scripts

v·d·e

The maintenance scripts must then be run from the command line.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.

Get into server

[edit]

Linux/MacOS user

[edit]

Most the Linux system and MacOS comes SSH client built-in.So you don't need to any SSH client.You can check SSH client in your system by running following command in your terminal.

Terminal
$ ssh -VOpenSSH_8.6p1, LibreSSL 2.8.3

If this command gives error then you need to install SSH client in your system.

Debian/Ubuntu -sudo apt install openssh-client

MacOS -brew install openssh

Once you get the SSH client in your system then you can run following command to get into server.

Terminal
$ ssh -p 22 root@examplewiki.comWelcome to Ubuntu 18.04.5 LTS (GNU/Linux 4.15.0-161-generic x86_64) * Documentation:  https://help.ubuntu.com * Management:     https://landscape.canonical.com * Support:        https://ubuntu.com/advantage  System information as of Tue Feb 15 10:32:00 UTC 2022  System load:  0.0                Processes:           106  Usage of /:   29.8% of 24.06GB   Users logged in:     0  Memory usage: 51%                IP address for eth0: XXX.XXX.XXX.XXX  Swap usage:   0%                 IP address for eth1: 10.116.0.2Last login: Tue Feb 15 10:27:28 2022 from XX.XXX.XX.XXXroot@-s-1vcpu:~#

The default port for SSH connection is22 and user isroot.But shared hosting provider gives the custom user and SSH port number.Replace these values with yours.

Now, you canrun the MediaWiki maintenance script on server.

Windows user

[edit]

For Windows user, there are two ways to get into server.

Native SSH client

[edit]

You can install/enable SSH client using Windows Settings on Windows Server 2019 and Windows 10 devices.They support the SSH natively.SeeOfficial doc.

To install the OpenSSH component:

  • OpenSettings, selectApps >Apps & Features, then selectOptional Features.
  • Scan the list to see if the OpenSSH is already installed. If not, at the top of the page, selectAdd a feature, then:
    • FindOpenSSH Client, then clickInstall.

It will install the SSH client in your system.Now, you can SSH to server using PowerShell.

PowerShell
$ ssh -p 22 root@examplewiki.com

The default port for SSH connection is22 and user isroot.But shared hosting provider gives the custom user and SSH port number.Replace these values with yours.

Now, you canrun the MediaWiki maintenance script on server.

Putty (or other 3rd party SSH client)

[edit]

You can use PuTTY or other 3rd party SSH client on Windows machine:

  • Step 1: Download and runPuTTY, aterminal emulator.
  • Step 2: In PuTTy, under theHost Name (or IP address) enter theIP Address of your web hosting site (Contact your website provider if necessary) and clickOpen.
  • Step 3: A command screen will pop up. At thelogin as: line enter theFTP user name.
  • Step 4: Enter the FTP password.

Now, you canrun the MediaWiki maintenance script on server.

Running the script

[edit]

Once you get into to the server (See "Get into server" above) then you can follow these steps.

Step 1: Goto the MediaWiki root directory. In most cases, it would be/var/www/html

Terminal
root@-s-1vcpu:~# cd /var/www/html/

Step 2: Run the script

Terminal
root@-s-1vcpu:/var/www/html# php maintenance/run.php showSiteStatsTotal edits       : 11Number of articles:  3Total pages       :  6Number of users   :  2Active users      :  0Number of images  :  0
Since MediaWiki 1.40, a maintenance script should be invoked directly throughmaintenance/run.php. Invoking maintenance scripts directly will trigger a warning.

Troubleshooting

[edit]

Error on Windows server

[edit]

If you are using Windows server and get an error (for example:php.exe is no valid Win32 application), try the following.

$ php-cgi maintenance/run.php showSiteStats

or

$ C:\path\to\php\php-win.exe C:\path\to\mediawiki\maintenance\run.php showSiteStats

A lot of error messages

[edit]

If your script fails to run, and spews out a lot of error messages, the first thing to try is to set theMW_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.

The "ExtensionName" extension must be installed for this script to run.

[edit]

If you get this error when you run a maintenance script for an extension it may be because you don't have permission to read LocalSettings.php.Make sure you can read it, e.g. by usingsudo.

Standard command-line options

[edit]

Almost every PHP script in/maintenance supports several standard options:

OptionDescription
--helpDisplays help message
--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
--globalsOutput 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) anddefault for no change.(introduced in 1.17)
--quietSuppress non-error output
--wikiWiki ID forwiki farms. This may be of the formdbname ordbname-prefix. LocalSettings.php will be run with theMW_DB andMW_PREFIX constants defined accordingly.
--profilerProfiler output format (usually "text").(introduced in 1.22)
--mwdebugEnable built-in MediaWiki development settings.(introduced in 1.31)

MediaWiki installs that use symlinks

[edit]

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/run.php importImages --conf /var/www/html/LocalSettings.php /tmp/wikiimages .jpg .png .svg

MediaWiki installs that use shared settings (family type)

[edit]

Sometimes MediaWiki is installed as a family for many languages and settings (LocalSettings.php) are split to common part and language parts (seeWiki 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.

No shell access

[edit]

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

Retrieved from "https://www.mediawiki.org/w/index.php?title=Manual:Maintenance_scripts/Running_the_scripts&oldid=7697717"
Categories:

[8]ページ先頭

©2009-2025 Movatter.jp