changeset 55:2932ba63d998

make WikiBackup action configurable imported from: moin--main--1.5--patch-57
author Thomas Waldmann <tw@waldmann-edv.de>
date Thu, 29 Sep 2005 18:06:32 +0000
parents 34fdc0926460
children aedb415dc3a4
files MoinMoin/action/WikiBackup.py MoinMoin/multiconfig.py docs/CHANGES
diffstat 3 files changed, 21 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/action/WikiBackup.py	Thu Sep 29 16:51:24 2005 +0000
+++ b/MoinMoin/action/WikiBackup.py	Thu Sep 29 18:06:32 2005 +0000
@@ -1,6 +1,9 @@
 # -*- coding: iso-8859-1 -*-
 """
-    MoinMoin - make a backup of the wiki
+    MoinMoin - make a full backup of the wiki
+
+    Triggering WikiBackup action will check if you are authorized to do a
+    backup and if yes, just send a <siteid>-<date>--<time>.tgz to you.
 
     @copyright: 2005 by MoinMoin:ThomasWaldmann
     @license: GNU GPL, see COPYING for details.
@@ -17,9 +20,7 @@
     tarfileobj = tarfile.TarFile(fileobj=gzfileobj, mode="w")
     tarfileobj.posix = False # allow GNU tar's longer file/pathnames
 
-    request.cfg.backup_include = [request.cfg.data_dir]
-    request.cfg.backup_exclude = r"(.+\.py(c|o)$)|(cache/(antispam|i18n|user|wikidicts|lupy.*|spellchecker.dict|text_html))|edit-lock|event-log"
-    exclude_re = re.compile(request.cfg.backup_exclude)
+    exclude_re = re.compile("|".join(request.cfg.backup_exclude))
     for path in request.cfg.backup_include:
         for root, dirs, files in os.walk(path):
             for fname in files:
@@ -38,7 +39,7 @@
     # be extra paranoid in dangerous actions
     actname = __name__.split('.')[-1]
     if actname in request.cfg.actions_excluded or \
-            request.user.name not in request.cfg.superuser: # TODO: better use some backup_user list
+            request.user.name not in request.cfg.backup_users:
         return Page.Page(request, pagename).send_page(request,
             msg = _('You are not allowed to use this action.'))
 
--- a/MoinMoin/multiconfig.py	Thu Sep 29 16:51:24 2005 +0000
+++ b/MoinMoin/multiconfig.py	Thu Sep 29 18:06:32 2005 +0000
@@ -173,6 +173,12 @@
     allow_xslt = 0
     attachments = None # {'dir': path, 'url': url-prefix}
     auth = [authmodule.moin_cookie]
+    backup_users = []
+    backup_include = []
+    backup_exclude = [r"(.+\.py(c|o)$)",
+                      r"(/cache/(antispam|i18n|user|wikidicts|lupy.*|spellchecker.dict|text_html))",
+                      r"/edit-lock$",
+                      r"/event-log$",]
     bang_meta = 1
     caching_formats = ['text_html']
     changed_time_fmt = '%H:%M'
--- a/docs/CHANGES	Thu Sep 29 16:51:24 2005 +0000
+++ b/docs/CHANGES	Thu Sep 29 18:06:32 2005 +0000
@@ -150,7 +150,15 @@
     * Add support for running behind proxy out of the box with out
       manual url mapping.
       See HelpOnConfiguration/IntegratingWithApache
-    * added a WikiBackup action
+    * added a WikiBackup action, configure it similar to this:
+      data_dir = "...."
+      backup_include = [data_dir, ] # you can add other dirs here
+      backup_users = ["BackupUserName", ] # some VERY trusted guys
+      You usually don't need to change the default backup_exclude setting.
+      The default backup_include list is EMPTY and so will be your
+      backup in case you don't configure it correctly.
+      If you put your data_dir there, the backup will contain private
+      user data like email addresses and crypted passwords.
 
 Developer notes: