This commit is contained in:
midoks
2022-12-17 22:19:59 +08:00
parent c0b056c18d
commit 5380cd805c
5 changed files with 63 additions and 16 deletions
+12 -5
View File
@@ -65,6 +65,13 @@ def checkArgs(data, ck=[]):
return (True, mw.returnJson(True, 'ok'))
def getBackupDir():
bk_path = mw.getBackupDir() + "/database/mysql-yum"
if not os.path.isdir(bk_path):
mw.execShell("mkdir -p {}".format(bk_path))
return bk_path
def getConf():
path = getServerDir() + '/etc/my.cnf'
return path
@@ -629,7 +636,7 @@ def __createUser(dbname, username, password, address):
def getDbBackupListFunc(dbname=''):
bkDir = mw.getBackupDir() + '/database/mysql-yum'
bkDir = getBackupDir()
blist = os.listdir(bkDir)
r = []
@@ -729,8 +736,8 @@ def importDbBackup():
file = args['file']
name = args['name']
file_path = mw.getBackupDir() + '/database/' + file
file_path_sql = mw.getBackupDir() + '/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.getBackupDir() + '/database && gzip -d ' + file
@@ -754,7 +761,7 @@ def deleteDbBackup():
path = args['path']
full_file = ""
bkDir = mw.getBackupDir() + '/database/mysql-yum'
bkDir = getBackupDir()
full_file = bkDir + '/' + args['filename']
if path != "":
full_file = path + "/" + args['filename']
@@ -769,7 +776,7 @@ def getDbBackupList():
return data[1]
r = getDbBackupListFunc(args['name'])
bkDir = mw.getBackupDir() + '/database/mysql-yum'
bkDir = getBackupDir()
rr = []
for x in range(0, len(r)):
p = bkDir + '/' + r[x]