Skip to content

Instantly share code, notes, and snippets.

@garrett
Created December 13, 2013 17:36
Show Gist options
  • Save garrett/7948035 to your computer and use it in GitHub Desktop.
Save garrett/7948035 to your computer and use it in GitHub Desktop.
Stupidly simple shell script to export MediaWiki pages (with metadata), as XML
#!/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