MediaWiki file: importSites.php
Location: maintenance/
Source code: master 1.40.0 1.39.4 1.35.11
Classes: ImportSites

Details

importSites.php is a maintenance script that imports site definitions from an XML file into the sites table.

Arguments

Argument Description Required
fileXML file containing site definitions. Use "php://stdin" to read from stdin.Required

Usage

php maintenance/importSites.php file
mywikisites.xml
<sites version="1.0" xmlns="http://www.mediawiki.org/xml/sitelist-1.0/">
	<site type="mediawiki">
		<globalid>hewikipedia</globalid>
		<group>wikipedia</group>
		<path type="page_path">https://he.wikipedia.org/index.php/</path>
		<path type="file_path">https://he.wikipedia.org/</path>
	</site>
	<site type="mediawiki">
		<globalid>hiwikipedia</globalid>
		<group>wikipedia</group>
		<path type="page_path">https://hi.wikipedia.org/index.php/</path>
		<path type="file_path">https://hi.wikipedia.org/</path>
	</site>
	<site type="mediawiki">
		<globalid>wikisite1</globalid>
		<group>mywikigroup</group>
		<path type="page_path">https://www.wikisite1.org/index.php/</path>
		<path type="file_path">https://www.wikisite1.org/</path>
	</site>
</sites>
Terminal
$ php maintenance/importSites.php mywikisites.xml

Done.

Common error

Failed to open $file for writing.

This error occurs when the file does not exist or the user running the script does not have permission to read the file.

If the file does exist, check the file permissions. If you are a root user, you can run the script with sudo.

See also

  • Manual:addSite.php
  • Manual:ExportSites.php
  • Manual:ImportSiteScripts.php
  • Manual:Sites table
This article is issued from Mediawiki. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.