Version 6.x.x Source

Introduction


This module handles the On Demand Backup utility



Class BackupGenerator

This class contains methods to perform On Demand Backup

To initialize, specify (dbname, user, password, dbfilename=None, dbhost="localhost") If specifying dbfilename, also append ".sql.gz"

__init__ (self, db_name, user, password, backup_path_db=None, backup_path_files=None, backup_path_private_files=None, db_host=localhost)

No docs


get_backup (self, older_than=24, ignore_files=False, force=False)

Takes a new dump if existing file is old and sends the link to the file as email


get_recent_backup (self, older_than)

No docs


send_email (self)

Sends the link to backup file located at erpnext/backups


set_backup_file_name (self)

No docs


take_dump (self)

No docs


zip_files (self)

No docs



frappe.utils.backups.backup (with_files=False, backup_path_db=None, backup_path_files=None, quiet=False)

Backup


frappe.utils.backups.delete_temp_backups (older_than=24)

Cleans up the backuplinkpath directory by deleting files older than 24 hours


Public API
/api/method/frappe.utils.backups.get_backup

frappe.utils.backups.get_backup ()

This function is executed when the user clicks on Toos > Download Backup


frappe.utils.backups.get_backup_path ()

No docs


frappe.utils.backups.is_file_old (db_file_name, older_than=24)

Checks if file exists and is older than specified hours Returns -> True: file does not exist or file is old False: file is new


frappe.utils.backups.new_backup (older_than=6, ignore_files=False, backup_path_db=None, backup_path_files=None, backup_path_private_files=None, force=False)

No docs


frappe.utils.backups.scheduled_backup (older_than=6, ignore_files=False, backup_path_db=None, backup_path_files=None, backup_path_private_files=None, force=False)

this function is called from scheduler deletes backups older than 7 days takes backup