Bücher online kostenlos Kostenlos Online Lesen
Working With MediaWiki

Working With MediaWiki

Titel: Working With MediaWiki
Autoren: Yaron Koren
Vom Netzwerk:
modifications to LocalSettings.php, everything should just work.
    If, however, you’re trying to move contents from one wiki to an existing one (i.e., merging the two), it’s more complicated. Thankfully, MediaWiki provides two great special pages that can be used for this purpose: Special:Export and Special:Import.
    Special:Export (see Figure 21.1) lets you generate an XML file that holds the contents from any number of pages in the wiki. The XML is in a custom format defined by MediaWiki. Special:Export unfortunately doesn’t provide an automatic way to export all pages at once. Instead, you assemble a list of pages to be exported; the page lets you add whole categories and namespaces to the list. Once you’ve assembled the full list, you can choose whether to export just the most recent revision of each page, or all of them. The latter is certainly recommended when exporting from one MediaWiki wiki to another.
    Figure 21.1 Special:Export page
    Once you have the XML file generated and downloaded, it’s time for the second step, which, as you might have guessed, is to use Special:Import in the other wiki. That page is simpler — there, you just upload an XML file, and it generates all the relevant pages. See Figure 21.2 for the Special:Import interface.
    Figure 21.2 Special:Import page
    In order to access Special:Import, you need to have the ’import’ permission, which by default is given to users in the "administrators/sysop" group.
    For large sets of pages, using Special:Import might not work; the page might time out. In that case, you could use an import script to take in the XML file. There are a variety of scripts, all of which have their strengths and weaknesses; you can see the full list here:
http://meta.wikimedia.org/wiki/Data_dumps#Tools
    There’s the issue of what to do with pages that have the same name in both the source destination wikis; if both wikis are in English, then, for instance, there’s a good chance that both will have a page called "Main Page". That’s a question that has to be decided on a case-by-case basis; there’s no mechanism for merging two wiki pages into one.
    The use of Special:Export and Special:Import takes care of wiki pages; but that still leaves the transfer of uploaded files, the wiki’s users, and the wiki’s settings.
    To import in uploaded files, there’s a very helpful script in MediaWiki called "importImages.php", in the /maintenance directory, that takes in a folder containing images, and imports them into the wiki. You can use this script to import files (images and otherwise) from both another MediaWiki installation, and from other sources (which we’ll get to in the next section). To import uploaded files from one MediaWiki instance to another, you just need to get the /images folder from the "source" wiki onto the same server as the "destination" wiki, if it’s not there already. (It may help to archive the folder first, into a zip file or the like.) The script is then called in the following way:
php maintenance/importImages.php /path/to/images/directory png jpg gif bmp PNG JPG GIF BMP
    The group of file extensions at the end is necessary because every type of file that you want imported has to be manually specified. There are various other settings you can call importImages.php with — you can see a full description here:
https://www.mediawiki.org/wiki/Manual:ImportImages.php
    Unfortunately, this script will not import old revisions of files — just the most recent ones.
    Note that this is a separate process from importing the wiki pages for those files, i.e. pages in the "File:" namespace. If you have any special content in those pages, you should import them using the standard Special:Export/Special:Import process.
    That leaves the issue of importing users — but that, unfortunately, seems to be impossible. You will simply have to ask users of the old wiki to re-register on the new one.
    It should also be noted that the Special:Export/Special:Import approach can also be used to back up a wiki’s contents, to prevent against data loss if something happens to the wiki. Archiving the database and files is the better approach, since it also includes user data and everything else, but using Special:Export is the lighter-weight solution, and one that can be used if you don’t have access to the underlying database.
    There can also be cases when you want to move content from one MediaWiki wiki into another, while keeping the “source” one
Vom Netzwerk:

Weitere Kostenlose Bücher