Manual:Importing XML dumps/de

Diese Seite beschreibt Methoden für den Import von XML-Dumps. XML-Dumps enthalten den Inhalt eines Wikis (Wikiseiten mit allen Versionen) ohne Daten mit Bezug zur Seite. Ein XML-Dump erstellt kein vollständiges Backup der Wiki-Datenbank, denn der Dump enthält keine Benutzerkonten, Bilder, Bearbeitungslogbücher, etc.

Die Seite Special:Export jeder MediaWiki-Seite, darunter jede Wikimedia-Seite und Wikipedia, erstellt eine XML-Datei (Inhaltsdump). Siehe Meta:Daten-Dumps und. XML-Dateien werden auf Meta:Hilfe:Export genauer erklärt.



Wie importiert man?
Es gibt mehrere Methoden, um diese XML-Dateien zu importieren.



Importieren großer XML-Dumps (wie der Englischen Wikipedia)


Mit Spezial:Import
Special:Import kann von Wiki-Benutzern mit dem Recht  genutzt werden (standardmäßig sind dies Benutzer in der Gruppe  ), um eine kleine Anzahl von Seiten zu importieren (etwa 100 sollten sicher sein).

Der Versuch, größere Dumps auf diese Weise zu importieren, kann zu Timeouts oder Verbindungsfehlern führen.


 * Siehe Meta:Hilfe:Import für eine detailliertere Beschreibung.
 * Aufgrund von Beschränkungen in der PHP-Konfiguration können große Dateien abgewiesen werden, siehe Meta:Hilfe:Import#Große Transfermengen

Du wirst gebeten, ein Interwiki-Präfix anzugeben. Wenn du beispielsweise aus der englischen Wikipedia exportiert hast, musst du 'en' eingeben.



Berechtigungen ändern
Siehe.

Um allen angemeldeten Autoren das importieren zu erlauben (nicht empfohlen), müsste folgende Zeile zu "LocalSettings.php" hinzugefügt werden:



Mögliche Probleme
Für die Nutzung des Transwiki-Imports muss der PHP safe_mode deaktiviert und "open_basedir" leer sein (beide sind Variablen in php.ini). Andernfalls schlägt der Import fehl.

Falls du einen Fehler wie diesen kriegst:

Warning: XMLReader::open: Unable to open source data in /.../wiki/includes/Import.php on line 53 Warning: XMLReader::read: Load Data before trying to read in /.../wiki/includes/Import.php on line 399

And Special:Import shows: "Import failed: Expected &lt;mediawiki> tag, got ", this may be a problem caused by a fatal error on a previous import, which leaves libxml in a wrong state across the entire server, or because another PHP script on the same server disabled entity loader (PHP bug). This happens on MediaWiki versions prior to MediaWiki 1.26, and the solution is to restart the webserver service (apache, etc), or write and execute a script that calls  (see ).



Mit Hilfe von importDump.php, falls du Shell-Zugriff hast

 * Recommended method for general use, but slow for very big data sets.
 * See:, including tips on how to use it for large wikis.



Mit Hilfe des Wartungsskript importTextFiles.php
If you have a lot of content converted from another source (several word processor files, content from another wiki, etc), you may have several files that you would like to import into your wiki. In MediaWiki 1.27 and later, you can use the importTextFiles.php maintenance script.

You can also use the edit.php maintenance script for this purpose.

rebuildall.php
For large XML dumps, you can run, but, it will take a  long time, because it has to parse all pages. This is not recommended for large data sets.

Using pywikibot, pagefromfile.py and Nokogiri
is a collection of tools written in python that automate work on Wikipedia or other MediaWiki sites. Once installed on your computer, you can use the specific tool 'pagefromfile.py' which lets you upload a wiki file on Wikipedia or MediaWiki sites. The xml file created by dumpBackup.php can be transformed into a wiki file suitable to be processed by 'pagefromfile.py' using a simple Ruby program similar to the following (here the program will transform all xml files which are on the current directory which is needed if your MediaWiki site is a family):

For example, here is an excerpt of a wiki file output by the command 'ruby dumpxml2wiki.rb' (two pages can then be uploaded by pagefromfile.py, a Template and a second page which is a redirect):

The program accesses each xml file, extracts the texts within markups of each page, searches the corresponding title as a parent and enclosed it with the paired   commands used by 'pagefromfile' to create or update a page. The name of the page is in an html comment and separated by three quotes on the same first start line. Please notice that the name of the page can be written in Unicode. Sometimes it is important that the page starts directly with the command, like for a #REDIRECT ; thus the comment giving the name of the page must be after the command but still on the first line.

Please remark that the xml dump files produced by dumpBackup.php are prefixed by a namespace:

In order to access the text node using Nokogiri, you need to prefix your path with 'xmlns':

Nokogiri ist ein HTML-, XML-, SAX- und Reader-Parser mit der Möglichkeit, Dokumente über XPath- oder CSS3-Selektoren der letzten Generation von XML-Parsern mit Ruby zu durchsuchen.

Example of the use of 'pagefromfile' to upload the output wiki text file:



Wie importiert man Protokolle?
Exporting and importing logs with the standard MediaWiki scripts often proves very hard; an alternative for import is the script  in the WikiDAT tool, as suggested by Felipe Ortega.

Fehlerbehebung


Interwikis
If you get the message Page "meta:Blah blah" is not imported because its name is reserved for external linking (interwiki). the problem is that some pages to be imported have a prefix that is used for linking. For example, ones with a prefix of 'Meta:' would conflict with the interwiki prefix  which by default links to https://meta.wikimedia.org.

You can do any of the following.


 * Remove the prefix from the table. This will preserve page titles, but prevent interwiki linking through that prefix.
 * Example: you will preserve page titles 'Meta:Blah blah' but will not be able to use the prefix 'meta:' to link to meta.wikimedia.org (although it will be possible through a different prefix).
 * How to do it: before importing the dump, run the query  (note: do not include the colon in the  ). Alternatively, if you have enabled editing the interwiki table, you can simply go to Special:Interwiki and click the 'Delete' link on the right side of the row belonging to that prefix.
 * Replace the unwanted prefix in the XML file with "Project:" before importing. This will preserve the functionality of the prefix as an interlink, but will replace the prefix in the page titles with the name of the wiki where they're imported into, and might be quite a pain to do on large dumps.
 * Example: replace all 'Meta:' with 'Project:' in the XML file. MediaWiki will then replace 'Project:' with the name of your wiki during importing.



Siehe auch

 * meta:Data dumps/Other tools
 * – May come in handy if you are doing massive imports
 * – Settings that may need to be changed if you are doing massive imports
 * - for importing images.
 * – Settings that may need to be changed if you are doing massive imports
 * - for importing images.