pull/310/head
midoks 2 years ago
parent c0b056c18d
commit 5380cd805c
  1. 18
      plugins/mariadb/index.py
  2. 15
      plugins/mysql-apt/index.py
  3. 17
      plugins/mysql-yum/index.py
  4. 27
      plugins/postgresql/index.html
  5. 2
      plugins/postgresql/index.py

@ -71,6 +71,13 @@ def checkArgs(data, ck=[]):
return (True, mw.returnJson(True, 'ok'))
def getBackupDir():
bk_path = mw.getBackupDir() + "/database/mariadb"
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
@ -675,7 +682,7 @@ def __createUser(dbname, username, password, address):
def getDbBackupListFunc(dbname=''):
bkDir = mw.getRootDir() + '/backup/database/mariadb'
bkDir = getBackupDir()
blist = os.listdir(bkDir)
r = []
@ -709,9 +716,8 @@ def importDbBackup():
file = args['file']
name = args['name']
file_path = mw.getBackupDir() + '/database/mariadb/' + file
file_path_sql = mw.getBackupDir() + '/database/mariadb/' + \
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/mariadb && gzip -d ' + file
@ -798,7 +804,7 @@ def deleteDbBackup():
path = args['path']
full_file = ""
bkDir = mw.getRootDir() + '/backup/database/mariadb'
bkDir = getBackupDir()
full_file = bkDir + '/' + args['filename']
if path != "":
full_file = path + "/" + args['filename']
@ -813,7 +819,7 @@ def getDbBackupList():
return data[1]
r = getDbBackupListFunc(args['name'])
bkDir = mw.getBackupDir() + '/database/mariadb'
bkDir = getBackupDir()
if not os.path.exists(bkDir):
os.mkdir(bkDir)

@ -67,6 +67,13 @@ def getArgs():
return tmp
def getBackupDir():
bk_path = mw.getBackupDir() + "/database/mysql-apt"
if not os.path.isdir(bk_path):
mw.execShell("mkdir -p {}".format(bk_path))
return bk_path
def checkArgs(data, ck=[]):
for i in range(len(ck)):
if not ck[i] in data:
@ -651,7 +658,7 @@ def __createUser(dbname, username, password, address):
def getDbBackupListFunc(dbname=''):
bkDir = mw.getBackupDir() + '/database/mysql-apt'
bkDir = getBackupDir()
if not os.path.exists(bkDir):
os.mkdir(bkDir)
@ -688,7 +695,7 @@ def importDbExternal():
file = args['file']
name = args['name']
import_dir = mw.getBackupDir() + '/import/mysql-apt'
import_dir = mw.getBackupDir() + '/import/'
file_path = import_dir + file
if not os.path.exists(file_path):
@ -779,7 +786,7 @@ def deleteDbBackup():
path = args['path']
full_file = ""
bkDir = mw.getBackupDir() + '/database/mysql-apt'
bkDir = getBackupDir()
full_file = bkDir + '/' + args['filename']
if path != "":
full_file = path + "/" + args['filename']
@ -794,7 +801,7 @@ def getDbBackupList():
return data[1]
r = getDbBackupListFunc(args['name'])
bkDir = mw.getBackupDir() + '/database/mysql-apt'
bkDir = getBackupDir()
rr = []
for x in range(0, len(r)):
p = bkDir + '/' + r[x]

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

@ -1,3 +1,30 @@
<style type="text/css">
.db_list{
padding: 0px 0 10px 0;
font-size: 13px;
line-height: 35px;
height: 45px;
}
.db_list a{
margin-right: 15px;
color: #555;
font-weight: 600;
}
.db_list span:nth-child(1){
display: block;
float: left;
padding-left: 15px;
background: #ececec;
border-radius: 3px;
}
#db_tools button {
margin-right: 10px;
}
#db_tools button:last-child{
margin-right: 0;
}
</style>
<div class="bt-form">
<div class='plugin_version'></div>
<div class="bt-w-main">

@ -70,7 +70,7 @@ def getArgs():
def getBackupDir():
bk_path = mw.getBackupDir() + "/databases/postgresql"
bk_path = mw.getBackupDir() + "/database/postgresql"
if not os.path.isdir(bk_path):
mw.execShell("mkdir -p {}".format(bk_path))
return bk_path

Loading…
Cancel
Save