UseModWiki | RecentChanges | Preferences

Bill St. Clair hosts [AnCapWiki] and maintains a weblog, [End the War on Freedom], containing almost-daily links and commentary from his crypto-anarcho-libertarian perspective.

You can reach him at mailto:bill@billstclair.com .

I wrote a little command-line Java program to walk a sub-tree of a UseMod wiki and save the source text in a directory. I'm using this as a way to save a backup of my wiki. I have not documented it yet, other than this page, but you can find it at http://billstclair.com/wiki/download/ . I have tested it in Windows 2000 and Sun's Java 1.4.2. You'll have to change %i to $i in the ".bat" files to make Linux scripts out of them, but other than that, it should work fine with any modern Java VM. The "dl" sub-directory is a recent download of my wiki. Probably not interesting to anybody but me.

[Note: the code doesn't yet work properly with #anchors or sub-pages, so it will fail miserably on lots of UseMod wikis]

Say "DownloadWiki?" at a Windows or Linux command line in the directory where you put these files, and it will show you an example of use. The parameters are:

    DownloadWiki? directory host path wikiScript [startPage]

For example, to download everything reachable from UseModWiki into the sub-directory named "usemod" of the current directory:

    DownloadWiki? usemod www.usemod.com cgi-bin wiki.pl

The directory is created if it doesn't yet exist. Existing files are overwritten.

It does a simple depth-first walk, ignoring the header and footer links except to get the name of the home page if you don't supply a starting point. It currently walks everything before saving anything. It downloads each page twice, once as HTML, to make parsing out the links easy, and once as editing pages, to pull out the source text. There is currently no way to put stops in the recursive descent. For example, aiming it at this page would cause it to download the entire UseModWiki, due to those links.

I'm running a vanilla UseMod 1.0 (September 12, 2003). If your version emits significantly different HTML, you might have to change the code a little to make it work for your wiki.

I don't see any the software at http://billstclair.com/wiki/download/ as of 2006-01-24 -- am I going blind? -- DavidCary?

Some instructions on how to back up another kind of wiki: http://wiki.taoriver.net/moin.fcg/HowToBackup

Why do you need this java program for backing up your wiki? Why not just archive the complete DataDir?

UseModWiki | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited April 8, 2006 5:53 pm by JulianMehnle (diff)