Manual:addSite.php
Appearance
See also: Managing the sites table
| MediaWiki file: addSite.php | |
|---|---|
| Location: | maintenance/ |
| Source code: | master • 1.44.2 • 1.43.5 • 1.39.15 |
| Classes: | AddSite |
Details
[edit]addSite.php is a maintenance script that adds a site definition to the sites database table.
Options/Arguments
[edit]| Option | Description | Required | Default value |
|---|---|---|---|
| globalid | Global id of the site to add | Required | |
| group | Which group this site should be sorted in | Required | |
| --language | Language code of the site, for example: "hi" | Optional | |
| --interwiki-id | Interwiki ID of the site | Optional | |
| --navigation-id | Navigation ID of the site | Optional | |
| --pagepath | URL to pages of this site, for example: https://example.com/wiki/$1 | Optional | |
| --filepath | URL to files of this site, for example: https://example.com/w/$1 | Optional |
Note that if you are setting up a Wikibase, all the parameters are required.
Usage
[edit]php maintenance/run.php addSite globalid group [ --language| --interwiki-id| --navigation-id| --pagepath| --filepath ]
In MediaWiki version 1.39.15 and earlier, you must invoke maintenance scripts using
php maintenance/scriptName.php instead of php maintenance/run.php scriptName.Adding site with basic config
[edit]Terminal
$ php maintenance/run.php addSite wikisite1 mywikigroup Done. Reload the web server and other long-running PHP processes to refresh the local-server cache of the sites table.
Adding site with language
[edit]Terminal
$ php maintenance/run.php addSite wikisite1 mywikigroup --language hi Done. Reload the web server and other long-running PHP processes to refresh the local-server cache of the sites table.
Adding site with filepath and pagepath
[edit]Terminal
$ php maintenance/run.php addSite wikisite1 mywikigroup --filepath "https://www.wikisite1.org/$1" --pagepath "https://www.wikisite1.org/index.php/$1" Done. Reload the web server and other long-running PHP processes to refresh the local-server cache of the sites table.
Tip: The sites table is cached in the local-server cache, so you should reload your webserver and other long-running MediaWiki PHP processes after running this script.