update
This commit is contained in:
parent
dff54109a4
commit
d4989bb762
|
|
@ -1,12 +1,11 @@
|
|||
server
|
||||
{
|
||||
listen 888;
|
||||
listen 5051;
|
||||
server_name 127.0.0.1;
|
||||
index index.html index.htm index.php;
|
||||
root {$SERVER_PATH}/pgadmin;
|
||||
|
||||
#error_page 404 /404.html;
|
||||
include {$PHP_CONF_PATH}/enable-php-{$PHP_VER}.conf;
|
||||
|
||||
#AUTH_START
|
||||
auth_basic "Authorization";
|
||||
|
|
|
|||
|
|
@ -84,35 +84,9 @@ def getHomePage():
|
|||
return mw.returnJson(False, '插件未启动!')
|
||||
|
||||
|
||||
def getPhpVer(expect=55):
|
||||
v = site_api.site_api().getPhpVersion()
|
||||
is_find = False
|
||||
for i in range(len(v)):
|
||||
t = str(v[i]['version'])
|
||||
if (t == expect):
|
||||
is_find = True
|
||||
return str(t)
|
||||
if not is_find:
|
||||
if len(v) > 1:
|
||||
return v[1]['version']
|
||||
return v[0]['version']
|
||||
return str(expect)
|
||||
|
||||
|
||||
def getCachePhpVer():
|
||||
cacheFile = getServerDir() + '/php.pl'
|
||||
v = ''
|
||||
if os.path.exists(cacheFile):
|
||||
v = mw.readFile(cacheFile)
|
||||
else:
|
||||
v = getPhpVer()
|
||||
mw.writeFile(cacheFile, v)
|
||||
return v
|
||||
|
||||
|
||||
def contentReplace(content):
|
||||
service_path = mw.getServerDir()
|
||||
php_ver = getCachePhpVer()
|
||||
tmp = mw.execShell(
|
||||
'cat /dev/urandom | head -n 32 | md5sum | head -c 16')
|
||||
blowfish_secret = tmp[0].strip()
|
||||
|
|
@ -120,27 +94,8 @@ def contentReplace(content):
|
|||
php_conf_dir = mw.getServerDir() + '/web_conf/php/conf'
|
||||
content = content.replace('{$ROOT_PATH}', mw.getRootDir())
|
||||
content = content.replace('{$SERVER_PATH}', service_path)
|
||||
content = content.replace('{$PHP_CONF_PATH}', php_conf_dir)
|
||||
content = content.replace('{$PHP_VER}', php_ver)
|
||||
content = content.replace('{$BLOWFISH_SECRET}', blowfish_secret)
|
||||
|
||||
cfg = getCfg()
|
||||
|
||||
if cfg['choose'] == "mysql":
|
||||
content = content.replace('{$CHOOSE_DB}', 'mysql')
|
||||
content = content.replace('{$CHOOSE_DB_DIR}', 'mysql')
|
||||
elif cfg['choose'] == "mysql-apt":
|
||||
content = content.replace('{$CHOOSE_DB}', 'mysql')
|
||||
content = content.replace('{$CHOOSE_DB_DIR}', 'mysql-apt')
|
||||
elif cfg['choose'] == "mysql-yum":
|
||||
content = content.replace('{$CHOOSE_DB}', 'mysql')
|
||||
content = content.replace('{$CHOOSE_DB_DIR}', 'mysql-yum')
|
||||
else:
|
||||
content = content.replace('{$CHOOSE_DB}', 'MariaDB')
|
||||
content = content.replace('{$CHOOSE_DB_DIR}', 'mariadb')
|
||||
|
||||
content = content.replace('{$PMA_PATH}', cfg['path'])
|
||||
|
||||
port = cfg["port"]
|
||||
rep = 'listen\s*(.*);'
|
||||
content = re.sub(rep, "listen " + port + ';', content)
|
||||
|
|
@ -181,11 +136,6 @@ def returnCfg():
|
|||
|
||||
|
||||
def status():
|
||||
conf = getConf()
|
||||
conf_inc = getServerDir() + "/" + getCfg()["path"] + '/config.inc.php'
|
||||
# 两个文件都在,才算启动成功
|
||||
if os.path.exists(conf) and os.path.exists(conf_inc):
|
||||
return 'start'
|
||||
return 'stop'
|
||||
|
||||
|
||||
|
|
@ -193,7 +143,7 @@ def __release_port(port):
|
|||
from collections import namedtuple
|
||||
try:
|
||||
import firewall_api
|
||||
firewall_api.firewall_api().addAcceptPortArgs(port, 'phpMyAdmin默认端口', 'port')
|
||||
firewall_api.firewall_api().addAcceptPortArgs(port, 'pgAdmin默认端口', 'port')
|
||||
return port
|
||||
except Exception as e:
|
||||
return "Release failed {}".format(e)
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ echo "python:$P_VER"
|
|||
|
||||
# source /www/server/pgadmin/bin/activate
|
||||
# python /www/server/pgadmin/lib/python3.10/site-packages/pgadmin4/setup.py
|
||||
# cd /www/server/mdserver-web && python3 plugins/pgadmin/index.py start
|
||||
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
|
||||
|
|
@ -83,7 +84,7 @@ Install_pgadmin()
|
|||
pip install https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v8.10/pip/pgadmin4-8.10-py3-none-any.whl
|
||||
|
||||
|
||||
|
||||
|
||||
VER=$1
|
||||
|
||||
echo '安装完成'
|
||||
|
|
|
|||
Loading…
Reference in New Issue