|
|
@ -65,6 +65,13 @@ def checkArgs(data, ck=[]): |
|
|
|
return (True, mw.returnJson(True, 'ok')) |
|
|
|
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(): |
|
|
|
def getConf(): |
|
|
|
path = getServerDir() + '/etc/my.cnf' |
|
|
|
path = getServerDir() + '/etc/my.cnf' |
|
|
|
return path |
|
|
|
return path |
|
|
@ -629,7 +636,7 @@ def __createUser(dbname, username, password, address): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def getDbBackupListFunc(dbname=''): |
|
|
|
def getDbBackupListFunc(dbname=''): |
|
|
|
bkDir = mw.getBackupDir() + '/database/mysql-yum' |
|
|
|
bkDir = getBackupDir() |
|
|
|
blist = os.listdir(bkDir) |
|
|
|
blist = os.listdir(bkDir) |
|
|
|
r = [] |
|
|
|
r = [] |
|
|
|
|
|
|
|
|
|
|
@ -729,8 +736,8 @@ def importDbBackup(): |
|
|
|
file = args['file'] |
|
|
|
file = args['file'] |
|
|
|
name = args['name'] |
|
|
|
name = args['name'] |
|
|
|
|
|
|
|
|
|
|
|
file_path = mw.getBackupDir() + '/database/' + file |
|
|
|
file_path = getBackupDir() + '/' + file |
|
|
|
file_path_sql = mw.getBackupDir() + '/database/' + file.replace('.gz', '') |
|
|
|
file_path_sql = getBackupDir() + '/' + file.replace('.gz', '') |
|
|
|
|
|
|
|
|
|
|
|
if not os.path.exists(file_path_sql): |
|
|
|
if not os.path.exists(file_path_sql): |
|
|
|
cmd = 'cd ' + mw.getBackupDir() + '/database && gzip -d ' + file |
|
|
|
cmd = 'cd ' + mw.getBackupDir() + '/database && gzip -d ' + file |
|
|
@ -754,7 +761,7 @@ def deleteDbBackup(): |
|
|
|
|
|
|
|
|
|
|
|
path = args['path'] |
|
|
|
path = args['path'] |
|
|
|
full_file = "" |
|
|
|
full_file = "" |
|
|
|
bkDir = mw.getBackupDir() + '/database/mysql-yum' |
|
|
|
bkDir = getBackupDir() |
|
|
|
full_file = bkDir + '/' + args['filename'] |
|
|
|
full_file = bkDir + '/' + args['filename'] |
|
|
|
if path != "": |
|
|
|
if path != "": |
|
|
|
full_file = path + "/" + args['filename'] |
|
|
|
full_file = path + "/" + args['filename'] |
|
|
@ -769,7 +776,7 @@ def getDbBackupList(): |
|
|
|
return data[1] |
|
|
|
return data[1] |
|
|
|
|
|
|
|
|
|
|
|
r = getDbBackupListFunc(args['name']) |
|
|
|
r = getDbBackupListFunc(args['name']) |
|
|
|
bkDir = mw.getBackupDir() + '/database/mysql-yum' |
|
|
|
bkDir = getBackupDir() |
|
|
|
rr = [] |
|
|
|
rr = [] |
|
|
|
for x in range(0, len(r)): |
|
|
|
for x in range(0, len(r)): |
|
|
|
p = bkDir + '/' + r[x] |
|
|
|
p = bkDir + '/' + r[x] |
|
|
|