[minor] [fix] backup

This commit is contained in:
Anand Doshi 2013-11-07 13:12:36 +05:30
parent 97223563cc
commit 5383b3cc89
2 changed files with 4 additions and 6 deletions

View file

@ -44,7 +44,7 @@ class BackupGenerator:
last_db, last_file = self.get_recent_backup(older_than)
if not (self.backup_path_files and self.backup_path_db):
self.set_backup_file_name()
if not last_db and not last_file:
if not (last_db and last_file):
self.take_dump()
if not ignore_files:
self.zip_files()
@ -148,9 +148,6 @@ def scheduled_backup(older_than=6, ignore_files=False, backup_path_db=None, back
deletes backups older than 7 days
takes backup"""
odb = new_backup(older_than, ignore_files, backup_path_db=backup_path_db, backup_path_files=backup_path_files)
from webnotes.utils import now
print "backup taken -", odb.backup_path_db, "- on", now()
return odb
def new_backup(older_than=6, ignore_files=False, backup_path_db=None, backup_path_files=None):

5
wnf.py
View file

@ -331,11 +331,12 @@ def watch():
def backup(site=None, with_files=False, verbose=True, backup_path_db=None, backup_path_files=None):
from webnotes.utils.backups import scheduled_backup
webnotes.connect(site=site)
print backup_path_db
odb = scheduled_backup(ignore_files=not with_files, backup_path_db=backup_path_db, backup_path_files=backup_path_files)
if verbose:
from webnotes.utils import now
print "backup taken -", odb.backup_path_db, "- on", now()
print "database backup taken -", odb.backup_path_db, "- on", now()
if with_files:
print "files backup taken -", odb.backup_path_files, "- on", now()
return odb
@cmd