This commit is contained in:
Mr Chen
2024-10-01 15:37:14 +08:00
parent 590575f5b1
commit 7e11e8138e
2 changed files with 32 additions and 26 deletions
+30 -15
View File
@@ -224,39 +224,54 @@ def initReplace():
mw.execShell('systemctl daemon-reload')
def pgOp(method):
file = initReplace()
current_os = mw.getOs()
if current_os == "darwin":
data = mw.execShell(file + ' ' + method)
if data[1] == '':
return 'ok'
return data[1]
if current_os.startswith("freebsd"):
data = mw.execShell('service' + getPluginName() + ' ' + method)
if data[1] == '':
return 'ok'
return data[1]
if method == 'stop' or method == 'restart':
mw.execShell(file + ' ' + 'stop')
data = mw.execShell('systemctl ' + method+ '' + getPluginName())
if data[1] == '':
return 'ok'
return data[1]
def start():
initCfg()
openPort()
initReplace()
pgOp('start')
cleanNginxLog()
mw.restartWeb()
return 'ok'
def stop():
conf = getConf()
if os.path.exists(conf):
os.remove(conf)
pgOp('stop')
delPort()
mw.restartWeb()
return 'ok'
def restart():
return start()
return pgOp('restart')
def reload():
file_tpl = getPluginDir() + '/conf/phpmyadmin.conf'
file_run = getConf()
if os.path.exists(file_run):
centent = mw.readFile(file_tpl)
centent = contentReplace(centent)
mw.writeFile(file_run, centent)
return start()
return pgOp('reload')
def getPmaOption():
data = getCfg()
+2 -11
View File
@@ -49,10 +49,6 @@ else
OSNAME='unknow'
fi
# if [ -f ${rootPath}/bin/activate ];then
# source ${rootPath}/bin/activate
# fi
Install_pgadmin()
{
# if [ -d $serverPath/pgadmin ];then
@@ -83,20 +79,15 @@ Install_pgadmin()
pip install https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v8.10/pip/pgadmin4-8.10-py3-none-any.whl
VER=$1
echo '安装完成'
cd ${rootPath} && python3 ${rootPath}/plugins/pgadmin/index.py start
echo '安装完成'
}
Uninstall_pgadmin()
{
cd ${rootPath} && python3 ${rootPath}/plugins/pgadmin/index.py stop
rm -rf ${serverPath}/pgadmin
echo '卸载完成'
}