# HG changeset patch # User Paul Boddie # Date 1199814463 -3600 # Node ID 08a5fb355cf880ea04ffc4e55d8692ef47d263f5 # Parent f15442b5682e6184c403daf8b0f447e098b6bf73 Fixed shell argument handling and added instructions to the archiving script. Added a note about archived revisions when editing AdminGroup. diff -r f15442b5682e -r 08a5fb355cf8 README.txt --- a/README.txt Tue Jan 08 18:25:47 2008 +0100 +++ b/README.txt Tue Jan 08 18:47:43 2008 +0100 @@ -49,6 +49,10 @@ .../ep2008/wiki/data/pages/AdminGroup/current +For an archived Wiki, the page is most likely to reside here: + +.../ep2008/wiki/data/pages/AdminGroup/revisions/00000001 + Be sure to only add existing users - there exists a possibility of people otherwise creating accounts which would then have undeserved administrative privileges. diff -r f15442b5682e -r 08a5fb355cf8 archive_wiki.py --- a/archive_wiki.py Tue Jan 08 18:25:47 2008 +0100 +++ b/archive_wiki.py Tue Jan 08 18:47:43 2008 +0100 @@ -1,8 +1,14 @@ #!/usr/bin/env python -import sys, os +import sys, os, commands -wiki_dir, archive_dir = sys.argv[1:3] +try: + wiki_dir, archive_dir = sys.argv[1:3] +except ValueError: + print "For archiving, please specify the Wiki directory and a target archive directory." + print "For restoring, please specify the archive directory and a target Wiki directory." + sys.exit(1) + dry_run = ("-n" in sys.argv) pages = os.path.join(wiki_dir, "wiki", "data", "pages") @@ -59,7 +65,9 @@ finally: f.close() - cmd = "cp %s %s" % (os.path.join(page_revisions, current), os.path.join(archive_page_revisions, "00000001")) + cmd = "cp %s %s" % tuple( + map(commands.mkarg, (os.path.join(page_revisions, current), os.path.join(archive_page_revisions, "00000001"))) + ) print cmd if not dry_run: os.system(cmd) @@ -72,7 +80,9 @@ if not dry_run and not os.path.exists(archive_attachments_dir): os.mkdir(archive_attachments_dir) - cmd = "cp %s %s" % (os.path.join(attachments_dir, "*"), archive_attachments_dir) + cmd = "cp %s %s" % ( + os.path.join(commands.mkarg(attachments_dir), "*"), commands.mkarg(archive_attachments_dir) + ) print cmd if not dry_run: os.system(cmd) @@ -80,6 +90,6 @@ print print "Now run the following, if adding to a live Wiki:" -print "chown -R www-data: %s/www %s/wiki" % (archive_dir, archive_dir) +print "chown -R www-data: %s" % os.path.join(archive_dir, "wiki") # vim: tabstop=4 expandtab shiftwidth=4