Manual:Maintenance scripts/Running the scripts/he
לאחר מכן יש להפעיל את הסקריפטים לתחזוקה משורת הפקודה. משתמשים שאינם ניגשים לשרת ישירות מהטרמינל שלו בדרך כלל יקימו חיבור דרך SSH.
- עבור משתמשי לינוקס/יוניקס זה נעשה באמצעות לקוח SSH בתוך מעטפת.
- עבור משתמשי ווינדוס, ניתן להשתמש בכלי שורת הפקודה SSH שהוצג בווינדוס 10 או לחלופין להשתמש בכלי של צד שלישי כגון PuTTY המוצג להלן או להשתמש ב-Windows Subsystem עבור לינוקס.
כניסה לשרת
משתמש Linux/MacOS
רוב מערכות ה-Linux וה-MacOS מגיעות עם לקוח SSH מובנה. אז אתה לא צריך שום לקוח SSH. ניתן לבדוק את לקוח ה-SSH במערכת שלך על ידי הפעלת הפקודה הבאה בטרמינל.
$ ssh -V OpenSSH_8.6p1, LibreSSL 2.8.3
אם פקודה זו נותנת שגיאה, עליך להתקין לקוח SSH במערכת שלך.
Debian/Ubuntu - sudo apt install openssh-client
MacOS - brew install openssh
לאחר שתשיגו את לקוח ה-SSH במערכת שלכם, תוכלו להריץ את הפקודה הבאה כדי להיכנס לשרת.
{{#parsoid\0fragment:0}}
פורט ברירת המחדל לחיבור SSH הוא 22
והמשתמש הוא root
.
אבל ספק אירוח משותף נותן את המשתמש המותאם אישית ואת מספר פורט ה-SSH.
החלף את הערכים האלה בערכים שלך.
כעת, תוכל להריץ את סקריפט התחזוקה של מדיה-ויקי בשרת.
משתמש Windows
עבור משתמשי Windows, ישנן שתי דרכים להיכנס לשרת.
לקוח SSH מקורי
ניתן להתקין/להפעיל לקוח SSH באמצעות הגדרות Windows במכשירי Windows Server 2019 ו-Windows 10. הם תומכים ב-SSH באופן טבעי. See Official doc.
To install the OpenSSH component:
- Open
Settings
, 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, select
Add a feature
, then:- Find
OpenSSH
Client, then clickInstall
.
- Find
It will install the SSH client in your system. Now, you can SSH to server using PowerShell.
$ ssh -p 22 root@examplewiki.com
The default port for SSH connection is 22
and user is root
.
But shared hosting provider gives the custom user and SSH port number.
Replace these values with yours.
Now, you can run the MediaWiki maintenance script on server.
Putty (or other 3rd party SSH client)
You can use PuTTY or other 3rd party SSH client on Windows machine:
- Step 1: Download and run PuTTY, a terminal emulator.
- Step 2: In PuTTy, under the Host Name (or IP address) enter the IP Address of your web hosting site (Contact your website provider if necessary) and click Open.
- Step 3: A command screen will pop up. At the login as: line enter the FTP user name.
- Step 4: Enter the FTP password.
Now, you can run the MediaWiki maintenance script on server.
Running the script
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
root@-s-1vcpu:~# cd /var/www/html/
Step 2: Run the script
root@-s-1vcpu:/var/www/html# php maintenance/run.php showSiteStats Total edits : 11 Number of articles: 3 Total pages : 6 Number of users : 2 Active users : 0 Number of images : 0
maintenance/run.php
. Invoking maintenance scripts directly will trigger a warning.Troubleshooting
Error on Windows server
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
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.
The "ExtensionName" extension must be installed for this script to run.
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 using sudo
.
Standard command-line options
Almost every PHP script in /maintenance
supports several standard options:
Option | Description |
---|---|
--help | Displays 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 |
--globals | 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. (introduced in 1.17) |
--quiet | Suppress non-error output |
--wiki | 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 | Profiler output format (usually "text"). (introduced in 1.22) |
--mwdebug | Enable built-in MediaWiki development settings. (introduced in 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/run.php importImages --conf /var/www/html/LocalSettings.php /tmp/wikiimages .jpg .png .svg
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 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.
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.
Category:MediaWiki administration/he#Maintenance%20scripts/Running%20the%20scripts/he Category:Maintenance scripts/he