Browse Source

Merge pull request #2331 from shreyasp/downloadable-backups

[Minor] Show only sql.gz in Downloadable Backups Page
version-14
Nabin Hait 8 years ago
committed by GitHub
parent
commit
efbe173440
1 changed files with 4 additions and 3 deletions
  1. +4
    -3
      frappe/desk/page/backups/backups.py

+ 4
- 3
frappe/desk/page/backups/backups.py View File

@@ -25,7 +25,7 @@ def get_context(context):


files = [('/backups/' + _file, files = [('/backups/' + _file,
get_time(os.path.join(path, _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) files.sort(key=lambda x: x[1], reverse=True)


return {"files": files} return {"files": files}
@@ -37,8 +37,9 @@ def get_scheduled_backup_limit():
def cleanup_old_backups(site_path, files, limit): def cleanup_old_backups(site_path, files, limit):
backup_paths = [] backup_paths = []
for f in files: 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) backup_paths = sorted(backup_paths, key=os.path.getctime)
files_to_delete = len(backup_paths) - limit files_to_delete = len(backup_paths) - limit


Loading…
Cancel
Save