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.
This commit is contained in:
Doug Blank 2016-09-24 06:55:41 -04:00
parent 0ce1a91dec
commit 68bd1e9038
2 changed files with 3 additions and 1 deletions

View File

@ -159,6 +159,7 @@ register('behavior.addons-url', "https://raw.githubusercontent.com/gramps-projec
register('database.backend', 'bsddb') register('database.backend', 'bsddb')
register('database.compress-backup', True) 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('database.path', os.path.join(HOME_DIR, 'grampsdb'))
register('export.proxy-order', register('export.proxy-order',

View File

@ -1795,7 +1795,8 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
""" """
if self._directory: if self._directory:
if update: 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 # This is just a dummy file to indicate last modified time of the
# database for gramps.cli.clidbman: # database for gramps.cli.clidbman:
filename = os.path.join(self._directory, "meta_data.db") filename = os.path.join(self._directory, "meta_data.db")