diff --git a/plugins/postgresql/index.py b/plugins/postgresql/index.py index 8079f70da..389feeb95 100755 --- a/plugins/postgresql/index.py +++ b/plugins/postgresql/index.py @@ -73,7 +73,6 @@ def getBackupDir(): bk_path = mw.getBackupDir() + "/databases/postgresql" if not os.path.isdir(bk_path): mw.execShell("mkdir -p {}".format(bk_path)) - return bk_path @@ -673,7 +672,7 @@ def setUserPwd(version=''): def getDbBackupListFunc(dbname=''): - bkDir = mw.getRootDir() + '/backup/database' + bkDir = getBackupDir() blist = os.listdir(bkDir) r = [] @@ -707,11 +706,11 @@ def importDbBackup(): file = args['file'] name = args['name'] - file_path = mw.getRootDir() + '/backup/database/' + file - file_path_sql = mw.getRootDir() + '/backup/database/' + file.replace('.gz', '') + file_path = getBackupDir() + '/' + file + file_path_sql = getBackupDir() + '/' + file.replace('.gz', '') if not os.path.exists(file_path_sql): - cmd = 'cd ' + mw.getRootDir() + '/backup/database && gzip -d ' + file + cmd = 'cd ' + getBackupDir() + ' && gzip -d ' + file mw.execShell(cmd) pwd = pSqliteDb('config').where('id=?', (1,)).getField('pg_root') @@ -730,8 +729,7 @@ def deleteDbBackup(): if not data[0]: return data[1] - bkDir = mw.getRootDir() + '/backup/database' - + bkDir = getBackupDir() os.remove(bkDir + '/' + args['filename']) return mw.returnJson(True, 'ok') @@ -743,7 +741,7 @@ def getDbBackupList(): return data[1] r = getDbBackupListFunc(args['name']) - bkDir = mw.getRootDir() + '/backup/database' + bkDir = getBackupDir() rr = [] for x in range(0, len(r)): p = bkDir + '/' + r[x]