1.1 --- a/README.txt Tue Jan 08 18:25:47 2008 +0100
1.2 +++ b/README.txt Tue Jan 08 18:47:43 2008 +0100
1.3 @@ -49,6 +49,10 @@
1.4
1.5 .../ep2008/wiki/data/pages/AdminGroup/current
1.6
1.7 +For an archived Wiki, the page is most likely to reside here:
1.8 +
1.9 +.../ep2008/wiki/data/pages/AdminGroup/revisions/00000001
1.10 +
1.11 Be sure to only add existing users - there exists a possibility of people
1.12 otherwise creating accounts which would then have undeserved administrative
1.13 privileges.
2.1 --- a/archive_wiki.py Tue Jan 08 18:25:47 2008 +0100
2.2 +++ b/archive_wiki.py Tue Jan 08 18:47:43 2008 +0100
2.3 @@ -1,8 +1,14 @@
2.4 #!/usr/bin/env python
2.5
2.6 -import sys, os
2.7 +import sys, os, commands
2.8
2.9 -wiki_dir, archive_dir = sys.argv[1:3]
2.10 +try:
2.11 + wiki_dir, archive_dir = sys.argv[1:3]
2.12 +except ValueError:
2.13 + print "For archiving, please specify the Wiki directory and a target archive directory."
2.14 + print "For restoring, please specify the archive directory and a target Wiki directory."
2.15 + sys.exit(1)
2.16 +
2.17 dry_run = ("-n" in sys.argv)
2.18
2.19 pages = os.path.join(wiki_dir, "wiki", "data", "pages")
2.20 @@ -59,7 +65,9 @@
2.21 finally:
2.22 f.close()
2.23
2.24 - cmd = "cp %s %s" % (os.path.join(page_revisions, current), os.path.join(archive_page_revisions, "00000001"))
2.25 + cmd = "cp %s %s" % tuple(
2.26 + map(commands.mkarg, (os.path.join(page_revisions, current), os.path.join(archive_page_revisions, "00000001")))
2.27 + )
2.28 print cmd
2.29 if not dry_run:
2.30 os.system(cmd)
2.31 @@ -72,7 +80,9 @@
2.32 if not dry_run and not os.path.exists(archive_attachments_dir):
2.33 os.mkdir(archive_attachments_dir)
2.34
2.35 - cmd = "cp %s %s" % (os.path.join(attachments_dir, "*"), archive_attachments_dir)
2.36 + cmd = "cp %s %s" % (
2.37 + os.path.join(commands.mkarg(attachments_dir), "*"), commands.mkarg(archive_attachments_dir)
2.38 + )
2.39 print cmd
2.40 if not dry_run:
2.41 os.system(cmd)
2.42 @@ -80,6 +90,6 @@
2.43 print
2.44
2.45 print "Now run the following, if adding to a live Wiki:"
2.46 -print "chown -R www-data: %s/www %s/wiki" % (archive_dir, archive_dir)
2.47 +print "chown -R www-data: %s" % os.path.join(archive_dir, "wiki")
2.48
2.49 # vim: tabstop=4 expandtab shiftwidth=4