mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-10 04:39:26 +08:00
@@ -122,6 +122,7 @@ data/datadir.pl
|
||||
data/502Task.pl
|
||||
data/default.pl
|
||||
data/backup.pl
|
||||
data/debug.pl
|
||||
data/default_site.pl
|
||||
lib/python*
|
||||
|
||||
@@ -151,6 +152,7 @@ plugins/gdrive
|
||||
plugins/mtproxy
|
||||
plugins/zimg
|
||||
plugins/bk_demo
|
||||
plugins/mail
|
||||
debug.out
|
||||
|
||||
|
||||
|
||||
@@ -90,18 +90,14 @@ docker run -itd --name mw-server --privileged=true -p 7200:7200 -p 80:80 -p 443:
|
||||
```
|
||||
|
||||
|
||||
### 版本更新 0.9.9
|
||||
### 版本更新 0.9.10
|
||||
|
||||
* 更换Logo。
|
||||
* 增加amazon linux系统支持。
|
||||
* 修复rsyncd在debian或ubuntu下安装失败问题。
|
||||
* Readme加入一AD。
|
||||
* PHP-YUM|PHP-APT优化[性能调整]。
|
||||
* 优化Gogs使用MySQL的方式。
|
||||
* 配置模板添加一个whmcs。
|
||||
* MySQL和MariaDB无法直接卸载。
|
||||
* OpenResty加入http_realip_module模块。
|
||||
* PHP加入igbinary扩展。
|
||||
* 防跨站攻击(open_basedir)功能优化。
|
||||
* 创建站点域名批量添加优化。
|
||||
* 首页CPU显示tip添加。
|
||||
* 优化日志读取。
|
||||
* 加入开发模式开关。
|
||||
* redis添加性能调整功能。
|
||||
|
||||
|
||||
### JSDelivr安装地址
|
||||
|
||||
@@ -15,7 +15,7 @@ from flask import request
|
||||
|
||||
class config_api:
|
||||
|
||||
__version = '0.9.9'
|
||||
__version = '0.9.10'
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
@@ -207,6 +207,14 @@ class config_api:
|
||||
mw.execShell("chown root.root " + filename)
|
||||
return mw.returnJson(True, '面板已关闭!')
|
||||
|
||||
def openDebugApi(self):
|
||||
filename = 'data/debug.pl'
|
||||
if os.path.exists(filename):
|
||||
os.remove(filename)
|
||||
return mw.returnJson(True, '开发模式关闭!')
|
||||
mw.writeFile(filename, 'True')
|
||||
return mw.returnJson(True, '开发模式开启!')
|
||||
|
||||
def setIpv6StatusApi(self):
|
||||
ipv6_file = 'data/ipv6.pl'
|
||||
if os.path.exists('data/ipv6.pl'):
|
||||
@@ -316,11 +324,17 @@ class config_api:
|
||||
data['admin_path'] = mw.readFile(admin_path_file)
|
||||
|
||||
ipv6_file = 'data/ipv6.pl'
|
||||
if os.path.exists('data/ipv6.pl'):
|
||||
if os.path.exists(ipv6_file):
|
||||
data['ipv6'] = 'checked'
|
||||
else:
|
||||
data['ipv6'] = ''
|
||||
|
||||
debug_file = 'data/debug.pl'
|
||||
if os.path.exists(debug_file):
|
||||
data['debug'] = 'checked'
|
||||
else:
|
||||
data['debug'] = ''
|
||||
|
||||
ssl_file = 'data/ssl.pl'
|
||||
if os.path.exists('data/ssl.pl'):
|
||||
data['ssl'] = 'checked'
|
||||
|
||||
@@ -167,7 +167,7 @@ class crontab_api:
|
||||
logFile = mw.getServerDir() + '/cron/' + echo['echo'] + '.log'
|
||||
if not os.path.exists(logFile):
|
||||
return mw.returnJson(False, '当前日志为空!')
|
||||
log = mw.getNumLines(logFile, 500)
|
||||
log = mw.getLastLine(logFile, 500)
|
||||
return mw.returnJson(True, log)
|
||||
|
||||
def addApi(self):
|
||||
|
||||
@@ -36,7 +36,7 @@ class files_api:
|
||||
return mw.returnJson(False, '文件不存在', (path,))
|
||||
|
||||
try:
|
||||
data = mw.getNumLines(path, int(line))
|
||||
data = mw.getLastLine(path, int(line))
|
||||
return mw.returnJson(True, 'OK', data)
|
||||
except Exception as ex:
|
||||
return mw.returnJson(False, u'无法正确读取文件!' + str(ex))
|
||||
|
||||
+14
-3
@@ -609,7 +609,7 @@ def getNumLines(path, num, p=1):
|
||||
break
|
||||
fp.close()
|
||||
except Exception as e:
|
||||
return ''
|
||||
return str(e)
|
||||
|
||||
return "\n".join(data)
|
||||
|
||||
@@ -714,13 +714,24 @@ def getStrBetween(startStr, endStr, srcStr):
|
||||
|
||||
|
||||
def getCpuType():
|
||||
cpuType = ''
|
||||
if isAppleSystem():
|
||||
cmd = "system_profiler SPHardwareDataType | grep 'Processor Name' | awk -F ':' '{print $2}'"
|
||||
cpuinfo = execShell(cmd)
|
||||
return cpuinfo[0].strip()
|
||||
|
||||
# 取CPU类型
|
||||
cpuinfo = open('/proc/cpuinfo', 'r').read()
|
||||
rep = "model\s+name\s+:\s+(.+)"
|
||||
tmp = re.search(rep, cpuinfo)
|
||||
cpuType = None
|
||||
tmp = re.search(rep, cpuinfo, re.I)
|
||||
if tmp:
|
||||
cpuType = tmp.groups()[0]
|
||||
else:
|
||||
cpuinfo = execShell('LANG="en_US.UTF-8" && lscpu')[0]
|
||||
rep = "Model\s+name:\s+(.+)"
|
||||
tmp = re.search(rep, cpuinfo, re.I)
|
||||
if tmp:
|
||||
cpuType = tmp.groups()[0]
|
||||
return cpuType
|
||||
|
||||
|
||||
|
||||
+39
-24
@@ -340,10 +340,16 @@ class site_api:
|
||||
name = mw.M('sites').where("id=?", (mid,)).getField('name')
|
||||
data = {}
|
||||
data['logs'] = self.getLogsStatus(name)
|
||||
data['runPath'] = self.getSiteRunPath(mid)
|
||||
|
||||
data['userini'] = False
|
||||
if os.path.exists(path + '/.user.ini'):
|
||||
data['userini'] = True
|
||||
data['runPath'] = self.getSiteRunPath(mid)
|
||||
|
||||
if data['runPath']['runPath'] != '/':
|
||||
if os.path.exists(path + data['runPath']['runPath'] + '/.user.ini'):
|
||||
data['userini'] = True
|
||||
|
||||
data['pass'] = self.getHasPwd(name)
|
||||
data['path'] = path
|
||||
data['name'] = name
|
||||
@@ -351,15 +357,18 @@ class site_api:
|
||||
|
||||
def setDirUserIniApi(self):
|
||||
path = request.form.get('path', '')
|
||||
runPath = request.form.get('runPath', '')
|
||||
filename = path + '/.user.ini'
|
||||
self.delUserInI(path)
|
||||
|
||||
if os.path.exists(filename):
|
||||
self.delUserInI(path)
|
||||
mw.execShell("which chattr && chattr -i " + filename)
|
||||
os.remove(filename)
|
||||
return mw.returnJson(True, '已清除防跨站设置!')
|
||||
mw.writeFile(filename, 'open_basedir=' + path +
|
||||
'/:/www/server/php:/tmp/:/proc/')
|
||||
|
||||
self.setDirUserINI(path, runPath)
|
||||
mw.execShell("which chattr && chattr +i " + filename)
|
||||
|
||||
return mw.returnJson(True, '已打开防跨站设置!')
|
||||
|
||||
def logsOpenApi(self):
|
||||
@@ -730,11 +739,11 @@ class site_api:
|
||||
if conf.find('ssl_certificate') == -1:
|
||||
return mw.returnJson(False, '当前未开启SSL')
|
||||
to = """#error_page 404/404.html;
|
||||
#HTTP_TO_HTTPS_START
|
||||
# HTTP_TO_HTTPS_START
|
||||
if ($server_port !~ 443){
|
||||
rewrite ^(/.*)$ https://$host$1 permanent;
|
||||
}
|
||||
#HTTP_TO_HTTPS_END"""
|
||||
# HTTP_TO_HTTPS_END"""
|
||||
conf = conf.replace('#error_page 404/404.html;', to)
|
||||
mw.writeFile(file, conf)
|
||||
|
||||
@@ -1095,6 +1104,7 @@ class site_api:
|
||||
sitePath = mw.M('sites').where('id=?', (mid,)).getField('path')
|
||||
|
||||
newPath = sitePath + runPath
|
||||
|
||||
# 处理Nginx
|
||||
filename = self.getHostConf(siteName)
|
||||
if os.path.exists(filename):
|
||||
@@ -1104,8 +1114,7 @@ class site_api:
|
||||
conf = conf.replace(path, newPath)
|
||||
mw.writeFile(filename, conf)
|
||||
|
||||
self.delUserInI(sitePath)
|
||||
self.setDirUserINI(newPath)
|
||||
self.setDirUserINI(sitePath, runPath)
|
||||
|
||||
mw.restartWeb()
|
||||
return mw.returnJson(True, '设置成功!')
|
||||
@@ -1562,7 +1571,7 @@ class site_api:
|
||||
|
||||
# location ~* ^{from}(.*)$ {
|
||||
tpl = """
|
||||
# PROXY-START/
|
||||
#PROXY-START/
|
||||
location ^~ {from} {
|
||||
proxy_pass {to};
|
||||
proxy_set_header Host {host};
|
||||
@@ -1585,7 +1594,7 @@ location ^~ {from} {
|
||||
add_header Cache-Control no-cache;
|
||||
}
|
||||
}
|
||||
# PROXY-END/
|
||||
#PROXY-END/
|
||||
"""
|
||||
|
||||
# replace
|
||||
@@ -1829,13 +1838,13 @@ location ^~ {from} {
|
||||
logPath = mw.getLogsDir() + '/' + siteName + '.log'
|
||||
if not os.path.exists(logPath):
|
||||
return mw.returnJson(False, '日志为空')
|
||||
return mw.returnJson(True, mw.getNumLines(logPath, 100))
|
||||
return mw.returnJson(True, mw.getLastLine(logPath, 100))
|
||||
|
||||
def getErrorLogs(self, siteName):
|
||||
logPath = mw.getLogsDir() + '/' + siteName + '.error.log'
|
||||
if not os.path.exists(logPath):
|
||||
return mw.returnJson(False, '日志为空')
|
||||
return mw.returnJson(True, mw.getNumLines(logPath, 100))
|
||||
return mw.returnJson(True, mw.getLastLine(logPath, 100))
|
||||
|
||||
# 取日志状态
|
||||
def getLogsStatus(self, siteName):
|
||||
@@ -2094,12 +2103,16 @@ location ^~ {from} {
|
||||
return rewriteList
|
||||
|
||||
def createRootDir(self, path):
|
||||
autoInit = False
|
||||
if not os.path.exists(path):
|
||||
autoInit = True
|
||||
os.makedirs(path)
|
||||
if not mw.isAppleSystem():
|
||||
mw.execShell('chown -R www:www ' + path)
|
||||
mw.writeFile(path + '/index.html', 'Work has started!!!')
|
||||
mw.execShell('chmod -R 755 ' + path)
|
||||
|
||||
if autoInit:
|
||||
mw.writeFile(path + '/index.html', 'Work has started!!!')
|
||||
mw.execShell('chmod -R 755 ' + path)
|
||||
|
||||
def nginxAddDomain(self, webname, domain, port):
|
||||
file = self.getHostConf(webname)
|
||||
@@ -2182,19 +2195,16 @@ location ^~ {from} {
|
||||
return mw.returnJson(False, '您添加的域名已存在!')
|
||||
mw.M('domain').where('pid=?', (opid,)).delete()
|
||||
|
||||
self.createRootDir(self.sitePath)
|
||||
self.nginxAddConf()
|
||||
|
||||
# 添加更多域名
|
||||
for domain in siteMenu['domainlist']:
|
||||
sdomain = domain
|
||||
swebname = self.siteName
|
||||
spid = str(pid)
|
||||
self.addDomain(domain, webname, pid)
|
||||
self.addDomain(domain, self.siteName, pid)
|
||||
|
||||
mw.M('domain').add('pid,name,port,addtime',
|
||||
(pid, self.siteName, self.sitePort, mw.getDate()))
|
||||
|
||||
self.createRootDir(self.sitePath)
|
||||
self.nginxAddConf()
|
||||
|
||||
data = {}
|
||||
data['siteStatus'] = False
|
||||
mw.restartWeb()
|
||||
@@ -2350,7 +2360,9 @@ location ^~ {from} {
|
||||
return True
|
||||
|
||||
# 设置目录防御
|
||||
def setDirUserINI(self, newPath):
|
||||
def setDirUserINI(self, sitePath, runPath):
|
||||
newPath = sitePath + runPath
|
||||
|
||||
filename = newPath + '/.user.ini'
|
||||
if os.path.exists(filename):
|
||||
mw.execShell("chattr -i " + filename)
|
||||
@@ -2358,8 +2370,11 @@ location ^~ {from} {
|
||||
return mw.returnJson(True, '已清除防跨站设置!')
|
||||
|
||||
self.delUserInI(newPath)
|
||||
mw.writeFile(filename, 'open_basedir=' +
|
||||
newPath + '/:/www/server/php:/tmp/:/proc/')
|
||||
openPath = 'open_basedir={}/:{}/'.format(newPath, sitePath)
|
||||
if runPath == '/':
|
||||
openPath = 'open_basedir={}/'.format(sitePath)
|
||||
|
||||
mw.writeFile(filename, openPath + ':/www/server/php:/tmp/:/proc/')
|
||||
mw.execShell("chattr +i " + filename)
|
||||
|
||||
return mw.returnJson(True, '已打开防跨站设置!')
|
||||
|
||||
@@ -162,7 +162,7 @@ class system_api:
|
||||
except:
|
||||
port = mw.readFile('data/port.pl')
|
||||
except:
|
||||
port = '8888'
|
||||
port = '7200'
|
||||
domain = ''
|
||||
if os.path.exists('data/domain.conf'):
|
||||
domain = mw.readFile('data/domain.conf')
|
||||
@@ -201,9 +201,9 @@ class system_api:
|
||||
def getLoadAverage(self):
|
||||
c = os.getloadavg()
|
||||
data = {}
|
||||
data['one'] = float(c[0])
|
||||
data['five'] = float(c[1])
|
||||
data['fifteen'] = float(c[2])
|
||||
data['one'] = round(float(c[0]), 2)
|
||||
data['five'] = round(float(c[1]), 2)
|
||||
data['fifteen'] = round(float(c[2]), 2)
|
||||
data['max'] = psutil.cpu_count() * 2
|
||||
data['limit'] = data['max']
|
||||
data['safe'] = data['max'] * 0.75
|
||||
@@ -276,8 +276,17 @@ class system_api:
|
||||
def getCpuInfo(self, interval=1):
|
||||
# 取CPU信息
|
||||
cpuCount = psutil.cpu_count()
|
||||
cpuLogicalNum = psutil.cpu_count(logical=False)
|
||||
used = psutil.cpu_percent(interval=interval)
|
||||
return used, cpuCount
|
||||
|
||||
if os.path.exists('/proc/cpuinfo'):
|
||||
c_tmp = mw.readFile('/proc/cpuinfo')
|
||||
d_tmp = re.findall("physical id.+", c_tmp)
|
||||
cpuLogicalNum = len(set(d_tmp))
|
||||
|
||||
used_all = psutil.cpu_percent(percpu=True)
|
||||
cpu_name = mw.getCpuType() + " * {}".format(cpuLogicalNum)
|
||||
return used, cpuCount, used_all, cpu_name, cpuCount, cpuLogicalNum
|
||||
|
||||
def getMemInfo(self):
|
||||
# 取内存信息
|
||||
|
||||
@@ -681,12 +681,7 @@ def getTotalStatistics():
|
||||
data = {}
|
||||
if st.strip() == 'start':
|
||||
list_count = pQuery('select count(id) as num from repository')
|
||||
|
||||
if list_count.find("error") > -1:
|
||||
data['status'] = False
|
||||
data['count'] = 0
|
||||
return mw.returnJson(False, 'fail', data)
|
||||
|
||||
count = list_count[0]["num"]
|
||||
data['status'] = True
|
||||
data['count'] = count
|
||||
data['ver'] = mw.readFile(getServerDir() + '/version.pl').strip()
|
||||
|
||||
@@ -304,7 +304,7 @@ def getErrorLog():
|
||||
if 'close' in args:
|
||||
mw.writeFile(filename, '')
|
||||
return mw.returnJson(False, '日志已清空')
|
||||
info = mw.getNumLines(filename, 18)
|
||||
info = mw.getLastLine(filename, 18)
|
||||
return mw.returnJson(True, 'OK', info)
|
||||
|
||||
|
||||
|
||||
@@ -333,7 +333,7 @@ def getErrorLog():
|
||||
if 'close' in args:
|
||||
mw.writeFile(filename, '')
|
||||
return mw.returnJson(False, '日志已清空')
|
||||
info = mw.getNumLines(filename, 18)
|
||||
info = mw.getLastLine(filename, 18)
|
||||
return mw.returnJson(True, 'OK', info)
|
||||
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ Install_mysql()
|
||||
OPENSSL_VERSION=`openssl version|awk '{print $2}'|awk -F '.' '{print $1}'`
|
||||
if [ "${OPENSSL_VERSION}" -ge "3" ];then
|
||||
#openssl version to high
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash openssl.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash openssl.sh
|
||||
export PKG_CONFIG_PATH=$serverPath/lib/openssl/lib/pkgconfig
|
||||
OPTIONS="-DWITH_SSL=${serverPath}/lib/openssl"
|
||||
fi
|
||||
|
||||
@@ -61,7 +61,7 @@ Install_mysql()
|
||||
fi
|
||||
# ----- cpu end ------
|
||||
|
||||
cd $serverPath/mdserver-web/plugins/mysql/lib && /bin/bash rpcgen.sh
|
||||
cd ${rootPath}/plugins/mysql/lib && /bin/bash rpcgen.sh
|
||||
|
||||
if [ ! -f ${mysqlDir}/mysql-boost-${VERSION}.tar.gz ];then
|
||||
wget -O ${mysqlDir}/mysql-boost-${VERSION}.tar.gz --tries=3 https://cdn.mysql.com/Downloads/MySQL-5.7/mysql-boost-${VERSION}.tar.gz
|
||||
@@ -89,7 +89,7 @@ Install_mysql()
|
||||
OPENSSL_VERSION=`openssl version|awk '{print $2}'|awk -F '.' '{print $1}'`
|
||||
if [ "${OPENSSL_VERSION}" -ge "3" ];then
|
||||
#openssl version to high
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash openssl.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash openssl.sh
|
||||
export PKG_CONFIG_PATH=$serverPath/lib/openssl/lib/pkgconfig
|
||||
OPTIONS="-DWITH_SSL=${serverPath}/lib/openssl"
|
||||
fi
|
||||
|
||||
@@ -95,7 +95,7 @@ Install_mysql()
|
||||
fi
|
||||
# ----- cpu end ------
|
||||
|
||||
cd $serverPath/mdserver-web/plugins/mysql/lib && /bin/bash rpcgen.sh
|
||||
cd ${rootPath}/plugins/mysql/lib && /bin/bash rpcgen.sh
|
||||
|
||||
INSTALL_CMD=cmake
|
||||
# check cmake version
|
||||
@@ -132,7 +132,7 @@ Install_mysql()
|
||||
OPENSSL_VERSION=`openssl version|awk '{print $2}'|awk -F '.' '{print $1}'`
|
||||
if [ "${OPENSSL_VERSION}" -ge "3" ];then
|
||||
#openssl version to high
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash openssl.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash openssl.sh
|
||||
export PKG_CONFIG_PATH=$serverPath/lib/openssl/lib/pkgconfig
|
||||
OPTIONS="-DWITH_SSL=${serverPath}/lib/openssl"
|
||||
fi
|
||||
|
||||
@@ -24,7 +24,6 @@ else
|
||||
useradd -g www -s /bin/bash www
|
||||
fi
|
||||
|
||||
# cd /www/server/mdserver-web/plugins/openresty && /bin/bash install.sh install 1.21.4.1
|
||||
Install_openresty()
|
||||
{
|
||||
# ----- cpu start ------
|
||||
|
||||
@@ -3,18 +3,6 @@ export PATH=$PATH:/opt/local/bin:/opt/local/sbin:/opt/local/share/man:/usr/local
|
||||
DIR=$(cd "$(dirname "$0")"; pwd)
|
||||
|
||||
|
||||
|
||||
# cd /www/server/mdserver-web/scripts/quick && bash debug.sh
|
||||
# cd /www/server/mdserver-web/plugins/php && bash all_test.sh
|
||||
|
||||
|
||||
# cd /www/server/mdserver-web/plugins/php && bash install.sh install 71
|
||||
# cd /www/server/mdserver-web/plugins/php/versions/52/ && bash gd.sh install 52
|
||||
|
||||
# cd /www/server/mdserver-web/plugins/php/versions/52/ && bash openssl.sh install 52
|
||||
# cd /www/server/mdserver-web/plugins/php/versions/81/ && bash imagemagick.sh install 81
|
||||
# cd /www/server/mdserver-web/plugins/php/versions/70/ && bash imagemagick.sh install 70
|
||||
|
||||
PHP_VER=71
|
||||
echo "php${PHP_VER} -- start"
|
||||
cmd_ext=$(ls -l $DIR/versions/$PHP_VER/ |awk '{print $9}')
|
||||
|
||||
@@ -4,8 +4,8 @@ define('XHProf_Name', 'mdd');
|
||||
|
||||
/**
|
||||
* xhprof 配置,便于调试快速找到问题
|
||||
* author midoks@163.com
|
||||
*/
|
||||
|
||||
function app_xhprof_start() {
|
||||
$root = '{$ROOT_PATH}';
|
||||
$lib = $root . '/server/xhprof/xhprof_lib/utils/xhprof_lib.php';
|
||||
|
||||
@@ -10,8 +10,6 @@ rootPath=$(dirname "$rootPath")
|
||||
|
||||
# echo $rootPath
|
||||
|
||||
# cd /www/server/mdserver-web/plugins/php/lib && /bin/bash libmemcached.sh
|
||||
|
||||
SERVER_ROOT=$rootPath/lib
|
||||
SOURCE_ROOT=$rootPath/source/lib
|
||||
|
||||
|
||||
@@ -13,18 +13,6 @@ rootPath=$(dirname "$rootPath")
|
||||
SERVER_ROOT=$rootPath/lib
|
||||
SOURCE_ROOT=$rootPath/source/lib
|
||||
|
||||
# if [ ! -d ${SERVER_ROOT}/openssl ];then
|
||||
# cd ${SOURCE_ROOT}
|
||||
# if [ ! -f ${SOURCE_ROOT}/openssl-1.0.2q.tar.gz ];then
|
||||
# wget https://github.com/midoks/mdserver-web/releases/download/init/openssl-1.0.2q.tar.gz -T 20
|
||||
# fi
|
||||
# tar -zxf openssl-1.0.2q.tar.gz
|
||||
# cd openssl-1.0.2q
|
||||
# ./config --openssldir=${SERVER_ROOT}/openssl zlib-dynamic shared
|
||||
# make && make install
|
||||
# fi
|
||||
|
||||
|
||||
if [ ! -d ${SERVER_ROOT}/openssl ];then
|
||||
cd ${SOURCE_ROOT}
|
||||
if [ ! -f ${SOURCE_ROOT}/openssl-1.1.1p.tar.gz ];then
|
||||
|
||||
@@ -74,7 +74,7 @@ Install_lib()
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
if [ ! -d $sourcePath/php${version}/ext ];then
|
||||
cd $serverPath/mdserver-web/plugins/php && /bin/bash install.sh install ${version}
|
||||
cd ${rootPath}/plugins/php && /bin/bash install.sh install ${version}
|
||||
fi
|
||||
|
||||
cd $sourcePath/php${version}/ext/${LIBNAME}
|
||||
|
||||
@@ -21,7 +21,7 @@ echo "安装php-${version} ..." > $install_tmp
|
||||
mkdir -p $sourcePath/php
|
||||
mkdir -p $serverPath/php
|
||||
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash zlib.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh
|
||||
|
||||
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
|
||||
if [ ! -f $sourcePath/php/php-${version}.tar.gz ];then
|
||||
@@ -131,7 +131,6 @@ fi
|
||||
# ps -ef|grep php/52 |grep -v grep |awk '{print $2}'|xargs kill
|
||||
# /www/server/php/init.d/php52 start
|
||||
# /www/server/php/52/sbin/php-fpm start
|
||||
# cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/php/index.py start 52
|
||||
mkdir -p $serverPath/php/${PHP_VER}/var/log
|
||||
mkdir -p $serverPath/php/${PHP_VER}/var/run
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ Install_lib()
|
||||
return
|
||||
fi
|
||||
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash icu.sh
|
||||
cd $rootPath/plugins/php/lib && /bin/bash icu.sh
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ echo "安装php-5.3.29 ..." > $install_tmp
|
||||
mkdir -p $sourcePath/php
|
||||
mkdir -p $serverPath/php
|
||||
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash zlib.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh
|
||||
|
||||
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
|
||||
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
|
||||
|
||||
@@ -40,7 +40,7 @@ Install_lib()
|
||||
php_lib=$sourcePath/php_lib
|
||||
mkdir -p $php_lib
|
||||
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash icu.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash icu.sh
|
||||
|
||||
wget -O $php_lib/${LIBNAME}-${LIBV}.tgz http://pecl.php.net/get/${LIBNAME}-${LIBV}.tgz
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ mkdir -p $sourcePath/php
|
||||
mkdir -p $serverPath/php
|
||||
|
||||
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash zlib.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh
|
||||
|
||||
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
|
||||
if [ ! -f $sourcePath/php/php-${version}.tar.gz ];then
|
||||
|
||||
@@ -19,8 +19,8 @@ echo "安装php-5.5.38 ..." > $install_tmp
|
||||
mkdir -p $sourcePath/php
|
||||
mkdir -p $serverPath/php
|
||||
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash freetype_old.sh
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash zlib.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash freetype_old.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh
|
||||
|
||||
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
|
||||
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
|
||||
|
||||
@@ -19,8 +19,8 @@ echo "安装php-${version} ..." > $install_tmp
|
||||
mkdir -p $sourcePath/php
|
||||
mkdir -p $serverPath/php
|
||||
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash freetype_old.sh
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash zlib.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash freetype_old.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh
|
||||
|
||||
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
|
||||
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
|
||||
|
||||
@@ -19,8 +19,8 @@ echo "安装php-${version} ..." > $install_tmp
|
||||
mkdir -p $sourcePath/php
|
||||
mkdir -p $serverPath/php
|
||||
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash freetype_old.sh
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash zlib.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash freetype_old.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh
|
||||
|
||||
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
|
||||
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
|
||||
|
||||
@@ -19,8 +19,8 @@ echo "安装php-${version} ..." > $install_tmp
|
||||
mkdir -p $sourcePath/php
|
||||
mkdir -p $serverPath/php
|
||||
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash freetype_old.sh
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash zlib.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash freetype_old.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh
|
||||
|
||||
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
|
||||
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
|
||||
|
||||
@@ -44,7 +44,7 @@ Install_lib()
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
if [ ! -d $sourcePath/php${version}/ext ];then
|
||||
cd $serverPath/mdserver-web/plugins/php && /bin/bash install.sh install ${version}
|
||||
cd ${rootPath}/plugins/php && /bin/bash install.sh install ${version}
|
||||
fi
|
||||
|
||||
cd $sourcePath/php${version}/ext/${LIBNAME}
|
||||
|
||||
@@ -20,8 +20,8 @@ echo "安装php-${version} ..." > $install_tmp
|
||||
mkdir -p $sourcePath/php
|
||||
mkdir -p $serverPath/php
|
||||
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash freetype_old.sh
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash zlib.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash freetype_old.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh
|
||||
|
||||
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
|
||||
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
|
||||
|
||||
@@ -24,8 +24,8 @@ echo "安装php-${version} ..." > $install_tmp
|
||||
mkdir -p $sourcePath/php
|
||||
mkdir -p $serverPath/php
|
||||
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash freetype_old.sh
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash zlib.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash freetype_old.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh
|
||||
|
||||
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
|
||||
|
||||
|
||||
@@ -25,9 +25,9 @@ echo "安装php-${version} ..." > $install_tmp
|
||||
mkdir -p $sourcePath/php
|
||||
mkdir -p $serverPath/php
|
||||
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash freetype_new.sh
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash zlib.sh
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash libzip.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash freetype_new.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash libzip.sh
|
||||
|
||||
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ function version_lt() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)"
|
||||
function version_ge() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" == "$1"; }
|
||||
|
||||
|
||||
version=8.0.22
|
||||
version=8.0.23
|
||||
PHP_VER=80
|
||||
Install_php()
|
||||
{
|
||||
@@ -25,8 +25,8 @@ echo "安装php-${version} ..." > $install_tmp
|
||||
mkdir -p $sourcePath/php
|
||||
mkdir -p $serverPath/php
|
||||
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash freetype_new.sh
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash zlib.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash freetype_new.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh
|
||||
|
||||
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ function version_lt() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)"
|
||||
function version_ge() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" == "$1"; }
|
||||
|
||||
|
||||
version=8.1.9
|
||||
version=8.1.10
|
||||
PHP_VER=81
|
||||
Install_php()
|
||||
{
|
||||
@@ -25,8 +25,8 @@ echo "安装php-${version} ..." > $install_tmp
|
||||
mkdir -p $sourcePath/php
|
||||
mkdir -p $serverPath/php
|
||||
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash freetype_new.sh
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash zlib.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash freetype_new.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh
|
||||
|
||||
|
||||
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
|
||||
|
||||
@@ -16,7 +16,7 @@ function version_lt() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)"
|
||||
function version_ge() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" == "$1"; }
|
||||
|
||||
|
||||
version=8.2.0beta3
|
||||
version=8.2.0RC2
|
||||
PHP_VER=82
|
||||
Install_php()
|
||||
{
|
||||
@@ -25,14 +25,14 @@ echo "安装php-${version} ..." > $install_tmp
|
||||
mkdir -p $sourcePath/php
|
||||
mkdir -p $serverPath/php
|
||||
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash freetype_new.sh
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash zlib.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash freetype_new.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh
|
||||
|
||||
|
||||
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
|
||||
|
||||
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
|
||||
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://downloads.php.net/~pierrick/php-8.2.0alpha2.tar.xz
|
||||
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://downloads.php.net/~sergey/php-${version}.tar.xz
|
||||
fi
|
||||
|
||||
cd $sourcePath/php && tar -Jxf $sourcePath/php/php-${version}.tar.xz
|
||||
|
||||
@@ -49,7 +49,7 @@ Install_lib()
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
if [ ! -d $sourcePath/php${version}/ext ];then
|
||||
cd $serverPath/mdserver-web/plugins/php && /bin/bash install.sh install ${version}
|
||||
cd ${rootPath}/plugins/php && /bin/bash install.sh install ${version}
|
||||
fi
|
||||
|
||||
cd $sourcePath/php${version}/ext/${LIBNAME}
|
||||
|
||||
@@ -52,7 +52,7 @@ Install_lib()
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
if [ ! -d $sourcePath/php${version}/ext ];then
|
||||
cd $serverPath/mdserver-web/plugins/php && /bin/bash install.sh install ${version}
|
||||
cd ${rootPath}/plugins/php && /bin/bash install.sh install ${version}
|
||||
fi
|
||||
|
||||
cd $sourcePath/php${version}/ext/${LIBNAME}
|
||||
|
||||
@@ -49,7 +49,7 @@ Install_lib()
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
if [ ! -d $sourcePath/php${version}/ext ];then
|
||||
cd $serverPath/mdserver-web/plugins/php && /bin/bash install.sh install ${version}
|
||||
cd ${rootPath}/plugins/php && /bin/bash install.sh install ${version}
|
||||
fi
|
||||
|
||||
cd $sourcePath/php${version}/ext/${LIBNAME}
|
||||
|
||||
@@ -52,7 +52,7 @@ Install_lib()
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
if [ ! -d $sourcePath/php${version}/ext ];then
|
||||
cd $serverPath/mdserver-web/plugins/php && /bin/bash install.sh install ${version}
|
||||
cd ${rootPath}/plugins/php && /bin/bash install.sh install ${version}
|
||||
fi
|
||||
|
||||
cd $sourcePath/php${version}/ext/${LIBNAME}
|
||||
|
||||
@@ -40,7 +40,7 @@ else
|
||||
fi
|
||||
|
||||
|
||||
# cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash freetype_old.sh
|
||||
# cd ${rootPath}/plugins/php/lib && /bin/bash freetype_old.sh
|
||||
# OPTIONS="${OPTIONS} --with-freetype-dir=${serverPath}/lib/freetype_old"
|
||||
# OPTIONS="${OPTIONS} --with-gd --enable-gd-native-ttf"
|
||||
# OPTIONS="${OPTIONS} --with-jpeg --with-jpeg-dir=/usr/lib"
|
||||
@@ -55,12 +55,12 @@ Install_lib()
|
||||
return
|
||||
fi
|
||||
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash freetype_old.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash freetype_old.sh
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
if [ ! -d $sourcePath/php${version}/ext ];then
|
||||
cd $serverPath/mdserver-web/plugins/php && /bin/bash install.sh install ${version}
|
||||
cd ${rootPath}/plugins/php && /bin/bash install.sh install ${version}
|
||||
fi
|
||||
|
||||
cd $sourcePath/php${version}/ext/${LIBNAME}
|
||||
|
||||
Executable
+108
@@ -0,0 +1,108 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
|
||||
curPath=`pwd`
|
||||
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
sourcePath=${serverPath}/source/php
|
||||
|
||||
actionType=$1
|
||||
version=$2
|
||||
|
||||
LIBNAME=gettext
|
||||
LIBV=0
|
||||
|
||||
LIB_PATH_NAME=lib/php
|
||||
if [ -d $serverPath/php/${version}/lib64 ];then
|
||||
LIB_PATH_NAME=lib64
|
||||
fi
|
||||
|
||||
NON_ZTS_FILENAME=`ls $serverPath/php/${version}/${LIB_PATH_NAME}/extensions | grep no-debug-non-zts`
|
||||
extFile=$serverPath/php/${version}/${LIB_PATH_NAME}/extensions/${NON_ZTS_FILENAME}/${LIBNAME}.so
|
||||
|
||||
sysName=`uname`
|
||||
if [ "$sysName" == "Darwin" ];then
|
||||
BAK='_bak'
|
||||
else
|
||||
BAK=''
|
||||
fi
|
||||
|
||||
Install_lib()
|
||||
{
|
||||
|
||||
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
|
||||
if [ "${isInstall}" != "" ];then
|
||||
echo "php-$version 已安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
if [ ! -d $sourcePath/php${version}/ext ];then
|
||||
cd ${rootPath}/plugins/php && /bin/bash install.sh install ${version}
|
||||
fi
|
||||
|
||||
cd $sourcePath/php${version}/ext/${LIBNAME}
|
||||
|
||||
$serverPath/php/$version/bin/phpize
|
||||
./configure --with-php-config=$serverPath/php/$version/bin/php-config
|
||||
|
||||
FIND_C99=`cat Makefile|grep c99`
|
||||
if [ "$FIND_C99" == "" ];then
|
||||
sed -i $BAK 's/CFLAGS \=/CFLAGS \= -std=c99/g' Makefile
|
||||
fi
|
||||
|
||||
make clean && make && make install && make clean
|
||||
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "ERROR!"
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
echo "" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
|
||||
|
||||
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
|
||||
echo '==========================================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
Uninstall_lib()
|
||||
{
|
||||
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
|
||||
echo "php-$version 未安装,请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "php-$version 未安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
echo $serverPath/php/$version/etc/php.ini
|
||||
sed -i $BAK "/${LIBNAME}.so/d" $serverPath/php/$version/etc/php.ini
|
||||
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
|
||||
|
||||
rm -f $extFile
|
||||
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
|
||||
echo '==============================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
|
||||
if [ "$actionType" == 'install' ];then
|
||||
Install_lib
|
||||
elif [ "$actionType" == 'uninstall' ];then
|
||||
Uninstall_lib
|
||||
fi
|
||||
@@ -45,12 +45,12 @@ Install_lib()
|
||||
return
|
||||
fi
|
||||
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash libiconv.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash libiconv.sh
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
if [ ! -d $sourcePath/php${version}/ext ];then
|
||||
cd $serverPath/mdserver-web/plugins/php && /bin/bash install.sh install ${version}
|
||||
cd ${rootPath}/plugins/php && /bin/bash install.sh install ${version}
|
||||
fi
|
||||
|
||||
cd $sourcePath/php${version}/ext/${LIBNAME}
|
||||
|
||||
@@ -34,7 +34,7 @@ fi
|
||||
|
||||
OPTIONS=''
|
||||
if [ "$version" -lt "71" ];then
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash icu.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash icu.sh
|
||||
OPTIONS="--with-icu-dir=${serverPath}/lib/icu"
|
||||
fi
|
||||
|
||||
@@ -51,7 +51,7 @@ Install_lib()
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
if [ ! -d $sourcePath/php${version}/ext ];then
|
||||
cd $serverPath/mdserver-web/plugins/php && /bin/bash install.sh install ${version}
|
||||
cd ${rootPath}/plugins/php && /bin/bash install.sh install ${version}
|
||||
fi
|
||||
|
||||
cd $sourcePath/php${version}/ext/${LIBNAME}
|
||||
|
||||
@@ -46,7 +46,7 @@ Install_lib()
|
||||
return
|
||||
fi
|
||||
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && bash libmcrypt.sh
|
||||
cd ${rootPath}/plugins/php/lib && bash libmcrypt.sh
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
|
||||
@@ -41,15 +41,15 @@ Install_lib()
|
||||
return
|
||||
fi
|
||||
|
||||
# cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash openssl_10.sh
|
||||
# cd ${rootPath}/plugins/php/lib && /bin/bash openssl_10.sh
|
||||
if [ "$version" -lt "70" ];then
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash openssl_10.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash openssl_10.sh
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
if [ ! -d $sourcePath/php${version}/ext ];then
|
||||
cd $serverPath/mdserver-web/plugins/php && /bin/bash install.sh install ${version}
|
||||
cd ${rootPath}/plugins/php && /bin/bash install.sh install ${version}
|
||||
fi
|
||||
|
||||
cd $sourcePath/php${version}/ext/${LIBNAME}
|
||||
|
||||
@@ -44,7 +44,7 @@ Install_lib()
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
if [ ! -d $sourcePath/php${version}/ext ];then
|
||||
cd $serverPath/mdserver-web/plugins/php && /bin/bash install.sh install ${version}
|
||||
cd ${rootPath}/plugins/php && /bin/bash install.sh install ${version}
|
||||
fi
|
||||
|
||||
cd $sourcePath/php${version}/ext/${LIBNAME}
|
||||
|
||||
@@ -54,7 +54,7 @@ Install_lib()
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
if [ ! -d $sourcePath/php${version}/ext ];then
|
||||
cd $serverPath/mdserver-web/plugins/php && /bin/bash install.sh install ${version}
|
||||
cd ${rootPath}/plugins/php && /bin/bash install.sh install ${version}
|
||||
fi
|
||||
|
||||
cd $sourcePath/php${version}/ext/${LIBNAME}
|
||||
|
||||
@@ -46,7 +46,7 @@ Install_lib()
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
if [ ! -d $sourcePath/php${version}/ext ];then
|
||||
cd $serverPath/mdserver-web/plugins/php && /bin/bash install.sh install ${version}
|
||||
cd ${rootPath}/plugins/php && /bin/bash install.sh install ${version}
|
||||
fi
|
||||
|
||||
cd $sourcePath/php${version}/ext/${LIBNAME}
|
||||
|
||||
@@ -219,6 +219,28 @@
|
||||
"shell": "igbinary.sh",
|
||||
"check": "igbinary.so"
|
||||
},
|
||||
{
|
||||
"name": "gettext",
|
||||
"versions": [
|
||||
"52",
|
||||
"53",
|
||||
"54",
|
||||
"55",
|
||||
"56",
|
||||
"70",
|
||||
"71",
|
||||
"72",
|
||||
"73",
|
||||
"74",
|
||||
"80",
|
||||
"81",
|
||||
"82"
|
||||
],
|
||||
"type": "通用扩展",
|
||||
"msg": "国际化与本地化!",
|
||||
"shell": "gettext.sh",
|
||||
"check": "gettext.so"
|
||||
},
|
||||
{
|
||||
"name": "gd",
|
||||
"versions": [
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
daemonize yes
|
||||
pidfile {$SERVER_PATH}/redis/redis_6379.pid
|
||||
|
||||
bind 127.0.0.1
|
||||
port 6379
|
||||
requirepass admin
|
||||
|
||||
timeout 0
|
||||
tcp-keepalive 0
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
<div class="bt-form">
|
||||
<div class='plugin_version'></div>
|
||||
<div class="bt-w-main">
|
||||
<div class="bt-w-menu">
|
||||
<p class="bgw" onclick="pluginService('redis');">服务</p>
|
||||
<p onclick="pluginInitD('redis');">自启动</p>
|
||||
<p onclick="pluginConfig('redis');">配置修改</p>
|
||||
<p onclick="redisStatus();">负载状态</p>
|
||||
<p onclick="getRedisConfig($('.plugin_version').attr('version'));">性能调整</p>
|
||||
<p onclick="redisStatus($('.plugin_version').attr('version'));">负载状态</p>
|
||||
<p onclick="pluginLogs('redis','','run_log');">日志</p>
|
||||
</div>
|
||||
<div class="bt-w-con pd15">
|
||||
@@ -13,42 +15,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
pluginService('redis');
|
||||
|
||||
//redis负载状态 start
|
||||
function redisStatus() {
|
||||
var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 });
|
||||
$.post('/plugins/run', {name:'redis', func:'run_info'}, function(data) {
|
||||
layer.close(loadT);
|
||||
if (!data.status){
|
||||
layer.msg(data.msg,{icon:0,time:2000,shade: [0.3, '#000']});
|
||||
return;
|
||||
}
|
||||
|
||||
var rdata = $.parseJSON(data.data);
|
||||
hit = (parseInt(rdata.keyspace_hits) / (parseInt(rdata.keyspace_hits) + parseInt(rdata.keyspace_misses)) * 100).toFixed(2);
|
||||
var Con = '<div class="divtable">\
|
||||
<table class="table table-hover table-bordered" style="width: 490px;">\
|
||||
<thead><th>字段</th><th>当前值</th><th>说明</th></thead>\
|
||||
<tbody>\
|
||||
<tr><th>uptime_in_days</th><td>' + rdata.uptime_in_days + '</td><td>已运行天数</td></tr>\
|
||||
<tr><th>tcp_port</th><td>' + rdata.tcp_port + '</td><td>当前监听端口</td></tr>\
|
||||
<tr><th>connected_clients</th><td>' + rdata.connected_clients + '</td><td>连接的客户端数量</td></tr>\
|
||||
<tr><th>used_memory_rss</th><td>' + toSize(rdata.used_memory_rss) + '</td><td>Redis当前占用的系统内存总量</td></tr>\
|
||||
<tr><th>used_memory</th><td>' + toSize(rdata.used_memory) + '</td><td>Redis当前已分配的内存总量</td></tr>\
|
||||
<tr><th>used_memory_peak</th><td>' + toSize(rdata.used_memory_peak) + '</td><td>Redis历史分配内存的峰值</td></tr>\
|
||||
<tr><th>mem_fragmentation_ratio</th><td>' + rdata.mem_fragmentation_ratio + '%</td><td>内存碎片比率</td></tr>\
|
||||
<tr><th>total_connections_received</th><td>' + rdata.total_connections_received + '</td><td>运行以来连接过的客户端的总数量</td></tr>\
|
||||
<tr><th>total_commands_processed</th><td>' + rdata.total_commands_processed + '</td><td>运行以来执行过的命令的总数量</td></tr>\
|
||||
<tr><th>instantaneous_ops_per_sec</th><td>' + rdata.instantaneous_ops_per_sec + '</td><td>服务器每秒钟执行的命令数量</td></tr>\
|
||||
<tr><th>keyspace_hits</th><td>' + rdata.keyspace_hits + '</td><td>查找数据库键成功的次数</td></tr>\
|
||||
<tr><th>keyspace_misses</th><td>' + rdata.keyspace_misses + '</td><td>查找数据库键失败的次数</td></tr>\
|
||||
<tr><th>hit</th><td>' + hit + '%</td><td>查找数据库键命中率</td></tr>\
|
||||
<tr><th>latest_fork_usec</th><td>' + rdata.latest_fork_usec + '</td><td>最近一次 fork() 操作耗费的微秒数</td></tr>\
|
||||
<tbody>\
|
||||
</table></div>'
|
||||
$(".soft-man-con").html(Con);
|
||||
},'json');
|
||||
}
|
||||
//redis负载状态 end
|
||||
$.getScript( "/plugins/file?name=redis&f=js/redis.js", function(){
|
||||
pluginService('redis', $('.plugin_version').attr('version'));
|
||||
});
|
||||
</script>
|
||||
+81
-2
@@ -4,6 +4,7 @@ import sys
|
||||
import io
|
||||
import os
|
||||
import time
|
||||
import re
|
||||
|
||||
sys.path.append(os.getcwd() + "/class/core")
|
||||
import mw
|
||||
@@ -47,7 +48,7 @@ def getInitDTpl():
|
||||
|
||||
|
||||
def getArgs():
|
||||
args = sys.argv[2:]
|
||||
args = sys.argv[3:]
|
||||
tmp = {}
|
||||
args_len = len(args)
|
||||
|
||||
@@ -153,7 +154,19 @@ def reload():
|
||||
|
||||
|
||||
def runInfo():
|
||||
requirepass = ""
|
||||
|
||||
conf = getServerDir() + '/redis.conf'
|
||||
content = mw.readFile(conf)
|
||||
rep = "^(requirepass" + ')\s*([.0-9A-Za-z_& ~]+)'
|
||||
tmp = re.search(rep, content, re.M)
|
||||
if tmp:
|
||||
requirepass = tmp.groups()[1]
|
||||
|
||||
cmd = getServerDir() + "/bin/redis-cli info"
|
||||
if requirepass != "":
|
||||
cmd = getServerDir() + '/bin/redis-cli -a "' + requirepass + '" info'
|
||||
|
||||
data = mw.execShell(cmd)[0]
|
||||
res = [
|
||||
'tcp_port',
|
||||
@@ -202,7 +215,6 @@ def initdInstall():
|
||||
|
||||
|
||||
def initdUinstall():
|
||||
|
||||
if mw.isAppleSystem():
|
||||
return "Apple Computer does not support"
|
||||
|
||||
@@ -213,6 +225,69 @@ def initdUinstall():
|
||||
def runLog():
|
||||
return getServerDir() + '/data/redis.log'
|
||||
|
||||
|
||||
def getRedisConfInfo():
|
||||
conf = getServerDir() + '/redis.conf'
|
||||
content = mw.readFile(conf)
|
||||
|
||||
gets = [
|
||||
{'name': 'bind', 'type': 2, 'ps': '绑定IP(修改绑定IP可能会存在安全隐患)'},
|
||||
{'name': 'port', 'type': 2, 'ps': '绑定端口'},
|
||||
{'name': 'timeout', 'type': 2, 'ps': '空闲链接超时时间,0表示不断开'},
|
||||
{'name': 'maxclients', 'type': 2, 'ps': '最大输入时间'},
|
||||
{'name': 'databases', 'type': 2, 'ps': '数据库数量'},
|
||||
{'name': 'requirepass', 'type': 2, 'ps': 'redis密码,留空代表没有设置密码'},
|
||||
{'name': 'maxmemory', 'type': 2, 'ps': 'MB,最大使用内存,0表示不限制'}
|
||||
]
|
||||
content = mw.readFile(conf)
|
||||
|
||||
result = []
|
||||
for g in gets:
|
||||
rep = "^(" + g['name'] + ')\s*([.0-9A-Za-z_& ~]+)'
|
||||
tmp = re.search(rep, content, re.M)
|
||||
if not tmp:
|
||||
g['value'] = ''
|
||||
result.append(g)
|
||||
continue
|
||||
g['value'] = tmp.groups()[1]
|
||||
if g['name'] == 'maxmemory':
|
||||
g['value'] = g['value'].strip("mb")
|
||||
result.append(g)
|
||||
|
||||
return result
|
||||
|
||||
|
||||
def getRedisConf():
|
||||
data = getRedisConfInfo()
|
||||
return mw.getJson(data)
|
||||
|
||||
|
||||
def submitRedisConf():
|
||||
gets = ['bind', 'port', 'timeout', 'maxclients',
|
||||
'databases', 'requirepass', 'maxmemory']
|
||||
args = getArgs()
|
||||
conf = getServerDir() + '/redis.conf'
|
||||
content = mw.readFile(conf)
|
||||
for g in gets:
|
||||
if g in args:
|
||||
rep = g + '\s*([.0-9A-Za-z_& ~]+)'
|
||||
val = g + ' ' + args[g]
|
||||
|
||||
if g == 'maxmemory':
|
||||
val = g + ' ' + args[g] + "mb"
|
||||
|
||||
if g == 'requirepass' and args[g] == '':
|
||||
content = re.sub('requirepass', '#requirepass', content)
|
||||
if g == 'requirepass' and args[g] != '':
|
||||
content = re.sub('#requirepass', 'requirepass', content)
|
||||
content = re.sub(rep, val, content)
|
||||
|
||||
if g != 'requirepass':
|
||||
content = re.sub(rep, val, content)
|
||||
mw.writeFile(conf, content)
|
||||
reload()
|
||||
return mw.returnJson(True, '设置成功')
|
||||
|
||||
if __name__ == "__main__":
|
||||
func = sys.argv[1]
|
||||
if func == 'status':
|
||||
@@ -237,5 +312,9 @@ if __name__ == "__main__":
|
||||
print(getConf())
|
||||
elif func == 'run_log':
|
||||
print(runLog())
|
||||
elif func == 'get_redis_conf':
|
||||
print(getRedisConf())
|
||||
elif func == 'submit_redis_conf':
|
||||
print(submitRedisConf())
|
||||
else:
|
||||
print('error')
|
||||
|
||||
Executable
+149
@@ -0,0 +1,149 @@
|
||||
|
||||
function str2Obj(str){
|
||||
var data = {};
|
||||
kv = str.split('&');
|
||||
for(i in kv){
|
||||
v = kv[i].split('=');
|
||||
data[v[0]] = v[1];
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
function redisPost(method, version, args,callback){
|
||||
var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 });
|
||||
|
||||
var req_data = {};
|
||||
req_data['name'] = 'redis';
|
||||
req_data['func'] = method;
|
||||
req_data['version'] = version;
|
||||
|
||||
if (typeof(args) == 'string'){
|
||||
req_data['args'] = JSON.stringify(str2Obj(args));
|
||||
} else {
|
||||
req_data['args'] = JSON.stringify(args);
|
||||
}
|
||||
|
||||
$.post('/plugins/run', req_data, function(data) {
|
||||
layer.close(loadT);
|
||||
if (!data.status){
|
||||
//错误展示10S
|
||||
layer.msg(data.msg,{icon:0,time:2000,shade: [10, '#000']});
|
||||
return;
|
||||
}
|
||||
|
||||
if(typeof(callback) == 'function'){
|
||||
callback(data);
|
||||
}
|
||||
},'json');
|
||||
}
|
||||
|
||||
function redisPostCallbak(method, version, args,callback){
|
||||
var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 });
|
||||
|
||||
var req_data = {};
|
||||
req_data['name'] = 'redis';
|
||||
req_data['func'] = method;
|
||||
args['version'] = version;
|
||||
|
||||
if (typeof(args) == 'string'){
|
||||
req_data['args'] = JSON.stringify(str2Obj(args));
|
||||
} else {
|
||||
req_data['args'] = JSON.stringify(args);
|
||||
}
|
||||
|
||||
$.post('/plugins/callback', req_data, function(data) {
|
||||
layer.close(loadT);
|
||||
if (!data.status){
|
||||
layer.msg(data.msg,{icon:0,time:2000,shade: [0.3, '#000']});
|
||||
return;
|
||||
}
|
||||
|
||||
if(typeof(callback) == 'function'){
|
||||
callback(data);
|
||||
}
|
||||
},'json');
|
||||
}
|
||||
|
||||
//redis负载状态 start
|
||||
function redisStatus(version) {
|
||||
|
||||
redisPost('run_info',version, {},function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
hit = (parseInt(rdata.keyspace_hits) / (parseInt(rdata.keyspace_hits) + parseInt(rdata.keyspace_misses)) * 100).toFixed(2);
|
||||
var con = '<div class="divtable">\
|
||||
<table class="table table-hover table-bordered" style="width: 490px;">\
|
||||
<thead><th>字段</th><th>当前值</th><th>说明</th></thead>\
|
||||
<tbody>\
|
||||
<tr><th>uptime_in_days</th><td>' + rdata.uptime_in_days + '</td><td>已运行天数</td></tr>\
|
||||
<tr><th>tcp_port</th><td>' + rdata.tcp_port + '</td><td>当前监听端口</td></tr>\
|
||||
<tr><th>connected_clients</th><td>' + rdata.connected_clients + '</td><td>连接的客户端数量</td></tr>\
|
||||
<tr><th>used_memory_rss</th><td>' + toSize(rdata.used_memory_rss) + '</td><td>Redis当前占用的系统内存总量</td></tr>\
|
||||
<tr><th>used_memory</th><td>' + toSize(rdata.used_memory) + '</td><td>Redis当前已分配的内存总量</td></tr>\
|
||||
<tr><th>used_memory_peak</th><td>' + toSize(rdata.used_memory_peak) + '</td><td>Redis历史分配内存的峰值</td></tr>\
|
||||
<tr><th>mem_fragmentation_ratio</th><td>' + rdata.mem_fragmentation_ratio + '%</td><td>内存碎片比率</td></tr>\
|
||||
<tr><th>total_connections_received</th><td>' + rdata.total_connections_received + '</td><td>运行以来连接过的客户端的总数量</td></tr>\
|
||||
<tr><th>total_commands_processed</th><td>' + rdata.total_commands_processed + '</td><td>运行以来执行过的命令的总数量</td></tr>\
|
||||
<tr><th>instantaneous_ops_per_sec</th><td>' + rdata.instantaneous_ops_per_sec + '</td><td>服务器每秒钟执行的命令数量</td></tr>\
|
||||
<tr><th>keyspace_hits</th><td>' + rdata.keyspace_hits + '</td><td>查找数据库键成功的次数</td></tr>\
|
||||
<tr><th>keyspace_misses</th><td>' + rdata.keyspace_misses + '</td><td>查找数据库键失败的次数</td></tr>\
|
||||
<tr><th>hit</th><td>' + hit + '%</td><td>查找数据库键命中率</td></tr>\
|
||||
<tr><th>latest_fork_usec</th><td>' + rdata.latest_fork_usec + '</td><td>最近一次 fork() 操作耗费的微秒数</td></tr>\
|
||||
<tbody>\
|
||||
</table></div>';
|
||||
$(".soft-man-con").html(con);
|
||||
});
|
||||
}
|
||||
//redis负载状态 end
|
||||
|
||||
//配置修改
|
||||
function getRedisConfig(version) {
|
||||
redisPost('get_redis_conf', version,'',function(data){
|
||||
// console.log(data);
|
||||
var rdata = $.parseJSON(data.data);
|
||||
// console.log(rdata);
|
||||
var mlist = '';
|
||||
for (var i = 0; i < rdata.length; i++) {
|
||||
var w = '70'
|
||||
if (rdata[i].name == 'error_reporting') w = '250';
|
||||
var ibody = '<input style="width: ' + w + 'px;" class="bt-input-text mr5" name="' + rdata[i].name + '" value="' + rdata[i].value + '" type="text" >';
|
||||
switch (rdata[i].type) {
|
||||
case 0:
|
||||
var selected_1 = (rdata[i].value == 1) ? 'selected' : '';
|
||||
var selected_0 = (rdata[i].value == 0) ? 'selected' : '';
|
||||
ibody = '<select class="bt-input-text mr5" name="' + rdata[i].name + '" style="width: ' + w + 'px;"><option value="1" ' + selected_1 + '>开启</option><option value="0" ' + selected_0 + '>关闭</option></select>'
|
||||
break;
|
||||
case 1:
|
||||
var selected_1 = (rdata[i].value == 'On') ? 'selected' : '';
|
||||
var selected_0 = (rdata[i].value == 'Off') ? 'selected' : '';
|
||||
ibody = '<select class="bt-input-text mr5" name="' + rdata[i].name + '" style="width: ' + w + 'px;"><option value="On" ' + selected_1 + '>开启</option><option value="Off" ' + selected_0 + '>关闭</option></select>'
|
||||
break;
|
||||
}
|
||||
mlist += '<p><span>' + rdata[i].name + '</span>' + ibody + ', <font>' + rdata[i].ps + '</font></p>'
|
||||
}
|
||||
var phpCon = '<style>.conf_p p{margin-bottom: 2px}</style><div class="conf_p" style="margin-bottom:0">' + mlist + '\
|
||||
<div style="margin-top:10px; padding-right:15px" class="text-right"><button class="btn btn-success btn-sm mr5" onclick="getRedisConfig(\'' + version + '\')">刷新</button>\
|
||||
<button class="btn btn-success btn-sm" onclick="submitConf(\'' + version + '\')">保存</button></div>\
|
||||
</div>'
|
||||
$(".soft-man-con").html(phpCon);
|
||||
});
|
||||
}
|
||||
|
||||
//提交PHP配置
|
||||
function submitConf(version) {
|
||||
var data = {
|
||||
version: version,
|
||||
bind: $("input[name='bind']").val(),
|
||||
'port': $("input[name='port']").val(),
|
||||
'timeout': $("input[name='timeout']").val(),
|
||||
maxclients: $("input[name='maxclients']").val(),
|
||||
databases: $("input[name='databases']").val(),
|
||||
requirepass: $("input[name='requirepass']").val(),
|
||||
maxmemory: $("input[name='maxmemory']").val(),
|
||||
};
|
||||
|
||||
redisPost('submit_redis_conf', version, data, function(ret_data){
|
||||
var rdata = $.parseJSON(ret_data.data);
|
||||
layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 });
|
||||
});
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
"shell":"install.sh",
|
||||
"checks":"server/rsyncd",
|
||||
"path": "server/rsyncd",
|
||||
"author":"midoks",
|
||||
"author":"samba",
|
||||
"home":"https://rsync.samba.org/",
|
||||
"date":"2019-03-05",
|
||||
"pid":"4"
|
||||
|
||||
@@ -103,7 +103,7 @@ def initDreplace():
|
||||
mw.writeFile(conf, conf_content)
|
||||
|
||||
if os.path.exists(systemDir) and not os.path.exists(systemService):
|
||||
activate_file = mw.getServerDir() + '/mdserver-web/bin/activate'
|
||||
activate_file = mw.getRunDir() + '/bin/activate'
|
||||
if os.path.exists(activate_file):
|
||||
supervisord_bin = mw.execShell(
|
||||
'source ' + activate_file + '&& which supervisord')[0].strip()
|
||||
@@ -472,7 +472,7 @@ def readConfigLogTpl():
|
||||
stdout_logfile = line.strip().split('=')[1]
|
||||
|
||||
if stdout_logfile != '':
|
||||
data = mw.getNumLines(stdout_logfile, int(line_log))
|
||||
data = mw.getLastLine(stdout_logfile, int(line_log))
|
||||
return mw.returnJson(True, 'OK', data)
|
||||
return mw.returnJson(False, 'OK', '')
|
||||
|
||||
@@ -494,7 +494,7 @@ def readConfigLogErrorTpl():
|
||||
stderr_logfile = line.strip().split('=')[1]
|
||||
|
||||
if stderr_logfile != '':
|
||||
data = mw.getNumLines(stderr_logfile, int(line_log))
|
||||
data = mw.getLastLine(stderr_logfile, int(line_log))
|
||||
return mw.returnJson(True, 'OK', data)
|
||||
return mw.returnJson(False, 'OK', '')
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
"checks": "server/swap",
|
||||
"path": "server/swap",
|
||||
"display": 1,
|
||||
"author": "midoks",
|
||||
"author": "swap",
|
||||
"date": "2021-01-29",
|
||||
"home": "swap",
|
||||
"type": 0,
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
"shell":"install.sh",
|
||||
"checks":"server/webssh",
|
||||
"path": "server/webssh",
|
||||
"author":"midoks",
|
||||
"author":"ssh",
|
||||
"home":"",
|
||||
"date":"2018-12-20",
|
||||
"pid":"4"
|
||||
|
||||
@@ -61,7 +61,7 @@ def createBgTask():
|
||||
import crontab_api
|
||||
api = crontab_api.crontab_api()
|
||||
|
||||
cmd = "cd " + mw.getServerDir() + "/mdserver-web && nice -n 10 python3 " + \
|
||||
cmd = "cd " + mw.getRunDir() + " && nice -n 10 python3 " + \
|
||||
getPluginDir() + "/tool_task.py execute"
|
||||
params = {
|
||||
'name': name,
|
||||
|
||||
@@ -26,13 +26,26 @@ function closePanel(){
|
||||
}}, function() {
|
||||
$.post('/config/close_panel','',function(rdata){
|
||||
layer.msg(rdata.msg,{icon:rdata.status?1:2});
|
||||
setTimeout(function(){window.location.reload();},1000);
|
||||
setTimeout(function(){
|
||||
window.location.reload();
|
||||
},1000);
|
||||
},'json');
|
||||
},function(){
|
||||
$("#closePl").prop("checked",false);
|
||||
});
|
||||
}
|
||||
|
||||
//开发模式
|
||||
function debugMode(){
|
||||
var loadT = layer.msg('正在发送请求,请稍候...', { icon: 16, time: 0, shade: [0.3, '#000'] });
|
||||
$.post('/config/open_debug', {}, function (rdata) {
|
||||
layer.close(loadT);
|
||||
showMsg(rdata.msg, function(){
|
||||
window.location.reload();
|
||||
} ,{icon:rdata.status?1:2}, 1000);
|
||||
},'json');
|
||||
}
|
||||
|
||||
|
||||
function modifyAuthPath() {
|
||||
var auth_path = $("#admin_path").val();
|
||||
|
||||
+35
-11
@@ -65,6 +65,7 @@ function getLoad(data) {
|
||||
$('#LoadList .circle').click(function() {
|
||||
getNet();
|
||||
});
|
||||
|
||||
$('#LoadList .mask').hover(function() {
|
||||
var one, five, fifteen;
|
||||
var that = this;
|
||||
@@ -78,6 +79,32 @@ $('#LoadList .mask').hover(function() {
|
||||
});
|
||||
|
||||
|
||||
function showCpuTips(rdata){
|
||||
$('#cpuChart .mask').unbind();
|
||||
$('#cpuChart .mask').hover(function() {
|
||||
var cpuText = '';
|
||||
|
||||
if (rdata.cpu[2].length == 1){
|
||||
var cpuUse = parseFloat(rdata.cpu[2][0] == 0 ? 0 : rdata.cpu[2][0]).toFixed(1);
|
||||
cpuText += 'CPU-1:' + cpuUse + '%'
|
||||
} else{
|
||||
for (var i = 1; i < rdata.cpu[2].length + 1; i++) {
|
||||
var cpuUse = parseFloat(rdata.cpu[2][i - 1] == 0 ? 0 : rdata.cpu[2][i - 1]).toFixed(1);
|
||||
if (i % 2 != 0) {
|
||||
cpuText += 'CPU-' + i + ':' + cpuUse + '% | '
|
||||
} else {
|
||||
cpuText += 'CPU-' + i + ':' + cpuUse + '%'
|
||||
cpuText += '\n'
|
||||
}
|
||||
}
|
||||
}
|
||||
layer.tips(rdata.cpu[3] + "</br>" + rdata.cpu[5] + "个物理CPU," + (rdata.cpu[4]) + "个物理核心," + rdata.cpu[1] + "个逻辑核心</br>" + cpuText, this, { time: 0, tips: [1, '#999'] });
|
||||
}, function() {
|
||||
layer.closeAll('tips');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function rocket(sum, m) {
|
||||
var n = sum - m;
|
||||
$(".mem-release").find(".mask span").text(n);
|
||||
@@ -249,9 +276,11 @@ function setcolor(pre, s, s1, s2, s3) {
|
||||
co.parent('.circle').css("background", LoadColor);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function getNet() {
|
||||
var up;
|
||||
var down;
|
||||
var up, down;
|
||||
$.get("/system/network", function(net) {
|
||||
$("#InterfaceSpeed").html(lan.index.interfacespeed + ": 1.0Gbps");
|
||||
$("#upSpeed").html(net.up + ' KB');
|
||||
@@ -269,6 +298,8 @@ function getNet() {
|
||||
|
||||
// setMemImg(net.mem);
|
||||
setImg();
|
||||
|
||||
showCpuTips(net);
|
||||
},'json');
|
||||
}
|
||||
|
||||
@@ -457,6 +488,8 @@ function setImg() {
|
||||
$(this).find('.left').css('transform', "rotate(" + (num - 180) + "deg)");
|
||||
};
|
||||
});
|
||||
|
||||
$('.diskbox .mask').unbind();
|
||||
$('.diskbox .mask').hover(function() {
|
||||
layer.closeAll('tips');
|
||||
var that = this;
|
||||
@@ -478,16 +511,7 @@ setTimeout(function() {
|
||||
$('#toUpdate a').css("position","relative");
|
||||
return;
|
||||
}
|
||||
// $.get('/system?action=ReWeb', function() {});
|
||||
// layer.msg(rdata.msg, { icon: 1 });
|
||||
// setTimeout(function() {
|
||||
// window.location.reload();
|
||||
// }, 3000);
|
||||
},'json').error(function() {
|
||||
// $.get('/system?action=ReWeb', function() {});
|
||||
// setTimeout(function() {
|
||||
// window.location.reload();
|
||||
// }, 3000);
|
||||
});
|
||||
}, 3000);
|
||||
|
||||
|
||||
@@ -338,6 +338,7 @@ function webPathEdit(id){
|
||||
var userini = data['data'];
|
||||
var webpath = userini['path'];
|
||||
var siteName = userini['name'];
|
||||
var runPath = userini['runPath']['runPath'];
|
||||
var userinicheckeds = userini.userini?'checked':'';
|
||||
var logscheckeds = userini.logs?'checked':'';
|
||||
var opt = ''
|
||||
@@ -385,7 +386,10 @@ function webPathEdit(id){
|
||||
|
||||
$("#webedit-con").html(webPathHtml);
|
||||
$("#userini").change(function(){
|
||||
$.post('/site/set_dir_user_ini','path='+webpath,function(userini){
|
||||
$.post('/site/set_dir_user_ini',{
|
||||
'path':webpath,
|
||||
'runPath':runPath,
|
||||
},function(userini){
|
||||
layer.msg(userini.msg+'<p style="color:red;">注意:设置防跨站需要重启PHP才能生效!</p>',{icon:userini.status?1:2});
|
||||
tryRestartPHP(siteName);
|
||||
},'json');
|
||||
@@ -2601,16 +2605,28 @@ function setSizeClassType(){
|
||||
// 尝试重启PHP
|
||||
function tryRestartPHP(siteName){
|
||||
$.post('/site/get_site_php_version','siteName='+siteName,function(data){
|
||||
var phpversion = data.phpversion;
|
||||
|
||||
if (data.phpversion == "00"){
|
||||
if (phpversion == "00"){
|
||||
return
|
||||
}
|
||||
|
||||
var reqData = {name:'php', func:'restart'}
|
||||
reqData['version'] = data.phpversion;
|
||||
var php_sign = 'php';
|
||||
if (phpversion.indexOf('yum') > -1){
|
||||
php_sign = 'php-yum';
|
||||
phpversion = phpversion.replace('yum','');
|
||||
}
|
||||
|
||||
if (phpversion.indexOf('apt') > -1){
|
||||
php_sign = 'php-apt';
|
||||
phpversion = phpversion.replace('apt','');
|
||||
}
|
||||
|
||||
var reqData = {name: php_sign, func:'restart'}
|
||||
reqData['version'] = phpversion;
|
||||
|
||||
// console.log(reqData);
|
||||
var loadT = layer.msg('尝试自动重启PHP['+data.phpversion+']...', { icon: 16, time: 0, shade: 0.3 });
|
||||
var loadT = layer.msg('尝试自动重启PHP['+phpversion+']...', { icon: 16, time: 0, shade: 0.3 });
|
||||
$.post('/plugins/run', reqData, function(data) {
|
||||
layer.close(loadT);
|
||||
layer.msg(data.msg,{icon:data.status?1:2,time:3000,shade: [0.3, '#000']});
|
||||
|
||||
@@ -18,6 +18,14 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ss-text pull-left mr50">
|
||||
<em>开发模式</em>
|
||||
<div class="ssh-item">
|
||||
<input class="btswitch btswitch-ios" id="debugMode" type="checkbox" {{data['debug']}}>
|
||||
<label class="btswitch-btn" for="debugMode" onclick="debugMode()"></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ss-text pull-left mr50">
|
||||
<em title="开启后允许使用ipv6访问面板">监听IPv6</em>
|
||||
<div class='ssh-item'>
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
</div>
|
||||
<h4 id="LoadState" class="c5 f15">获取中...</h4>
|
||||
</li>
|
||||
<li class="col-xs-6 col-sm-3 col-md-3 col-lg-2 mtb20 circle-box text-center">
|
||||
<li class="col-xs-6 col-sm-3 col-md-3 col-lg-2 mtb20 circle-box text-center" id="cpuChart">
|
||||
<h3 class="c5 f15">CPU使用率</h3>
|
||||
<div class="circle">
|
||||
<div class="pie_left">
|
||||
|
||||
+2
-1
@@ -104,7 +104,8 @@ fi
|
||||
#面板需要的库
|
||||
|
||||
if [ ! -f /usr/local/bin/pip3 ];then
|
||||
python3 -m pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple
|
||||
# python3 -m pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple
|
||||
python3 -m pip install --upgrade pip setuptools wheel -i https://pypi.python.org/pypi
|
||||
fi
|
||||
|
||||
pip install --upgrade pip
|
||||
|
||||
@@ -103,6 +103,13 @@ def downloadFile(url, filename):
|
||||
import urllib
|
||||
import socket
|
||||
socket.setdefaulttimeout(60)
|
||||
|
||||
headers = (
|
||||
'User-Agent', 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36')
|
||||
opener = urllib.request.build_opener()
|
||||
opener.addheaders = [headers]
|
||||
urllib.request.install_opener(opener)
|
||||
|
||||
urllib.request.urlretrieve(
|
||||
url, filename=filename, reporthook=downloadHook)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user