From 68bd1e9038e0593d8c24f05b2b29c98635a5baa2 Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Sat, 24 Sep 2016 06:55:41 -0400 Subject: [PATCH] DB-API: make autobackup configurable Via command line: gramps --config=database:autobackup:1 ## True gramps --config=database:autobackup:0 ## True Or by editing gramps.ini. --- gramps/gen/config.py | 1 + gramps/gen/db/generic.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/gramps/gen/config.py b/gramps/gen/config.py index 074cef3ac..6e5e63672 100644 --- a/gramps/gen/config.py +++ b/gramps/gen/config.py @@ -159,6 +159,7 @@ register('behavior.addons-url', "https://raw.githubusercontent.com/gramps-projec register('database.backend', 'bsddb') register('database.compress-backup', True) +register('database.autobackup', True) ## make backup when exiting, if there are changes register('database.path', os.path.join(HOME_DIR, 'grampsdb')) register('export.proxy-order', diff --git a/gramps/gen/db/generic.py b/gramps/gen/db/generic.py index d53c890d6..790dc715b 100644 --- a/gramps/gen/db/generic.py +++ b/gramps/gen/db/generic.py @@ -1795,7 +1795,8 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback): """ if self._directory: if update: - self.autobackup(user) + if config.get('database.autobackup'): + self.autobackup(user) # This is just a dummy file to indicate last modified time of the # database for gramps.cli.clidbman: filename = os.path.join(self._directory, "meta_data.db")