Skip to content

Commit

Permalink
fix: fetch latest backups
Browse files Browse the repository at this point in the history
updated behaviour of fetch latest backups. doesnt take new backups
and accepts no args
  • Loading branch information
gavindsouza committed Jul 29, 2020
1 parent 9afc9b8 commit 727a2b1
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions frappe/utils/backups.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,26 +208,22 @@ def get_backup():


@frappe.whitelist()
def fetch_latest_backups(with_files=True, recent=3):
"""Takes backup on-demand if doesnt exist satisfying the `recent` parameter
def fetch_latest_backups():
"""Fetches paths of the latest backup taken in the last 30 days
Only for: System Managers
Args:
with_files (bool, optional): If set, files will backuped up. Defaults to True.
recent (int, optional): Won't take a new backup if backup exists within this paramter. Defaults to 3 hours
Returns:
dict: relative Backup Paths
"""
frappe.only_for("System Manager")
odb = BackupGenerator(frappe.conf.db_name, frappe.conf.db_name, frappe.conf.db_password, db_host=frappe.db.host, db_type=frappe.conf.db_type, db_port=frappe.conf.db_port)
odb.get_backup(older_than=recent, ignore_files=not with_files)
database, public, private, config = odb.get_recent_backup(older_than=24 * 30)

return {
"database": odb.backup_path_db,
"public": odb.backup_path_files,
"private": odb.backup_path_private_files,
"config": odb.site_config_backup_path
"database": database,
"public": public,
"private": private,
"config": config
}


Expand Down

0 comments on commit 727a2b1

Please sign in to comment.