Bläddra i källkod

Merge pull request #2331 from shreyasp/downloadable-backups

[Minor] Show only sql.gz in Downloadable Backups Page
version-14
Nabin Hait 8 år sedan
committed by GitHub
förälder
incheckning
efbe173440
1 ändrade filer med 4 tillägg och 3 borttagningar
  1. +4
    -3
      frappe/desk/page/backups/backups.py

+ 4
- 3
frappe/desk/page/backups/backups.py Visa fil

@@ -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


Laddar…
Avbryt
Spara