Created
December 13, 2013 17:36
-
-
Save garrett/7948035 to your computer and use it in GitHub Desktop.
Stupidly simple shell script to export MediaWiki pages (with metadata), as XML
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This uses the mediawiki_cli gem; be sure to have it installed | |
## Usage | |
# | |
# Please pass the URL to your site's wiki prefix to this command, like so: | |
# sh mw-export.sh "http://wikisite/wiki/" | |
# | |
SAVEIFS=$IFS | |
IFS=$(echo -en "\n\b") | |
mkdir -p mw; | |
for p in `bundle exec mw list -W $1/api.php`; do | |
echo "Exporting $p..."; | |
bundle exec mw export -W $1/api.php -p "$p" > "mw/$p.mwiki"; | |
done; | |
IFS=$SAVEIFS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment