User:Austin J. Che/Extensions/dumpRewrite
This is a script like the other mediawiki maintenance scripts. It was written to allow the importing of another mediawiki into OpenWetWare. Although it has currently only been tested on one wiki, it should be general enough to extract any portion of one wiki, rewrite it using regular expression rules, and import those pages into another wiki. For example, it can be used to dump an entire wiki, prefix all page titles with Foo/Bar and also rewrite all links such that they point to the correct page name. The rewriting code currently relies on the subpage feature of MediaWiki to work correctly.
This is only a skeleton of what you have to do because if you want to use this, you have to really understand what you're doing anyway. Please contact me if you are interested in importing into OpenWetWare another wiki that you have file access to (you have to have shell access to the actual wiki files).
The steps to merge a source wiki (e.g. your wiki) into a destination wiki (e.g. OWW):
- Upgrade if necessary the source wiki to at least mediawiki 1.5 and preferably the same version as running on the destination wiki
- Images aren't currently handled too elegantly. I simply merge the images directory giving preference for existing images by running yes n | cp -r src-wiki/images/* dest-wiki/images
- After the above copy, the permissions should be set correctly to match those of other files so the web server can access them correctly
- Run php rebuildImages.php --missing in the maintainence directory of the destination wiki. This lets mediawiki know about the new images.
- In the source wiki, run php dumpRewrite.php dump.conf > file.xml to dump the source wiki using the rules in dump.conf. See the example file for the format of this file or read dumpRewrite.php
- In the destination wiki (don't do this in the source wiki), run php importDump < file.xml to import the source wiki
You should always test this process on a non-live wiki. I have not found an easy way to revert the import so test it on a copy of the wiki.
- The images could be handled better. There could be name conflicts leading to incorrect pictures showing. Rewriting image names isn't the easiest thing as their location would change.