From 4ebbaac5867c7547ffa73147807c382a1d442fed Mon Sep 17 00:00:00 2001 From: shreyas Date: Wed, 16 Nov 2016 16:41:57 +0530 Subject: [PATCH] [Minor] Show only 'sql.gz' in Downloadable backups page --- frappe/desk/page/backups/backups.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/frappe/desk/page/backups/backups.py b/frappe/desk/page/backups/backups.py index a0a29f6b2f..145693972c 100644 --- a/frappe/desk/page/backups/backups.py +++ b/frappe/desk/page/backups/backups.py @@ -25,7 +25,7 @@ def get_context(context): files = [('/backups/' + _file, get_time(os.path.join(path, _file)), - get_size(os.path.join(path, _file))) for _file in files] + get_size(os.path.join(path, _file))) for _file in files if _file.endswith('sql.gz')] files.sort(key=lambda x: x[1], reverse=True) return {"files": files} @@ -37,8 +37,9 @@ def get_scheduled_backup_limit(): def cleanup_old_backups(site_path, files, limit): backup_paths = [] for f in files: - _path = os.path.abspath(os.path.join(site_path, f)) - backup_paths.append(_path) + if f.endswith('sql.gz'): + _path = os.path.abspath(os.path.join(site_path, f)) + backup_paths.append(_path) backup_paths = sorted(backup_paths, key=os.path.getctime) files_to_delete = len(backup_paths) - limit