From 415a2a1f8f06fde1fb47907934fc30bf98b76f96 Mon Sep 17 00:00:00 2001 From: midoks Date: Mon, 19 Dec 2022 14:27:29 +0800 Subject: [PATCH] #307 --- class/core/crontab_api.py | 16 +++++++++------- route/static/app/crontab.js | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/class/core/crontab_api.py b/class/core/crontab_api.py index b1a9eadc6..276db8bca 100755 --- a/class/core/crontab_api.py +++ b/class/core/crontab_api.py @@ -377,10 +377,11 @@ class crontab_api: stype = request.form.get('type', '') bak_data = [] - hookPath = mw.getPanelDataDir() + "/hook_backup.json" - if os.path.exists(hookPath): - t = mw.readFile(hookPath) - bak_data = json.loads(t) + if stype == 'sites' or stype == 'database' or stype.find('database_') > -1 or stype == 'path': + hookPath = mw.getPanelDataDir() + "/hook_backup.json" + if os.path.exists(hookPath): + t = mw.readFile(hookPath) + bak_data = json.loads(t) if stype == 'database' or stype.find('database_') > -1: sqlite3_name = 'mysql' @@ -411,10 +412,11 @@ class crontab_api: data = {} data['orderOpt'] = bak_data - if stype == 'site' or stype == 'logs': - stype == 'sites' + default_db = 'sites' + # if stype == 'site' or stype == 'logs': + # stype == 'sites' - data['data'] = mw.M(stype).field('name,ps').select() + data['data'] = mw.M(default_db).field('name,ps').select() return mw.getJson(data) ##### ----- start ----- ### diff --git a/route/static/app/crontab.js b/route/static/app/crontab.js index f3c13a580..78d3a6b76 100755 --- a/route/static/app/crontab.js +++ b/route/static/app/crontab.js @@ -462,7 +462,7 @@ function toBackup(type){ break; case 'logs': sMsg = '切割日志'; - sType = "sites"; + sType = "logs"; break; case 'path': sMsg = '备份目录';