mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-10 04:59:25 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
535f6ddc77 | ||
|
|
aa3950ccfe | ||
|
|
8a81f8bb83 | ||
|
|
55d987c0bd | ||
|
|
416e9e7cda | ||
|
|
eedaef7eec | ||
|
|
3265deed3d | ||
|
|
1c7db0e2ec | ||
|
|
7872891797 | ||
|
|
8b074090a7 | ||
|
|
50f198e2d3 | ||
|
|
07e017c9a7 | ||
|
|
ca0aed7240 | ||
|
|
0126bcb68c | ||
|
|
7c37df5dec | ||
|
|
33bc6e19e7 | ||
|
|
35d42a5603 | ||
|
|
8a79beab89 | ||
|
|
cafff1d522 | ||
|
|
e266d85c91 | ||
|
|
e873ea8639 | ||
|
|
0cdc23a096 | ||
|
|
2c0231155d | ||
|
|
5583db0c70 | ||
|
|
2eeef4d8bd | ||
|
|
5a93b07968 | ||
|
|
b5195ba685 | ||
|
|
4c05747942 | ||
|
|
3722f57347 | ||
|
|
b7a3c32d3f | ||
|
|
6c0cb42e35 | ||
|
|
a84e7a16a3 | ||
|
|
fab1cb1bbe | ||
|
|
b46d7c1dee | ||
|
|
8f4dda2d65 | ||
|
|
e21d17e342 | ||
|
|
87eab46ed6 | ||
|
|
e0ebed3080 | ||
|
|
372dbc8995 | ||
|
|
33faf1e54c | ||
|
|
47f67275d5 | ||
|
|
e45ebc5f11 | ||
|
|
9ee570e3bb | ||
|
|
cc80ec7839 | ||
|
|
e7174a2111 | ||
|
|
ef6adfd82d | ||
|
|
daf6c9bff8 | ||
|
|
9f02092788 | ||
|
|
b314ebeed3 | ||
|
|
38f8fe9a38 | ||
|
|
c0e1512195 | ||
|
|
b616854baa | ||
|
|
1ad9546ae4 | ||
|
|
fb3aac37ec | ||
|
|
598f964e91 | ||
|
|
d9e46f1065 | ||
|
|
565d011191 | ||
|
|
6ae6e5fafc | ||
|
|
eb1c0efda1 | ||
|
|
98bc816b21 | ||
|
|
85735287c3 | ||
|
|
d59022ae44 | ||
|
|
70a17af9d8 | ||
|
|
09feeb11d2 | ||
|
|
d95e1e68c4 | ||
|
|
6e484babe9 | ||
|
|
d37ff296f6 | ||
|
|
f95d25f080 | ||
|
|
fd35db3dd8 | ||
|
|
f22e10a496 | ||
|
|
52f80ec3b7 | ||
|
|
41fd11c0f4 | ||
|
|
f8a5e7dab5 | ||
|
|
4b71d6b3d7 | ||
|
|
becb7f8c7f | ||
|
|
3da7b57242 | ||
|
|
42e8057356 | ||
|
|
e082baabe8 | ||
|
|
74d565c99a | ||
|
|
750efbf430 | ||
|
|
68112ba978 | ||
|
|
e994375fc8 | ||
|
|
998f677ee7 | ||
|
|
8b1b50938d | ||
|
|
3dbece0b5e | ||
|
|
e9f1e522de | ||
|
|
8a815159c1 | ||
|
|
c8af676d6f | ||
|
|
3bee84a52f | ||
|
|
82828aacf6 | ||
|
|
e4de3cff61 | ||
|
|
4ed7f5d7fd | ||
|
|
7b956c73e4 | ||
|
|
8535dd2306 | ||
|
|
e13df3ae58 | ||
|
|
44fa68f52d | ||
|
|
d72abb1e30 | ||
|
|
aad4343a59 | ||
|
|
6b5717b04f | ||
|
|
655946a467 | ||
|
|
80f3d98162 | ||
|
|
d73be680e2 | ||
|
|
ad9595b3b2 | ||
|
|
8a337fcfd6 | ||
|
|
38b1dba395 | ||
|
|
7195de0418 | ||
|
|
20cb30ba51 | ||
|
|
2a7c96b0f5 | ||
|
|
8503e6ebe9 | ||
|
|
be2c2a2436 | ||
|
|
8a247c93d4 | ||
|
|
b4cdc7fc2d | ||
|
|
cc3f1ed01a | ||
|
|
4db4284362 | ||
|
|
3c2e517c61 | ||
|
|
1d712d1f84 | ||
|
|
f1e1e3c82c | ||
|
|
8e587cf055 | ||
|
|
277b95f74b | ||
|
|
b89b180ee9 | ||
|
|
3e89c35111 | ||
|
|
52f7939b06 | ||
|
|
13d038e855 | ||
|
|
325046d3c2 | ||
|
|
8cb3b578e0 | ||
|
|
3b5a5206fc | ||
|
|
1517d8d2d7 | ||
|
|
ba55477492 | ||
|
|
e363833437 | ||
|
|
6ec51baedb | ||
|
|
0fdf62499b | ||
|
|
1498e23b48 | ||
|
|
106ce839d8 | ||
|
|
eed561dadc | ||
|
|
c97ec1cbba | ||
|
|
29802d8066 | ||
|
|
9a51bc4b4e | ||
|
|
082f697706 | ||
|
|
6e026f2998 | ||
|
|
c647f0c02d | ||
|
|
da99297253 | ||
|
|
4ab982827e | ||
|
|
d3a4db511a | ||
|
|
fa9e4e3b06 | ||
|
|
e7cd941f0f | ||
|
|
c641606ecd | ||
|
|
021a360462 | ||
|
|
9104280ff1 | ||
|
|
0ea0f2d13d | ||
|
|
289e251480 | ||
|
|
ce421cfb89 | ||
|
|
bec41f2c63 | ||
|
|
3a34974ec9 | ||
|
|
a7c9fff283 | ||
|
|
c36cca61a1 | ||
|
|
42edf12d01 | ||
|
|
d6799e89c4 | ||
|
|
4b4006c9da | ||
|
|
33bb042b41 | ||
|
|
be2e91b9ce | ||
|
|
db424f8912 | ||
|
|
bfca2e313a | ||
|
|
1de51747e6 | ||
|
|
8a623b490b | ||
|
|
b5b8ef7e46 | ||
|
|
daa561b6c4 | ||
|
|
9bc30db1ad | ||
|
|
1a9d506d61 | ||
|
|
62b5d812e2 | ||
|
|
433c9ab5ea | ||
|
|
a7a6976204 | ||
|
|
a1d8523dd9 | ||
|
|
295e456a20 | ||
|
|
453cb4cf14 | ||
|
|
56a1ffed2a | ||
|
|
b94f302fbe | ||
|
|
3a278f4cc6 | ||
|
|
67b7f9cf43 | ||
|
|
b3dc24428c | ||
|
|
233e6dfc0f | ||
|
|
07e74a8947 | ||
|
|
4eed1e8a93 | ||
|
|
1b91af6f22 | ||
|
|
9bc824906b | ||
|
|
394f345764 | ||
|
|
a10a11817b | ||
|
|
6b82dd5eca | ||
|
|
a5d976ad36 | ||
|
|
4bb4746a1b | ||
|
|
9fad06585f | ||
|
|
50ed66d26a | ||
|
|
ed17622a0b | ||
|
|
b8e993cd04 | ||
|
|
7fe6744c09 | ||
|
|
beb085e95c | ||
|
|
657f408a8b | ||
|
|
3994f1505e | ||
|
|
0ecc9307f1 | ||
|
|
93de3dd3ab | ||
|
|
f99225f172 | ||
|
|
cd9b043525 | ||
|
|
0e5c59dae2 | ||
|
|
1a5c7b9a3f | ||
|
|
2282776020 | ||
|
|
cd2b07f5d2 | ||
|
|
a5d4d53883 | ||
|
|
9e463cec7a | ||
|
|
e489bd43b8 | ||
|
|
983eb38165 | ||
|
|
677894ca35 | ||
|
|
a302ded8b2 | ||
|
|
3eeee10de6 | ||
|
|
160998ba6e | ||
|
|
8ece38c082 | ||
|
|
52d4215a80 | ||
|
|
029b548af0 | ||
|
|
4db10d22a7 | ||
|
|
1d3ca158cb | ||
|
|
74e19287e4 | ||
|
|
ece8dd8b19 | ||
|
|
d082297b25 | ||
|
|
1a1e211107 | ||
|
|
2d32578b5f | ||
|
|
e07f0fca9c | ||
|
|
80344149da | ||
|
|
046abc4cba | ||
|
|
588ec43543 | ||
|
|
ea8a4baba6 | ||
|
|
bcf3516f22 | ||
|
|
16acda5d60 | ||
|
|
68b9b95d5c | ||
|
|
e32c4926ca | ||
|
|
f4bb052776 | ||
|
|
3cc92a1eab | ||
|
|
24b8b1ee7c | ||
|
|
1996442b56 | ||
|
|
529ba08aee | ||
|
|
701b19e0b6 | ||
|
|
06f1b34f52 | ||
|
|
72c5efcc2f | ||
|
|
ac29bb098b |
@@ -5,9 +5,9 @@ name: MW APP MySQL55
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
branches: [ "run_test" ]
|
||||
pull_request:
|
||||
branches: [ "master" ]
|
||||
branches: [ "run_test" ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
@@ -5,9 +5,9 @@ name: MW APP MySQL56
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
branches: [ "run_test" ]
|
||||
pull_request:
|
||||
branches: [ "master" ]
|
||||
branches: [ "run_test" ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
@@ -5,9 +5,9 @@ name: MW APP MySQL57
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
branches: [ "run_test" ]
|
||||
pull_request:
|
||||
branches: [ "master" ]
|
||||
branches: [ "run_test" ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
@@ -5,9 +5,9 @@ name: MW APP MySQL80
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
branches: [ "run_test" ]
|
||||
pull_request:
|
||||
branches: [ "master" ]
|
||||
branches: [ "run_test" ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
@@ -5,9 +5,9 @@ name: MW APP PHP
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
branches: [ "run_test" ]
|
||||
pull_request:
|
||||
branches: [ "master" ]
|
||||
branches: [ "run_test" ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
+6
-2
@@ -122,12 +122,14 @@ data/datadir.pl
|
||||
data/502Task.pl
|
||||
data/default.pl
|
||||
data/backup.pl
|
||||
data/debug.pl
|
||||
data/default_site.pl
|
||||
lib/python*
|
||||
|
||||
bin
|
||||
pyvenv.cfg
|
||||
include
|
||||
share
|
||||
pip-selfcheck.json
|
||||
|
||||
scripts/mdserver-web
|
||||
@@ -140,16 +142,18 @@ data/restart.pl
|
||||
data/ssl.pl
|
||||
data/edate.pl
|
||||
data/osname.pl
|
||||
data/only_netio_counters.pl
|
||||
data/system.db-journal
|
||||
data/hook_*.json
|
||||
|
||||
plugins/l2tp
|
||||
plugins/openlitespeed
|
||||
plugins/gdrive
|
||||
plugins/mtproxy
|
||||
plugins/zimg
|
||||
plugins/bk_demo
|
||||
plugins/mail
|
||||
debug.out
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
### mdserver-web 0.9.2
|
||||
<p align="center">
|
||||
<img alt="logo" src="https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/route/static/logo.png" height="140" />
|
||||
<h3 align="center">mdserver-web</h3>
|
||||
<p align="center">一款简单Linux面板服务</p>
|
||||
</p>
|
||||
|
||||
### 简介
|
||||
|
||||
简单的Linux面板,感谢BT.CN写出如此好的web管理软件。我一看到,就知道这是我一直想要的页面化管理方式。
|
||||
复制了后台管理界面,按照自己想要的方式写了一版。
|
||||
@@ -61,6 +67,19 @@ PHP[53-72]支持phpMyAdmin[4.4.15]
|
||||
PHP[72-81]支持phpMyAdmin[5.2.0]
|
||||
```
|
||||
|
||||
# 特别赞助
|
||||
|
||||
- [找资源 - 阿里云盘资源搜索引擎](https://zhaoziyuan.la/)
|
||||
|
||||
# AD - VPS推荐 - 🙏
|
||||
|
||||
- [ZZZ评测](https://www.zzzvps.com/)
|
||||
|
||||
| 服务商 | LOGO | 推广地址 | 优惠码 |
|
||||
| ------------- |----------|-----------|-------|
|
||||
| digitalvirt |[](https://digitalvirt.com/aff.php?aff=154) | https://digitalvirt.com/aff.php?aff=154 | 9SYDY7UH0U |
|
||||
| 搬瓦工 |[](https://bandwagonhost.com/aff.php?aff=54161) | https://bandwagonhost.com/aff.php?aff=54161 | BWH3HYATVBJW |
|
||||
|
||||
# Docker
|
||||
|
||||
- 由[DDSRem](https://github.com/DDSRem)开发维护。
|
||||
@@ -71,10 +90,15 @@ docker run -itd --name mw-server --privileged=true -p 7200:7200 -p 80:80 -p 443:
|
||||
```
|
||||
|
||||
|
||||
### 版本更新 0.9.2
|
||||
### 版本更新 0.9.10
|
||||
|
||||
* 防跨站攻击(open_basedir)功能优化。
|
||||
* 创建站点域名批量添加优化。
|
||||
* 首页CPU显示tip添加。
|
||||
* 优化日志读取。
|
||||
* 加入开发模式开关。
|
||||
* redis添加性能调整功能。
|
||||
|
||||
* 批量域名添加修复。
|
||||
* 常用命令说明。
|
||||
|
||||
### JSDelivr安装地址
|
||||
|
||||
@@ -120,16 +144,25 @@ curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/qu
|
||||
```
|
||||
curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/install_dev.sh | bash
|
||||
curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/update_dev.sh | bash
|
||||
|
||||
|
||||
curl -fsSL https://gitee.com/midoks/mdserver-web/raw/master/scripts/install_dev.sh | bash
|
||||
curl -fsSL https://gitee.com/midoks/mdserver-web/raw/master/scripts/update_dev.sh | bash
|
||||
```
|
||||
|
||||
### 捐赠地址 USDT(TRC20)
|
||||
|
||||
TVbNgrpeGBGZVm5gTLa21ADP7RpnPFhjya
|
||||
|
||||
|
||||
### 微信赞助
|
||||
[](/route/static/img/weixin_zz.jpg)
|
||||
|
||||
[](https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/route/static/img/weixin_zz.jpg)
|
||||
|
||||
|
||||
### 无图不真相
|
||||
|
||||
[](/route/static/mdw.jpg)
|
||||
|
||||
[](https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/route/static/mdw.jpg)
|
||||
|
||||
|
||||
### Stargazers over time
|
||||
@@ -139,7 +172,7 @@ curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/up
|
||||
|
||||
### 感谢开发赞助
|
||||
|
||||
[](https://digitalvirt.com/)
|
||||
[](https://digitalvirt.com/aff.php?aff=154)
|
||||
|
||||
### 授权许可
|
||||
|
||||
|
||||
@@ -15,8 +15,7 @@ from flask import request
|
||||
|
||||
class config_api:
|
||||
|
||||
# mariadb 优化
|
||||
__version = '0.9.2'
|
||||
__version = '0.9.10'
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
@@ -208,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'):
|
||||
@@ -317,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'
|
||||
|
||||
+19
-12
@@ -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):
|
||||
@@ -295,9 +295,18 @@ class crontab_api:
|
||||
# 取数据列表
|
||||
def getDataListApi(self):
|
||||
stype = request.form.get('type', '')
|
||||
|
||||
bak_data = []
|
||||
|
||||
if stype == 'sites' or stype == 'databases':
|
||||
hookPath = mw.getPanelDataDir() + "/hook_backup.json"
|
||||
if os.path.exists(hookPath):
|
||||
t = mw.readFile(hookPath)
|
||||
bak_data = json.loads(t)
|
||||
|
||||
if stype == 'databases':
|
||||
db_list = {}
|
||||
db_list['orderOpt'] = []
|
||||
db_list['orderOpt'] = bak_data
|
||||
path = mw.getServerDir() + '/mysql'
|
||||
if not os.path.exists(path + '/mysql.db'):
|
||||
db_list['data'] = []
|
||||
@@ -307,8 +316,9 @@ class crontab_api:
|
||||
return mw.getJson(db_list)
|
||||
|
||||
data = {}
|
||||
data['orderOpt'] = bak_data
|
||||
|
||||
data['data'] = mw.M(stype).field('name,ps').select()
|
||||
data['orderOpt'] = []
|
||||
return mw.getJson(data)
|
||||
##### ----- start ----- ###
|
||||
|
||||
@@ -411,16 +421,13 @@ class crontab_api:
|
||||
'rememory': head + "/bin/bash " + script_dir + '/rememory.sh'
|
||||
}
|
||||
if param['backup_to'] != 'localhost':
|
||||
cfile = mw.getServerDir() + "/mdserver-web/plugin/" + \
|
||||
param['backup_to'] + "/" + param['backup_to'] + "_main.py"
|
||||
if not os.path.exists(cfile):
|
||||
cfile = script_dir + "/backup_" + \
|
||||
param['backup_to'] + ".py"
|
||||
cfile = mw.getPluginDir() + "/" + \
|
||||
param['backup_to'] + "/index.py"
|
||||
wheres = {
|
||||
'path': head + "python " + cfile + " path " + param['sname'] + " " + str(param['save']),
|
||||
'site': head + "python " + cfile + " site " + param['sname'] + " " + str(param['save']),
|
||||
'database': head + "python " + cfile + " database " + param['sname'] + " " + str(param['save']),
|
||||
'logs': head + "python " + script_dir + "/logs_backup.py " + param['sname'] + log + " " + str(param['save']),
|
||||
'path': head + "python3 " + cfile + " path " + param['sname'] + " " + str(param['save']),
|
||||
'site': head + "python3 " + cfile + " site " + param['sname'] + " " + str(param['save']),
|
||||
'database': head + "python3 " + cfile + " database " + param['sname'] + " " + str(param['save']),
|
||||
'logs': head + "python3 " + script_dir + "/logs_backup.py " + param['sname'] + log + " " + str(param['save']),
|
||||
'rememory': head + "/bin/bash " + script_dir + '/rememory.sh'
|
||||
}
|
||||
try:
|
||||
|
||||
@@ -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))
|
||||
@@ -676,8 +676,7 @@ class files_api:
|
||||
data['encoding'] = 'utf-8'
|
||||
if char['encoding'] == 'Big5':
|
||||
data['encoding'] = 'BIG5'
|
||||
if not char['encoding'] in ['GBK', 'utf-8',
|
||||
'BIG5']:
|
||||
if not char['encoding'] in ['GBK', 'utf-8', 'BIG5']:
|
||||
data['encoding'] = 'utf-8'
|
||||
try:
|
||||
if sys.version_info[0] == 2:
|
||||
|
||||
+37
-22
@@ -57,10 +57,22 @@ def getPluginDir():
|
||||
return getRunDir() + '/plugins'
|
||||
|
||||
|
||||
def getPanelDataDir():
|
||||
return getRunDir() + '/data'
|
||||
|
||||
|
||||
def getServerDir():
|
||||
return getRootDir() + '/server'
|
||||
|
||||
|
||||
def getLogsDir():
|
||||
return getRootDir() + '/wwwlogs'
|
||||
|
||||
|
||||
def getBackupDir():
|
||||
return getRootDir() + '/backup'
|
||||
|
||||
|
||||
def getWwwDir():
|
||||
file = getRunDir() + '/data/site.pl'
|
||||
if os.path.exists(file):
|
||||
@@ -73,14 +85,6 @@ def setWwwDir(wdir):
|
||||
return writeFile(file, wdir)
|
||||
|
||||
|
||||
def getLogsDir():
|
||||
return getRootDir() + '/wwwlogs'
|
||||
|
||||
|
||||
def getBackupDir():
|
||||
return getRootDir() + '/backup'
|
||||
|
||||
|
||||
def setBackupDir(bdir):
|
||||
file = getRunDir() + '/data/backup.pl'
|
||||
return writeFile(file, bdir)
|
||||
@@ -163,13 +167,13 @@ def restartWeb():
|
||||
# systemd
|
||||
systemd = '/lib/systemd/system/openresty.service'
|
||||
if os.path.exists(systemd):
|
||||
execShell('systemctl restart openresty')
|
||||
execShell('systemctl reload openresty')
|
||||
return True
|
||||
|
||||
# initd
|
||||
initd = getServerDir() + '/openresty/init.d/openresty'
|
||||
if os.path.exists(initd):
|
||||
execShell(initd + ' ' + 'restart')
|
||||
execShell(initd + ' ' + 'reload')
|
||||
return True
|
||||
|
||||
return False
|
||||
@@ -605,7 +609,7 @@ def getNumLines(path, num, p=1):
|
||||
break
|
||||
fp.close()
|
||||
except Exception as e:
|
||||
return ''
|
||||
return str(e)
|
||||
|
||||
return "\n".join(data)
|
||||
|
||||
@@ -646,16 +650,14 @@ def getLocalIp():
|
||||
try:
|
||||
ipaddress = readFile(filename)
|
||||
if not ipaddress or ipaddress == '127.0.0.1':
|
||||
raise Exception("ip is empty!")
|
||||
cmd = "curl -4 -sS --connect-timeout 5 -m 60 https://v6r.ipip.net/?format=text"
|
||||
ip = execShell(cmd)
|
||||
result = ip[0].strip()
|
||||
if result == '':
|
||||
raise Exception("ipv4 is empty!")
|
||||
writeFile(filename, result)
|
||||
return result
|
||||
return ipaddress
|
||||
except Exception as e:
|
||||
cmd = "curl -4 -sS --connect-timeout 5 -m 60 https://v6r.ipip.net/?format=text"
|
||||
ip = execShell(cmd)
|
||||
result = ip[0].strip()
|
||||
if result == '':
|
||||
raise e
|
||||
writeFile(filename, result)
|
||||
return result
|
||||
except Exception as e:
|
||||
cmd = "curl -6 -sS --connect-timeout 5 -m 60 https://v6r.ipip.net/?format=text"
|
||||
ip = execShell(cmd)
|
||||
@@ -664,6 +666,8 @@ def getLocalIp():
|
||||
return '127.0.0.1'
|
||||
writeFile(filename, result)
|
||||
return result
|
||||
finally:
|
||||
pass
|
||||
return '127.0.0.1'
|
||||
|
||||
|
||||
@@ -710,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
|
||||
|
||||
|
||||
|
||||
@@ -114,6 +114,7 @@ class plugins_api:
|
||||
return mw.returnJson(False, '配置文件不存在!', ())
|
||||
|
||||
pluginInfo = json.loads(mw.readFile(infoJsonPos))
|
||||
self.hookInstall(pluginInfo)
|
||||
|
||||
execstr = "cd " + os.getcwd() + "/plugins/" + \
|
||||
name + " && /bin/bash " + pluginInfo["shell"] \
|
||||
@@ -131,6 +132,55 @@ class plugins_api:
|
||||
mw.triggerTask()
|
||||
return mw.returnJson(True, '已将安装任务添加到队列!')
|
||||
|
||||
def hookInstallFile(self, hook_name, info):
|
||||
hookPath = mw.getPanelDataDir() + "/hook_" + hook_name + ".json"
|
||||
data = []
|
||||
if os.path.exists(hookPath):
|
||||
t = mw.readFile(hookPath)
|
||||
data = json.loads(t)
|
||||
|
||||
isNeedAdd = True
|
||||
for x in range(len(data)):
|
||||
if data[x]['title'] == info['title'] and data[x]['name'] == info['name']:
|
||||
isNeedAdd = False
|
||||
|
||||
if isNeedAdd:
|
||||
tmp = {}
|
||||
tmp['title'] = info['title']
|
||||
tmp['name'] = info['name']
|
||||
data.append(tmp)
|
||||
mw.writeFile(hookPath, json.dumps(data))
|
||||
|
||||
def hookUninstallFile(self, hook_name, info):
|
||||
hookPath = mw.getPanelDataDir() + "/hook_" + hook_name + ".json"
|
||||
data = []
|
||||
if os.path.exists(hookPath):
|
||||
t = mw.readFile(hookPath)
|
||||
data = json.loads(t)
|
||||
|
||||
for idx in range(len(data)):
|
||||
if data[idx]['title'] == info['title'] and data[idx]['name'] == info['name']:
|
||||
data.remove(data[idx])
|
||||
mw.writeFile(hookPath, json.dumps(data))
|
||||
|
||||
def hookInstall(self, info):
|
||||
if 'hook' in info:
|
||||
hooks = info['hook']
|
||||
for x in hooks:
|
||||
if x in ['backup']:
|
||||
self.hookInstallFile(x, info)
|
||||
return True
|
||||
return False
|
||||
|
||||
def hookUninstall(self, info):
|
||||
if 'hook' in info:
|
||||
hooks = info['hook']
|
||||
for x in hooks:
|
||||
if x in ['backup']:
|
||||
self.hookUninstallFile(x, info)
|
||||
return True
|
||||
return False
|
||||
|
||||
def uninstallOldApi(self):
|
||||
rundir = mw.getRunDir()
|
||||
name = request.form.get('name', '')
|
||||
@@ -147,7 +197,6 @@ class plugins_api:
|
||||
return mw.returnJson(False, "配置文件不存在!", ())
|
||||
|
||||
pluginInfo = json.loads(mw.readFile(infoJsonPos))
|
||||
|
||||
execstr = "cd " + os.getcwd() + "/plugins/" + \
|
||||
name + " && /bin/bash " + pluginInfo["shell"] \
|
||||
+ " uninstall " + version
|
||||
@@ -175,13 +224,13 @@ class plugins_api:
|
||||
return mw.returnJson(False, "配置文件不存在!", ())
|
||||
|
||||
pluginInfo = json.loads(mw.readFile(infoJsonPos))
|
||||
|
||||
self.hookUninstall(pluginInfo)
|
||||
execstr = "cd " + os.getcwd() + "/plugins/" + \
|
||||
name + " && /bin/bash " + pluginInfo["shell"] \
|
||||
+ " uninstall " + version
|
||||
|
||||
data = mw.execShell(execstr)
|
||||
if mw.isAppleSystem():
|
||||
if mw.isDebugMode():
|
||||
print(execstr)
|
||||
print(data[0], data[1])
|
||||
self.removeIndex(name, version)
|
||||
@@ -793,7 +842,7 @@ class plugins_api:
|
||||
print('getIndexList:', e)
|
||||
|
||||
# 使用gevent模式时,无法使用多进程
|
||||
#plist = self.checkStatusMProcess(plist)
|
||||
# plist = self.checkStatusMProcess(plist)
|
||||
plist = self.checkStatusMThreads(plist)
|
||||
return plist
|
||||
|
||||
|
||||
+43
-28
@@ -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):
|
||||
@@ -497,7 +506,7 @@ class site_api:
|
||||
certName = request.form.get('certName', '')
|
||||
siteName = request.form.get('siteName', '')
|
||||
try:
|
||||
path = self.sslDir + siteName
|
||||
path = self.sslDir + siteName.strip()
|
||||
if not os.path.exists(path):
|
||||
return mw.returnJson(False, '证书不存在!')
|
||||
|
||||
@@ -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, '设置成功!')
|
||||
@@ -1140,10 +1149,10 @@ class site_api:
|
||||
if conf.find(rep) == -1:
|
||||
rep = '#error_page 404/404.html;'
|
||||
data = '''
|
||||
# AUTH_START
|
||||
#AUTH_START
|
||||
auth_basic "Authorization";
|
||||
auth_basic_user_file %s;
|
||||
# AUTH_END''' % (filename,)
|
||||
#AUTH_END''' % (filename,)
|
||||
conf = conf.replace(rep, rep + data)
|
||||
mw.writeFile(configFile, conf)
|
||||
# 写密码配置
|
||||
@@ -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):
|
||||
@@ -2026,7 +2035,7 @@ location ^~ {from} {
|
||||
return 404;
|
||||
}
|
||||
}
|
||||
# SECURITY-END
|
||||
#SECURITY-END
|
||||
include %s/enable-php-''' % (fix.strip().replace(',', '|'), domains.strip().replace(',', ' '), pre_path)
|
||||
conf = re.sub(re_path, rconf, conf)
|
||||
mw.writeLog('网站管理', '站点[' + name + ']已开启防盗链!')
|
||||
@@ -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, '已打开防跨站设置!')
|
||||
|
||||
+93
-69
@@ -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):
|
||||
# 取内存信息
|
||||
@@ -437,12 +446,35 @@ class system_api:
|
||||
os.system('echo > /tmp/panelBoot.pl')
|
||||
return total, count
|
||||
|
||||
def psutilNetIoCounters(self):
|
||||
'''
|
||||
统计网卡流量
|
||||
'''
|
||||
stat_pl = 'data/only_netio_counters.pl'
|
||||
if os.path.exists(stat_pl):
|
||||
local_lo = (0, 0, 0, 0)
|
||||
ioName = psutil.net_io_counters(pernic=True).keys()
|
||||
for x in ioName:
|
||||
|
||||
if x.find("lo") > -1:
|
||||
local_lo = psutil.net_io_counters(
|
||||
pernic=True).get(x)[:4]
|
||||
|
||||
all_io = psutil.net_io_counters()[:4]
|
||||
result_io = tuple([all_io[i] - local_lo[i]
|
||||
for i in range(0, len(all_io))])
|
||||
|
||||
# print(local_lo)
|
||||
# print(all_io)
|
||||
# print(result_io)
|
||||
return result_io
|
||||
return psutil.net_io_counters()[:4]
|
||||
|
||||
def getNetWork(self):
|
||||
# return self.GetNetWorkApi(get);
|
||||
# 取网络流量信息
|
||||
try:
|
||||
# 取网络流量信息
|
||||
networkIo = psutil.net_io_counters()[:4]
|
||||
networkIo = self.psutilNetIoCounters()
|
||||
if not "otime" in session:
|
||||
session['up'] = networkIo[0]
|
||||
session['down'] = networkIo[1]
|
||||
@@ -470,38 +502,7 @@ class system_api:
|
||||
|
||||
return networkInfo
|
||||
except Exception as e:
|
||||
# print(e)
|
||||
return None
|
||||
|
||||
def getNetWorkApi(self):
|
||||
# 取网络流量信息
|
||||
try:
|
||||
tmpfile = 'data/network.temp'
|
||||
networkIo = psutil.net_io_counters()[:4]
|
||||
|
||||
if not os.path.exists(tmpfile):
|
||||
mw.writeFile(tmpfile, str(
|
||||
networkIo[0]) + '|' + str(networkIo[1]) + '|' + str(int(time.time())))
|
||||
|
||||
lastValue = mw.readFile(tmpfile).split('|')
|
||||
|
||||
ntime = time.time()
|
||||
networkInfo = {}
|
||||
networkInfo['upTotal'] = networkIo[0]
|
||||
networkInfo['downTotal'] = networkIo[1]
|
||||
networkInfo['up'] = round(
|
||||
float(networkIo[0] - int(lastValue[0])) / 1024 / (ntime - int(lastValue[2])), 2)
|
||||
networkInfo['down'] = round(
|
||||
float(networkIo[1] - int(lastValue[1])) / 1024 / (ntime - int(lastValue[2])), 2)
|
||||
networkInfo['downPackets'] = networkIo[3]
|
||||
networkInfo['upPackets'] = networkIo[2]
|
||||
|
||||
mw.writeFile(tmpfile, str(
|
||||
networkIo[0]) + '|' + str(networkIo[1]) + '|' + str(int(time.time())))
|
||||
|
||||
# networkInfo['cpu'] = self.GetCpuInfo(0.1)
|
||||
return networkInfo
|
||||
except:
|
||||
print("getNetWork error:", e)
|
||||
return None
|
||||
|
||||
def getNetWorkIoData(self, start, end):
|
||||
@@ -567,14 +568,19 @@ class system_api:
|
||||
def setControl(self, stype, day):
|
||||
|
||||
filename = 'data/control.conf'
|
||||
stat_pl = 'data/only_netio_counters.pl'
|
||||
|
||||
if stype == '0':
|
||||
mw.execShell("rm -f " + filename)
|
||||
mw.execShell("rm -rf " + filename)
|
||||
elif stype == '1':
|
||||
_day = int(day)
|
||||
if _day < 1:
|
||||
return mw.returnJson(False, "设置失败!")
|
||||
mw.writeFile(filename, day)
|
||||
elif stype == '2':
|
||||
mw.execShell("rm -rf " + stat_pl)
|
||||
elif stype == '3':
|
||||
mw.execShell("echo 'True' > " + stat_pl)
|
||||
elif stype == 'del':
|
||||
if not mw.isRestart():
|
||||
return mw.returnJson(False, '请等待所有安装任务完成再执行')
|
||||
@@ -597,6 +603,12 @@ class system_api:
|
||||
else:
|
||||
data['day'] = 30
|
||||
data['status'] = False
|
||||
|
||||
if os.path.exists(stat_pl):
|
||||
data['stat_all_status'] = True
|
||||
else:
|
||||
data['stat_all_status'] = False
|
||||
|
||||
return mw.getJson(data)
|
||||
|
||||
return mw.returnJson(True, "设置成功!")
|
||||
@@ -625,13 +637,13 @@ class system_api:
|
||||
def getServerInfo(self):
|
||||
import urllib.request
|
||||
import ssl
|
||||
upAddr = 'https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/version/info.json'
|
||||
upAddr = 'https://api.github.com/repos/midoks/mdserver-web/releases/latest'
|
||||
try:
|
||||
context = ssl._create_unverified_context()
|
||||
req = urllib.request.urlopen(upAddr, context=context, timeout=3)
|
||||
result = req.read().decode('utf-8')
|
||||
version = json.loads(result)
|
||||
return version[0]
|
||||
return version
|
||||
except Exception as e:
|
||||
print('getServerInfo', e)
|
||||
return {}
|
||||
@@ -642,58 +654,70 @@ class system_api:
|
||||
if not mw.isRestart():
|
||||
return mw.returnJson(False, '请等待所有安装任务完成再执行!')
|
||||
|
||||
version_new_info = self.getServerInfo()
|
||||
version_now = config_api.config_api().getVersion()
|
||||
|
||||
new_ver = version_new_info['name']
|
||||
|
||||
if stype == 'check':
|
||||
version_now = config_api.config_api().getVersion()
|
||||
version_new_info = self.getServerInfo()
|
||||
if not 'version' in version_new_info:
|
||||
if not 'name' in version_new_info:
|
||||
return mw.returnJson(False, '服务器数据或网络有问题!')
|
||||
|
||||
diff = self.versionDiff(
|
||||
version_now, version_new_info['version'])
|
||||
diff = self.versionDiff(version_now, new_ver)
|
||||
if diff == 'new':
|
||||
return mw.returnJson(True, '有新版本!', version_new_info['version'])
|
||||
return mw.returnJson(True, '有新版本!', new_ver)
|
||||
elif diff == 'test':
|
||||
return mw.returnJson(True, '有测试版本!', version_new_info['version'])
|
||||
return mw.returnJson(True, '有测试版本!', new_ver)
|
||||
else:
|
||||
return mw.returnJson(False, '已经是最新,无需更新!')
|
||||
|
||||
if stype == 'info':
|
||||
version_new_info = self.getServerInfo()
|
||||
version_now = config_api.config_api().getVersion()
|
||||
|
||||
if not 'version' in version_new_info:
|
||||
if not 'name' in version_new_info:
|
||||
return mw.returnJson(False, '服务器数据有问题!')
|
||||
diff = self.versionDiff(
|
||||
version_now, version_new_info['version'])
|
||||
return mw.returnJson(True, '更新信息!', version_new_info)
|
||||
diff = self.versionDiff(version_now, new_ver)
|
||||
data = {}
|
||||
data['version'] = new_ver
|
||||
data['content'] = version_new_info[
|
||||
'body'].replace("\n", "<br/>")
|
||||
return mw.returnJson(True, '更新信息!', data)
|
||||
|
||||
if stype == 'update':
|
||||
if version == '':
|
||||
return mw.returnJson(False, '缺少版本信息!')
|
||||
|
||||
v_new_info = self.getServerInfo()
|
||||
if v_new_info['version'] != version:
|
||||
if new_ver != version:
|
||||
return mw.returnJson(False, '更新失败,请重试!')
|
||||
|
||||
if not 'path' in v_new_info or v_new_info['path'] == '':
|
||||
return mw.returnJson(False, '下载地址不存在!')
|
||||
|
||||
newUrl = v_new_info['path']
|
||||
toPath = mw.getRootDir() + '/temp'
|
||||
if not os.path.exists(toPath):
|
||||
mw.execShell('mkdir -p ' + toPath)
|
||||
|
||||
mw.execShell('wget -O ' + toPath + '/mw.zip ' + newUrl)
|
||||
newUrl = "https://github.com/midoks/mdserver-web/archive/refs/tags/" + version + ".zip"
|
||||
|
||||
mw.execShell('unzip -o ' + toPath + '/mw.zip' + ' -d ./')
|
||||
mw.execShell('unzip -o mw.zip -d ./')
|
||||
mw.execShell('rm -f mw.zip')
|
||||
return mw.returnJson(True, '安装更新成功,需自己重启!')
|
||||
dist_mw = toPath + '/mw.zip'
|
||||
if not os.path.exists(dist_mw):
|
||||
mw.execShell(
|
||||
'wget --no-check-certificate -O ' + dist_mw + ' ' + newUrl)
|
||||
|
||||
dist_to = toPath + "/mdserver-web-" + version
|
||||
if not os.path.exists(dist_to):
|
||||
os.system('unzip -o ' + toPath +
|
||||
'/mw.zip' + ' -d ' + toPath)
|
||||
|
||||
cmd_cp = 'cp -rf ' + toPath + '/mdserver-web-' + \
|
||||
version + '/* ' + mw.getServerDir() + '/mdserver-web'
|
||||
mw.execShell(cmd_cp)
|
||||
|
||||
mw.execShell('rm -rf ' + toPath + '/mdserver-web-' + version)
|
||||
mw.execShell('rm -rf ' + toPath + '/mw.zip')
|
||||
|
||||
self.restartMw()
|
||||
return mw.returnJson(True, '安装更新成功!')
|
||||
|
||||
return mw.returnJson(False, '已经是最新,无需更新!')
|
||||
except Exception as ex:
|
||||
print('updateServer', ex)
|
||||
return mw.returnJson(False, "连接服务器失败!")
|
||||
# print('updateServer', ex)
|
||||
return mw.returnJson(False, "连接服务器失败!" + str(ex))
|
||||
|
||||
# 修复面板
|
||||
def repPanel(self, get):
|
||||
|
||||
@@ -11,6 +11,7 @@ class ORM:
|
||||
__DB_PASS = None
|
||||
__DB_USER = 'root'
|
||||
__DB_PORT = 3306
|
||||
__DB_NAME = ''
|
||||
__DB_HOST = 'localhost'
|
||||
__DB_CONN = None
|
||||
__DB_CUR = None
|
||||
@@ -27,21 +28,25 @@ class ORM:
|
||||
if os.path.exists(self.__DB_SOCKET):
|
||||
try:
|
||||
self.__DB_CONN = pymysql.connect(host=self.__DB_HOST, user=self.__DB_USER, passwd=self.__DB_PASS,
|
||||
database=self.__DB_NAME,
|
||||
port=int(self.__DB_PORT), charset=self.__DB_CHARSET, connect_timeout=1,
|
||||
unix_socket=self.__DB_SOCKET, cursorclass=pymysql.cursors.DictCursor)
|
||||
except Exception as e:
|
||||
self.__DB_HOST = '127.0.0.1'
|
||||
self.__DB_CONN = pymysql.connect(host=self.__DB_HOST, user=self.__DB_USER, passwd=self.__DB_PASS,
|
||||
database=self.__DB_NAME,
|
||||
port=int(self.__DB_PORT), charset=self.__DB_CHARSET, connect_timeout=1,
|
||||
unix_socket=self.__DB_SOCKET, cursorclass=pymysql.cursors.DictCursor)
|
||||
else:
|
||||
try:
|
||||
self.__DB_CONN = pymysql.connect(host=self.__DB_HOST, user=self.__DB_USER, passwd=self.__DB_PASS,
|
||||
database=self.__DB_NAME,
|
||||
port=int(self.__DB_PORT), charset=self.__DB_CHARSET, connect_timeout=1,
|
||||
cursorclass=pymysql.cursors.DictCursor)
|
||||
except Exception as e:
|
||||
self.__DB_HOST = '127.0.0.1'
|
||||
self.__DB_CONN = pymysql.connect(host=self.__DB_HOST, user=self.__DB_USER, passwd=self.__DB_PASS,
|
||||
database=self.__DB_NAME,
|
||||
port=int(self.__DB_PORT), charset=self.__DB_CHARSET, connect_timeout=1,
|
||||
cursorclass=pymysql.cursors.DictCursor)
|
||||
|
||||
@@ -63,12 +68,18 @@ class ORM:
|
||||
def setPort(self, port):
|
||||
self.__DB_PORT = port
|
||||
|
||||
def setUser(self, user):
|
||||
self.__DB_USER = user
|
||||
|
||||
def setPwd(self, pwd):
|
||||
self.__DB_PASS = pwd
|
||||
|
||||
def getPwd(self):
|
||||
return self.__DB_PASS
|
||||
|
||||
def setDbName(self, name):
|
||||
self.__DB_NAME = name
|
||||
|
||||
def execute(self, sql):
|
||||
# 执行SQL语句返回受影响行
|
||||
if not self.__Conn():
|
||||
|
||||
@@ -77,6 +77,12 @@ class ORM:
|
||||
def getPwd(self):
|
||||
return self.__DB_PASS
|
||||
|
||||
def setDbName(self, name):
|
||||
self.__DB_NAME = name
|
||||
|
||||
def setUser(self, user):
|
||||
self.__DB_USER = user
|
||||
|
||||
def execute(self, sql):
|
||||
# 执行SQL语句返回受影响行
|
||||
if not self.__Conn():
|
||||
|
||||
@@ -13,7 +13,7 @@ service mw [start|stop|reload|restart|status]
|
||||
|
||||
```
|
||||
|
||||
sytemctl [start|stop|reload|restart|status] openresty
|
||||
systemctl [start|stop|reload|restart|status] openresty
|
||||
|
||||
```
|
||||
|
||||
@@ -21,7 +21,7 @@ sytemctl [start|stop|reload|restart|status] openresty
|
||||
|
||||
```
|
||||
|
||||
sytemctl [start|stop|reload|restart|status] mysql
|
||||
systemctl [start|stop|reload|restart|status] mysql
|
||||
|
||||
```
|
||||
|
||||
@@ -29,7 +29,7 @@ sytemctl [start|stop|reload|restart|status] mysql
|
||||
|
||||
```
|
||||
|
||||
sytemctl [start|stop|reload|restart|status] mariadb
|
||||
systemctl [start|stop|reload|restart|status] mariadb
|
||||
|
||||
```
|
||||
|
||||
@@ -37,16 +37,16 @@ sytemctl [start|stop|reload|restart|status] mariadb
|
||||
|
||||
```
|
||||
|
||||
sytemctl [start|stop|reload|restart|status] php[54-81]
|
||||
systemctl [start|stop|reload|restart|status] php[54-81]
|
||||
|
||||
sytemctl start php71
|
||||
systemctl start php71
|
||||
```
|
||||
|
||||
- Redis
|
||||
|
||||
```
|
||||
|
||||
sytemctl [start|stop|reload|restart|status] redis
|
||||
systemctl [start|stop|reload|restart|status] redis
|
||||
|
||||
```
|
||||
|
||||
@@ -54,7 +54,7 @@ sytemctl [start|stop|reload|restart|status] redis
|
||||
|
||||
```
|
||||
|
||||
sytemctl [start|stop|reload|restart|status] memcached
|
||||
systemctl [start|stop|reload|restart|status] memcached
|
||||
|
||||
```
|
||||
|
||||
@@ -63,6 +63,6 @@ sytemctl [start|stop|reload|restart|status] memcached
|
||||
|
||||
```
|
||||
|
||||
sytemctl [start|stop|reload|restart|status] sphinx
|
||||
systemctl [start|stop|reload|restart|status] sphinx
|
||||
|
||||
```
|
||||
|
||||
@@ -48,6 +48,11 @@ def mw_reset_pwd():
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
if os.geteuid() != 0:
|
||||
print("请使用root账户执行该命令.")
|
||||
sys.exit(1)
|
||||
|
||||
os.chdir("/www/server/mdserver-web")
|
||||
sys.path.append(os.getcwd() + "/class/core")
|
||||
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
# coding: utf-8
|
||||
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
|
||||
# sys.path.append("/usr/local/lib/python3.6/site-packages")
|
||||
|
||||
|
||||
class mysqlDb:
|
||||
__DB_PASS = None
|
||||
__DB_USER = 'root'
|
||||
__DB_PORT = 3306
|
||||
__DB_HOST = 'localhost'
|
||||
__DB_NAME = 'test'
|
||||
__DB_CONN = None
|
||||
__DB_CUR = None
|
||||
__DB_ERR = None
|
||||
__DB_CNF = '/etc/my.cnf'
|
||||
|
||||
def __Conn(self):
|
||||
'''连接MYSQL数据库'''
|
||||
try:
|
||||
socket = '/www/server/mysql/mysql.sock'
|
||||
try:
|
||||
import MySQLdb
|
||||
except Exception as ex:
|
||||
self.__DB_ERR = ex
|
||||
return False
|
||||
try:
|
||||
self.__DB_CONN = MySQLdb.connect(host=self.__DB_HOST, user=self.__DB_USER, passwd=self.__DB_PASS,
|
||||
port=self.__DB_PORT, db=self.__DB_NAME, charset="utf8", connect_timeout=10, unix_socket=socket)
|
||||
except MySQLdb.Error as e:
|
||||
self.__DB_HOST = '127.0.0.1'
|
||||
self.__DB_CONN = MySQLdb.connect(host=self.__DB_HOST, user=self.__DB_USER, passwd=self.__DB_PASS,
|
||||
port=self.__DB_PORT, db=self.__DB_NAME, charset="utf8", connect_timeout=10, unix_socket=socket)
|
||||
self.__DB_CUR = self.__DB_CONN.cursor()
|
||||
return True
|
||||
|
||||
except MySQLdb.Error as e:
|
||||
self.__DB_ERR = e
|
||||
return False
|
||||
|
||||
def setHost(self, host):
|
||||
self.__DB_HOST = host
|
||||
|
||||
def setPwd(self, pwd):
|
||||
self.__DB_PASS = pwd
|
||||
|
||||
def setUser(self, user):
|
||||
self.__DB_USER = user
|
||||
|
||||
def setPort(self, port):
|
||||
self.__DB_PORT = port
|
||||
|
||||
def setDb(self, name):
|
||||
self.__DB_NAME = name
|
||||
|
||||
def getPwd(self):
|
||||
return self.__DB_PASS
|
||||
|
||||
def execute(self, sql):
|
||||
# 执行SQL语句返回受影响行
|
||||
if not self.__Conn():
|
||||
return self.__DB_ERR
|
||||
try:
|
||||
result = self.__DB_CUR.execute(sql)
|
||||
self.__DB_CONN.commit()
|
||||
self.__Close()
|
||||
return result
|
||||
except Exception as ex:
|
||||
return ex
|
||||
|
||||
def query(self, sql):
|
||||
# 执行SQL语句返回数据集
|
||||
if not self.__Conn():
|
||||
return self.__DB_ERR
|
||||
try:
|
||||
self.__DB_CUR.execute(sql)
|
||||
result = self.__DB_CUR.fetchall()
|
||||
# 将元组转换成列表
|
||||
# data = map(list, result)
|
||||
self.__Close()
|
||||
return result
|
||||
except Exception as ex:
|
||||
return "error: " + str(ex)
|
||||
|
||||
# 关闭连接
|
||||
def __Close(self):
|
||||
self.__DB_CUR.close()
|
||||
self.__DB_CONN.close()
|
||||
+15
-20
@@ -31,9 +31,6 @@ def getPluginName():
|
||||
def getPluginDir():
|
||||
return mw.getPluginDir() + '/' + getPluginName()
|
||||
|
||||
sys.path.append(getPluginDir() + "/class")
|
||||
import mysqlDb
|
||||
|
||||
|
||||
def getServerDir():
|
||||
return mw.getServerDir() + '/' + getPluginName()
|
||||
@@ -235,16 +232,19 @@ def getDbConfValue():
|
||||
|
||||
|
||||
def pMysqlDb(conf):
|
||||
|
||||
host = conf['HOST'].split(':')
|
||||
conn = mysqlDb.mysqlDb()
|
||||
# pymysql
|
||||
db = mw.getMyORM()
|
||||
# MySQLdb |
|
||||
# db = mw.getMyORMDb()
|
||||
|
||||
conn.setHost(host[0])
|
||||
conn.setUser(conf['USER'])
|
||||
conn.setPwd(conf['PASSWD'])
|
||||
conn.setPort(int(host[1]))
|
||||
conn.setDb(conf['NAME'])
|
||||
return conn
|
||||
db.setPort(int(host[1]))
|
||||
db.setUser(conf['USER'])
|
||||
db.setPwd(conf['PASSWD'])
|
||||
db.setDbName(conf['NAME'])
|
||||
# db.setSocket(getSocketFile())
|
||||
db.setCharset("utf8")
|
||||
return db
|
||||
|
||||
|
||||
def pSqliteDb(conf):
|
||||
@@ -388,7 +388,7 @@ def postReceiveLog():
|
||||
def getGogsConf():
|
||||
conf = getConf()
|
||||
if not os.path.exists(conf):
|
||||
return mw.returnJson(False, "请先安装初始化!")
|
||||
return mw.returnJson(False, "请先安装初始化!<br/>默认地址:http://" + mw.getLocalIp() + ":3000")
|
||||
|
||||
gets = [
|
||||
{'name': 'DOMAIN', 'type': -1, 'ps': '服务器域名'},
|
||||
@@ -455,7 +455,7 @@ def userList():
|
||||
|
||||
conf = getConf()
|
||||
if not os.path.exists(conf):
|
||||
return mw.returnJson(False, "请先安装初始化!")
|
||||
return mw.returnJson(False, "请先安装初始化!<br/>默认地址:http://" + mw.getLocalIp() + ":3000")
|
||||
|
||||
import math
|
||||
args = getArgs()
|
||||
@@ -476,7 +476,7 @@ def userList():
|
||||
|
||||
start = (page - 1) * page_size
|
||||
list_count = pQuery('select count(id) as num from user')
|
||||
count = list_count[0][0]
|
||||
count = list_count[0]["num"]
|
||||
list_data = pQuery(
|
||||
'select id,name,email from user order by id desc limit ' + str(start) + ',' + str(page_size))
|
||||
data['list'] = mw.getPage({'count': count, 'p': page,
|
||||
@@ -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()
|
||||
|
||||
@@ -29,6 +29,8 @@ getBit(){
|
||||
|
||||
Install_gogs()
|
||||
{
|
||||
pip3 install mysqlclient
|
||||
|
||||
mkdir -p $serverPath/source/gogs
|
||||
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
|
||||
@@ -163,11 +163,11 @@ function gogsUserList(page, search) {
|
||||
|
||||
ulist = rdata['data']['data'];
|
||||
for (i in ulist){
|
||||
email = ulist[i][2] == '' ? '无' : ulist[i][2];
|
||||
content += '<tr><td>'+ulist[i][0]+'</td>'+
|
||||
'<td>'+ulist[i][1]+'</td>'+
|
||||
email = ulist[i]["email"] == '' ? '无' : ulist[i]["email"];
|
||||
content += '<tr><td>'+ulist[i]["id"]+'</td>'+
|
||||
'<td>'+ulist[i]["name"]+'</td>'+
|
||||
'<td>'+email+'</td>'+
|
||||
'<td><a class="btlink" onclick="userProjectList(\''+ulist[i][1]+'\')">项目管理</a></td>'+
|
||||
'<td><a class="btlink" onclick="userProjectList(\''+ulist[i]["name"]+'\')">项目管理</a></td>'+
|
||||
'</tr>';
|
||||
}
|
||||
|
||||
|
||||
Executable
+37
@@ -0,0 +1,37 @@
|
||||
global
|
||||
daemon
|
||||
log 127.0.0.1 local0
|
||||
pidfile /tmp/haproxy.pid
|
||||
maxconn 4000
|
||||
user haproxy
|
||||
group haproxy
|
||||
|
||||
|
||||
defaults
|
||||
mode http
|
||||
log global
|
||||
option httplog
|
||||
timeout connect 10s
|
||||
timeout client 15s
|
||||
timeout server 15s
|
||||
|
||||
|
||||
listen stats
|
||||
mode http
|
||||
bind *:10800
|
||||
stats enable
|
||||
stats uri /haproxy
|
||||
stats realm Haproxy\ Statistics
|
||||
stats auth admin:admin
|
||||
|
||||
frontend http-in
|
||||
bind *:1080
|
||||
default_backend servers
|
||||
option forwardfor
|
||||
option httpclose
|
||||
|
||||
backend servers
|
||||
balance roundrobin
|
||||
server web1 0.0.0.0:9090 check
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.5 KiB |
Executable
+18
@@ -0,0 +1,18 @@
|
||||
<div class="bt-form">
|
||||
<div class="bt-w-main">
|
||||
<div class="bt-w-menu">
|
||||
<p class="bgw" onclick="pluginService('haproxy');">服务</p>
|
||||
<p onclick="pluginInitD('haproxy');">自启动</p>
|
||||
<p onclick="pluginConfigTpl('haproxy');">配置修改</p>
|
||||
<p onclick="pluginLogs('haproxy','','run_log',30);">运行日志</p>
|
||||
</div>
|
||||
<div class="bt-w-con pd15">
|
||||
<div class="soft-man-con"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$.getScript( "/plugins/file?name=haproxy&f=js/haproxy.js", function(){
|
||||
pluginService('haproxy');
|
||||
});
|
||||
</script>
|
||||
Executable
+253
@@ -0,0 +1,253 @@
|
||||
# coding:utf-8
|
||||
|
||||
import sys
|
||||
import io
|
||||
import os
|
||||
import time
|
||||
import re
|
||||
import string
|
||||
import subprocess
|
||||
|
||||
sys.path.append(os.getcwd() + "/class/core")
|
||||
import mw
|
||||
|
||||
app_debug = False
|
||||
if mw.isAppleSystem():
|
||||
app_debug = True
|
||||
|
||||
|
||||
def getPluginName():
|
||||
return 'haproxy'
|
||||
|
||||
|
||||
def getPluginDir():
|
||||
return mw.getPluginDir() + '/' + getPluginName()
|
||||
|
||||
|
||||
def getServerDir():
|
||||
return mw.getServerDir() + '/' + getPluginName()
|
||||
|
||||
|
||||
def getInitDFile():
|
||||
if app_debug:
|
||||
return '/tmp/' + getPluginName()
|
||||
return '/etc/init.d/' + getPluginName()
|
||||
|
||||
|
||||
def getConfTpl():
|
||||
path = getPluginDir() + "/conf/haproxy.conf"
|
||||
return path
|
||||
|
||||
|
||||
def getConf():
|
||||
path = getServerDir() + "/haproxy.conf"
|
||||
return path
|
||||
|
||||
|
||||
def getInitDTpl():
|
||||
path = getPluginDir() + "/init.d/" + getPluginName() + ".tpl"
|
||||
return path
|
||||
|
||||
|
||||
def getArgs():
|
||||
args = sys.argv[2:]
|
||||
tmp = {}
|
||||
args_len = len(args)
|
||||
|
||||
if args_len == 1:
|
||||
t = args[0].strip('{').strip('}')
|
||||
t = t.split(':')
|
||||
tmp[t[0]] = t[1]
|
||||
elif args_len > 1:
|
||||
for i in range(len(args)):
|
||||
t = args[i].split(':')
|
||||
tmp[t[0]] = t[1]
|
||||
return tmp
|
||||
|
||||
|
||||
def checkArgs(data, ck=[]):
|
||||
for i in range(len(ck)):
|
||||
if not ck[i] in data:
|
||||
return (False, mw.returnJson(False, '参数:(' + ck[i] + ')没有!'))
|
||||
return (True, mw.returnJson(True, 'ok'))
|
||||
|
||||
|
||||
def configTpl():
|
||||
path = getPluginDir() + '/tpl'
|
||||
pathFile = os.listdir(path)
|
||||
tmp = []
|
||||
for one in pathFile:
|
||||
file = path + '/' + one
|
||||
tmp.append(file)
|
||||
return mw.getJson(tmp)
|
||||
|
||||
|
||||
def readConfigTpl():
|
||||
args = getArgs()
|
||||
data = checkArgs(args, ['file'])
|
||||
if not data[0]:
|
||||
return data[1]
|
||||
|
||||
content = mw.readFile(args['file'])
|
||||
content = contentReplace(content)
|
||||
return mw.returnJson(True, 'ok', content)
|
||||
|
||||
|
||||
def contentReplace(content):
|
||||
service_path = mw.getServerDir()
|
||||
content = content.replace('{$ROOT_PATH}', mw.getRootDir())
|
||||
content = content.replace('{$SERVER_PATH}', service_path)
|
||||
content = content.replace('{$SERVER_APP}', service_path + '/haproxy')
|
||||
return content
|
||||
|
||||
|
||||
def status():
|
||||
data = mw.execShell(
|
||||
"ps -ef|grep haproxy |grep -v grep | grep -v python | awk '{print $2}'")
|
||||
if data[0] == '':
|
||||
return 'stop'
|
||||
return 'start'
|
||||
|
||||
|
||||
def initDreplace():
|
||||
|
||||
file_tpl = getInitDTpl()
|
||||
service_path = os.path.dirname(os.getcwd())
|
||||
|
||||
initD_path = getServerDir() + '/init.d'
|
||||
if not os.path.exists(initD_path):
|
||||
os.mkdir(initD_path)
|
||||
file_bin = initD_path + '/' + getPluginName()
|
||||
|
||||
# initd replace
|
||||
if not os.path.exists(file_bin):
|
||||
content = mw.readFile(file_tpl)
|
||||
content = contentReplace(content)
|
||||
mw.writeFile(file_bin, content)
|
||||
mw.execShell('chmod +x ' + file_bin)
|
||||
|
||||
# config replace
|
||||
conf_bin = getConf()
|
||||
if not os.path.exists(conf_bin):
|
||||
conf_content = mw.readFile(getConfTpl())
|
||||
conf_content = contentReplace(conf_content)
|
||||
mw.writeFile(getServerDir() + '/haproxy.conf', conf_content)
|
||||
|
||||
# systemd
|
||||
systemDir = mw.systemdCfgDir()
|
||||
systemService = systemDir + '/haproxy.service'
|
||||
systemServiceTpl = getPluginDir() + '/init.d/haproxy.service.tpl'
|
||||
if os.path.exists(systemDir) and not os.path.exists(systemService):
|
||||
service_path = mw.getServerDir()
|
||||
se_content = mw.readFile(systemServiceTpl)
|
||||
se_content = se_content.replace('{$SERVER_PATH}', service_path)
|
||||
mw.writeFile(systemService, se_content)
|
||||
mw.execShell('systemctl daemon-reload')
|
||||
|
||||
return file_bin
|
||||
|
||||
|
||||
def haOp(method):
|
||||
file = initDreplace()
|
||||
|
||||
if not mw.isAppleSystem():
|
||||
data = mw.execShell('systemctl ' + method + ' haproxy')
|
||||
if data[1] == '':
|
||||
return 'ok'
|
||||
return 'fail'
|
||||
|
||||
data = mw.execShell(file + ' ' + method)
|
||||
if data[1] == '':
|
||||
return 'ok'
|
||||
return data[1]
|
||||
|
||||
|
||||
def start():
|
||||
return haOp('start')
|
||||
|
||||
|
||||
def stop():
|
||||
return haOp('stop')
|
||||
|
||||
|
||||
def restart():
|
||||
return haOp('restart')
|
||||
|
||||
|
||||
def reload():
|
||||
return haOp('reload')
|
||||
|
||||
|
||||
def initdStatus():
|
||||
if mw.isAppleSystem():
|
||||
return "Apple Computer does not support"
|
||||
|
||||
shell_cmd = 'systemctl status haproxy | grep loaded | grep "enabled;"'
|
||||
data = mw.execShell(shell_cmd)
|
||||
if data[0] == '':
|
||||
return 'fail'
|
||||
return 'ok'
|
||||
|
||||
|
||||
def initdInstall():
|
||||
if mw.isAppleSystem():
|
||||
return "Apple Computer does not support"
|
||||
|
||||
mw.execShell('systemctl enable haproxy')
|
||||
return 'ok'
|
||||
|
||||
|
||||
def initdUinstall():
|
||||
if mw.isAppleSystem():
|
||||
return "Apple Computer does not support"
|
||||
|
||||
mw.execShell('systemctl disable haproxy')
|
||||
return 'ok'
|
||||
|
||||
|
||||
def runLog():
|
||||
path = getConf()
|
||||
content = mw.readFile(path)
|
||||
rep = 'log\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
return tmp.groups()[0]
|
||||
|
||||
|
||||
def getPort():
|
||||
path = getConf()
|
||||
content = mw.readFile(path)
|
||||
rep = 'listen\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
return tmp.groups()[0]
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
func = sys.argv[1]
|
||||
if func == 'status':
|
||||
print(status())
|
||||
elif func == 'start':
|
||||
print(start())
|
||||
elif func == 'stop':
|
||||
print(stop())
|
||||
elif func == 'restart':
|
||||
print(restart())
|
||||
elif func == 'reload':
|
||||
print(reload())
|
||||
elif func == 'initd_status':
|
||||
print(initdStatus())
|
||||
elif func == 'initd_install':
|
||||
print(initdInstall())
|
||||
elif func == 'initd_uninstall':
|
||||
print(initdUinstall())
|
||||
elif func == 'conf':
|
||||
print(getConf())
|
||||
elif func == 'config_tpl':
|
||||
print(configTpl())
|
||||
elif func == 'read_config_tpl':
|
||||
print(readConfigTpl())
|
||||
elif func == 'run_log':
|
||||
print(runLog())
|
||||
elif func == 'query_log':
|
||||
print(queryLog())
|
||||
else:
|
||||
print('error')
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"sort": 7,
|
||||
"ps": "可靠、高性能的TCP/HTTP负载平衡器",
|
||||
"name": "haproxy",
|
||||
"title": "haproxy",
|
||||
"shell": "install.sh",
|
||||
"versions":["2.6"],
|
||||
"updates":["2.6"],
|
||||
"tip": "soft",
|
||||
"checks": "server/haproxy",
|
||||
"path": "server/haproxy",
|
||||
"display": 1,
|
||||
"author": "midoks",
|
||||
"date": "2022-08-26",
|
||||
"home": "https://www.haproxy.org/",
|
||||
"doc1": "https://www.haproxy.org/",
|
||||
"type": 0,
|
||||
"pid": "4"
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
[Unit]
|
||||
Description=he Reliable, High Performance TCP/HTTP Load Balancer
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
ExecStartPre={$SERVER_PATH}/haproxy/sbin/haproxy -c -f {$SERVER_PATH}/haproxy/haproxy.conf
|
||||
ExecStart={$SERVER_PATH}/haproxy/sbin/haproxy -D -f {$SERVER_PATH}/haproxy/haproxy.conf
|
||||
ExecReload={$SERVER_PATH}/haproxy/sbin/haproxy -f {$SERVER_PATH}/haproxy/haproxy.conf -c -q
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,119 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# chkconfig: - 85 15
|
||||
# description: HA-Proxy is a TCP/HTTP reverse proxy which is particularly suited \
|
||||
# for high availability environments.
|
||||
# processname: haproxy
|
||||
# config: /etc/haproxy/haproxy.cfg
|
||||
# pidfile: /var/run/haproxy.pid
|
||||
# Script Author: Simon Matter <simon.matter@invoca.ch>
|
||||
# Version: 2004060600
|
||||
# Source function library.
|
||||
|
||||
if [ -f /etc/init.d/functions ]; then
|
||||
. /etc/init.d/functions
|
||||
elif [ -f /etc/rc.d/init.d/functions ] ; then
|
||||
. /etc/rc.d/init.d/functions
|
||||
else
|
||||
echo ".."
|
||||
fi
|
||||
|
||||
# Source networking configuration.
|
||||
if [ -f /etc/sysconfig/network ];then
|
||||
. /etc/sysconfig/network
|
||||
fi
|
||||
|
||||
# Check that networking is up.
|
||||
# [ ${NETWORKING} = "no" ] && exit 0
|
||||
|
||||
HAPROXYDIR={$SERVER_PATH}/haproxy
|
||||
BASENAME=haproxy
|
||||
|
||||
# This is our service name
|
||||
|
||||
#BASENAME=`basename $0`
|
||||
#if [ -L $0 ]; then
|
||||
# BASENAME=`find $0 -name $BASENAME -printf %l`
|
||||
# BASENAME=`basename $BASENAME`
|
||||
#fi
|
||||
|
||||
[ -f $HAPROXYDIR/etc/$BASENAME.conf ] || exit 1
|
||||
|
||||
RETVAL=0
|
||||
|
||||
start() {
|
||||
$HAPROXYDIR/sbin/$BASENAME -c -q -f $HAPROXYDIR/etc/$BASENAME.conf
|
||||
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Errors found in configuration file, check it with '$BASENAME check'."
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo -n "Starting $BASENAME: "
|
||||
daemon $HAPROXYDIR/sbin/$BASENAME -D -f $HAPROXYDIR/etc/$BASENAME.conf
|
||||
RETVAL=$?
|
||||
# echo
|
||||
# [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$BASENAME
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
|
||||
stop() {
|
||||
|
||||
echo -n "Shutting down $BASENAME: "
|
||||
killproc $BASENAME -USR1
|
||||
|
||||
RETVAL=$?
|
||||
echo
|
||||
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$BASENAME
|
||||
[ $RETVAL -eq 0 ] && rm -f /var/run/$BASENAME.pid
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
restart() {
|
||||
$HAPROXYDIR/sbin/$BASENAME -c -q -f $HAPROXYDIR/etc/$BASENAME.conf
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Errors found in configuration file, check it with '$BASENAME check'."
|
||||
return 1
|
||||
fi
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
reload() {
|
||||
$HAPROXYDIR/sbin/$BASENAME -c -q -f $HAPROXYDIR/etc/$BASENAME.conf
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Errors found in configuration file, check it with '$BASENAME check'."
|
||||
return 1
|
||||
fi
|
||||
$HAPROXYDIR/sbin/$BASENAME -D -f $HAPROXYDIR/$BASENAME.conf -p /var/run/$BASENAME.pid -sf $(cat /var/run/$BASENAME.pid)
|
||||
}
|
||||
|
||||
check() {
|
||||
$HAPROXYDIR/sbin/$BASENAME -c -q -V -f $HAPROXYDIR/etc/$BASENAME.conf
|
||||
}
|
||||
|
||||
rhstatus() {
|
||||
status $BASENAME
|
||||
}
|
||||
|
||||
condrestart() {
|
||||
[ -e /var/lock/subsys/$BASENAME ] && restart || :
|
||||
}
|
||||
|
||||
# See how we were called.
|
||||
case "$1" in
|
||||
start) start ;;
|
||||
stop) stop ;;
|
||||
restart) restart;;
|
||||
reload) reload;;
|
||||
condrestart) condrestart ;;
|
||||
status) rhstatus ;;
|
||||
check) check ;;
|
||||
*)
|
||||
echo $"Usage: $BASENAME {start|stop|restart|reload|condrestart|status|check}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $?
|
||||
Executable
+52
@@ -0,0 +1,52 @@
|
||||
#!/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")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
|
||||
|
||||
action=$1
|
||||
type=$2
|
||||
|
||||
echo $action $type
|
||||
|
||||
if id haproxy &> /dev/null ;then
|
||||
echo "haproxy UID is `id -u haproxy`"
|
||||
echo "haproxy Shell is `grep "^haproxy:" /etc/passwd |cut -d':' -f7 `"
|
||||
else
|
||||
groupadd haproxy
|
||||
useradd -g haproxy haproxy
|
||||
fi
|
||||
|
||||
if [ "${2}" == "" ];then
|
||||
echo '缺少安装脚本...' > $install_tmp
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ ! -d $curPath/versions/$2 ];then
|
||||
echo '缺少安装脚本2...' > $install_tmp
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "${action}" == "uninstall" ];then
|
||||
|
||||
if [ -f /usr/lib/systemd/system/haproxy.service ] || [ -f /lib/systemd/system/haproxy.service ];then
|
||||
systemctl stop haproxy
|
||||
systemctl disable haproxy
|
||||
rm -rf /usr/lib/systemd/system/haproxy.service
|
||||
rm -rf /lib/systemd/system/haproxy.service
|
||||
systemctl daemon-reload
|
||||
fi
|
||||
fi
|
||||
|
||||
sh -x $curPath/versions/$2/install.sh $1
|
||||
|
||||
if [ "${action}" == "install" ] && [ -d $serverPath/haproxy ];then
|
||||
#初始化
|
||||
cd ${rootPath} && python3 ${rootPath}/plugins/haproxy/index.py start ${type}
|
||||
cd ${rootPath} && python3 ${rootPath}/plugins/haproxy/index.py initd_install ${type}
|
||||
fi
|
||||
Executable
+53
@@ -0,0 +1,53 @@
|
||||
function spPostMin(method, args, callback){
|
||||
|
||||
var req_data = {};
|
||||
req_data['name'] = 'haproxy';
|
||||
req_data['func'] = method;
|
||||
|
||||
if (typeof(args) != 'undefined' && args!=''){
|
||||
req_data['args'] = JSON.stringify(args);
|
||||
}
|
||||
|
||||
$.post('/plugins/run', req_data, function(data) {
|
||||
if (!data.status){
|
||||
layer.msg(data.msg,{icon:0,time:2000,shade: [0.3, '#000']});
|
||||
return;
|
||||
}
|
||||
|
||||
if(typeof(callback) == 'function'){
|
||||
callback(data);
|
||||
}
|
||||
},'json');
|
||||
}
|
||||
|
||||
function spPost(method, args, callback){
|
||||
var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 });
|
||||
spPostMin(method,args,function(data){
|
||||
layer.close(loadT);
|
||||
if(typeof(callback) == 'function'){
|
||||
callback(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function secToTime(s) {
|
||||
var t;
|
||||
if(s > -1){
|
||||
var hour = Math.floor(s/3600);
|
||||
var min = Math.floor(s/60) % 60;
|
||||
var sec = s % 60;
|
||||
if(hour < 10) {
|
||||
t = '0'+ hour + ":";
|
||||
} else {
|
||||
t = hour + ":";
|
||||
}
|
||||
|
||||
if(min < 10){t += "0";}
|
||||
t += min + ":";
|
||||
if(sec < 10){t += "0";}
|
||||
t += sec.toFixed(2);
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
Executable
+70
@@ -0,0 +1,70 @@
|
||||
#!/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")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
sysName=`uname`
|
||||
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
|
||||
|
||||
bash ${rootPath}/scripts/getos.sh
|
||||
OSNAME=`cat ${rootPath}/data/osname.pl`
|
||||
OSNAME_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
|
||||
|
||||
|
||||
VERSION=2.6.4
|
||||
MIN_VERSION=2.6
|
||||
Install_App()
|
||||
{
|
||||
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
mkdir -p $serverPath/haproxy
|
||||
|
||||
APP_DIR=${serverPath}/source/haproxy
|
||||
mkdir -p $APP_DIR
|
||||
|
||||
if [ ! -f ${APP_DIR}/haproxy-${VERSION}.tar.gz ];then
|
||||
if [ $sysName == 'Darwin' ]; then
|
||||
wget -O ${APP_DIR}/haproxy-${VERSION}.tar.gz https://www.haproxy.org/download/${MIN_VERSION}/src/haproxy-${VERSION}.tar.gz
|
||||
else
|
||||
curl -sSLo ${APP_DIR}/haproxy-${VERSION}.tar.gz https://www.haproxy.org/download/${MIN_VERSION}/src/haproxy-${VERSION}.tar.gz
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -f ${APP_DIR}/haproxy-${VERSION}.tar.gz ];then
|
||||
curl -sSLo ${APP_DIR}/haproxy-${VERSION}.tar.gz https://www.haproxy.org/download/${MIN_VERSION}/src/haproxy-${VERSION}.tar.gz
|
||||
fi
|
||||
|
||||
|
||||
cd ${APP_DIR} && tar -zxvf haproxy-${VERSION}.tar.gz
|
||||
|
||||
if [ "$OSNAME" == "macos" ];then
|
||||
cd ${APP_DIR}/haproxy-${VERSION} && make TARGET=osx && make install PREFIX=$serverPath/haproxy
|
||||
else
|
||||
cd ${APP_DIR}/haproxy-${VERSION} && make TARGET=linux-glibc && make install PREFIX=$serverPath/haproxy
|
||||
fi
|
||||
|
||||
echo $MIN_VERSION > $serverPath/haproxy/version.pl
|
||||
echo 'Install_HA' > $install_tmp
|
||||
}
|
||||
|
||||
Uninstall_App()
|
||||
{
|
||||
if [ -f $serverPath/haproxy/initd/haproxy ];then
|
||||
$serverPath/haproxy/initd/haproxy stop
|
||||
fi
|
||||
|
||||
rm -rf $serverPath/haproxy
|
||||
echo "Uninstall_HA" > $install_tmp
|
||||
}
|
||||
|
||||
action=$1
|
||||
if [ "${1}" == 'install' ];then
|
||||
Install_App
|
||||
else
|
||||
Uninstall_App
|
||||
fi
|
||||
@@ -45,11 +45,11 @@ skip-name-resolve = on
|
||||
|
||||
log-bin=mysql-bin
|
||||
binlog_format=mixed
|
||||
expire_logs_days = 10
|
||||
slow_query_log=1
|
||||
slow-query-log-file={$SERVER_APP_PATH}/data/mysql-slow.log
|
||||
long_query_time=3
|
||||
#log_queries_not_using_indexes=on
|
||||
binlog-expire-logs-seconds = 2592000
|
||||
|
||||
relay-log=mdserver
|
||||
relay-log-index=mdserver
|
||||
|
||||
+48
-29
@@ -150,7 +150,7 @@ def pSqliteDb(dbname='databases'):
|
||||
return conn
|
||||
|
||||
|
||||
def pMysqlDb():
|
||||
def pMysqlDb(name=''):
|
||||
# pymysql
|
||||
db = mw.getMyORM()
|
||||
# MySQLdb |
|
||||
@@ -159,6 +159,7 @@ def pMysqlDb():
|
||||
db.setDbConf(getConf())
|
||||
db.setPort(getDbPort())
|
||||
db.setSocket(getSocketFile())
|
||||
db.setDbName(name)
|
||||
|
||||
pwd = pSqliteDb('config').where('id=?', (1,)).getField('mysql_root')
|
||||
db.setPwd(pwd)
|
||||
@@ -303,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)
|
||||
|
||||
|
||||
@@ -631,7 +632,7 @@ def isSqlError(mysqlMsg):
|
||||
|
||||
|
||||
def __createUser(dbname, username, password, address):
|
||||
pdb = pMysqlDb()
|
||||
pdb = pMysqlDb('mysql')
|
||||
|
||||
if username == 'root':
|
||||
dbname = '*'
|
||||
@@ -691,8 +692,8 @@ def importDbBackup():
|
||||
mw.execShell(cmd)
|
||||
|
||||
pwd = pSqliteDb('config').where('id=?', (1,)).getField('mysql_root')
|
||||
|
||||
mysql_cmd = mw.getRootDir() + '/server/mysql/bin/mysql -uroot -p' + pwd + \
|
||||
sock = getSocketFile()
|
||||
mysql_cmd = getServerDir() + '/bin/mysql -S ' + sock + ' -uroot -p' + pwd + \
|
||||
' ' + name + ' < ' + file_path_sql
|
||||
|
||||
# print(mysql_cmd)
|
||||
@@ -797,7 +798,7 @@ def syncGetDatabases():
|
||||
if isError != None:
|
||||
return isError
|
||||
users = pdb.query(
|
||||
"select User,Host from mysql.user where User!='root' AND Host!='localhost' AND Host!=''")
|
||||
"select User,Host from user where User!='root' AND Host!='localhost' AND Host!=''")
|
||||
nameArr = ['information_schema', 'performance_schema', 'mysql', 'sys']
|
||||
n = 0
|
||||
|
||||
@@ -893,16 +894,19 @@ def setRootPwd(version=''):
|
||||
|
||||
password = args['password']
|
||||
try:
|
||||
pdb = pMysqlDb()
|
||||
pdb = pMysqlDb('mysql')
|
||||
result = pdb.query("show databases")
|
||||
isError = isSqlError(result)
|
||||
if isError != None:
|
||||
return isError
|
||||
|
||||
result = pdb.execute(
|
||||
"update mysql.user set Password=password('" + password + "') where User='root'")
|
||||
pdb.execute("flush privileges")
|
||||
cmd = "ALTER USER 'root'@'localhost' IDENTIFIED BY '" + password + "';"
|
||||
r = pdb.execute(cmd)
|
||||
# print(r)
|
||||
|
||||
pSqliteDb('config').where('id=?', (1,)).save('mysql_root', (password,))
|
||||
orm = pMysqlDb()
|
||||
orm.execute("flush privileges")
|
||||
return mw.returnJson(True, '数据库root密码修改成功!')
|
||||
except Exception as ex:
|
||||
return mw.returnJson(False, '修改错误:' + str(ex))
|
||||
@@ -910,7 +914,7 @@ def setRootPwd(version=''):
|
||||
|
||||
def setUserPwd(version=''):
|
||||
args = getArgs()
|
||||
data = checkArgs(args, ['password', 'name'])
|
||||
data = checkArgs(args, ['password', 'name', 'id'])
|
||||
if not data[0]:
|
||||
return data[1]
|
||||
|
||||
@@ -920,16 +924,28 @@ def setUserPwd(version=''):
|
||||
try:
|
||||
pdb = pMysqlDb()
|
||||
psdb = pSqliteDb('databases')
|
||||
name = psdb.where('id=?', (uid,)).getField('name')
|
||||
data = psdb.field('id,name,accept').where('id=?', (uid,)).find()
|
||||
|
||||
result = pdb.execute("update mysql.user set Password=password('" +
|
||||
newpassword + "') where User='" + username + "'")
|
||||
cmd = "SET PASSWORD FOR '" + username + \
|
||||
"'@'localhost' = PASSWORD('" + newpassword + "')"
|
||||
r = pdb.execute(cmd)
|
||||
# print(cmd, r)
|
||||
|
||||
accept = data['accept']
|
||||
alist = accept.split(',')
|
||||
for x in alist:
|
||||
cmd = "SET PASSWORD FOR '" + username + \
|
||||
"'@'" + x + "' = PASSWORD('" + newpassword + "')"
|
||||
r = pdb.execute(cmd)
|
||||
# print(cmd, r)
|
||||
|
||||
pdb.execute("flush privileges")
|
||||
psdb.where("id=?", (uid,)).setField('password', newpassword)
|
||||
return mw.returnJson(True, mw.getInfo('修改数据库[{1}]密码成功!', (name,)))
|
||||
|
||||
orm = pMysqlDb()
|
||||
orm.execute("flush privileges")
|
||||
return mw.returnJson(True, mw.getInfo('修改数据库[{1}]密码成功!', (data['name'],)))
|
||||
except Exception as ex:
|
||||
return mw.returnJson(False, mw.getInfo('修改数据库[{1}]密码失败[{2}]!', (name, str(ex),)))
|
||||
return mw.returnJson(False, mw.getInfo('修改数据库[{1}]密码失败[{2}]!', (data['name'], str(ex),)))
|
||||
|
||||
|
||||
def setDbPs():
|
||||
@@ -1022,7 +1038,7 @@ def delDb():
|
||||
id = args['id']
|
||||
name = args['name']
|
||||
psdb = pSqliteDb('databases')
|
||||
pdb = pMysqlDb()
|
||||
pdb = pMysqlDb('mysql')
|
||||
find = psdb.where("id=?", (id,)).field(
|
||||
'id,pid,name,username,password,accept,ps,addtime').find()
|
||||
accept = find['accept']
|
||||
@@ -1031,7 +1047,7 @@ def delDb():
|
||||
# 删除MYSQL
|
||||
result = pdb.execute("drop database `" + name + "`")
|
||||
|
||||
users = pdb.query("select Host from mysql.user where User='" +
|
||||
users = pdb.query("select Host from user where User='" +
|
||||
username + "' AND Host!='localhost'")
|
||||
pdb.execute("drop user '" + username + "'@'localhost'")
|
||||
for us in users:
|
||||
@@ -1051,9 +1067,9 @@ def getDbAccess():
|
||||
if not data[0]:
|
||||
return data[1]
|
||||
username = args['username']
|
||||
pdb = pMysqlDb()
|
||||
pdb = pMysqlDb('mysql')
|
||||
|
||||
users = pdb.query("select Host from mysql.user where User='" +
|
||||
users = pdb.query("select Host from user where User='" +
|
||||
username + "' AND Host!='localhost'")
|
||||
|
||||
if len(users) < 1:
|
||||
@@ -1072,7 +1088,7 @@ def setDbAccess():
|
||||
return data[1]
|
||||
name = args['username']
|
||||
access = args['access']
|
||||
pdb = pMysqlDb()
|
||||
pdb = pMysqlDb('mysql')
|
||||
psdb = pSqliteDb('databases')
|
||||
|
||||
dbname = psdb.where('username=?', (name,)).getField('name')
|
||||
@@ -1083,7 +1099,7 @@ def setDbAccess():
|
||||
else:
|
||||
password = psdb.where("username=?", (name,)).getField('password')
|
||||
|
||||
users = pdb.query("select Host from mysql.user where User='" +
|
||||
users = pdb.query("select Host from user where User='" +
|
||||
name + "' AND Host!='localhost'")
|
||||
|
||||
for us in users:
|
||||
@@ -1105,11 +1121,11 @@ def setDbRw(version=''):
|
||||
uid = args['id']
|
||||
rw = args['rw']
|
||||
|
||||
pdb = pMysqlDb()
|
||||
pdb = pMysqlDb('mysql')
|
||||
psdb = pSqliteDb('databases')
|
||||
dbname = psdb.where("id=?", (uid,)).getField('name')
|
||||
users = pdb.query(
|
||||
"select Host from mysql.user where User='" + username + "'")
|
||||
"select Host from user where User='" + username + "'")
|
||||
|
||||
# show grants for demo@"127.0.0.1";
|
||||
for x in users:
|
||||
@@ -1374,7 +1390,7 @@ def setDbMasterAccess():
|
||||
pdb = pMysqlDb()
|
||||
psdb = pSqliteDb('master_replication_user')
|
||||
password = psdb.where("username=?", (username,)).getField('password')
|
||||
users = pdb.query("select Host from mysql.user where User='" +
|
||||
users = pdb.query("select Host from user where User='" +
|
||||
username + "' AND Host!='localhost'")
|
||||
for us in users:
|
||||
pdb.execute("drop user '" + username + "'@'" + us["Host"] + "'")
|
||||
@@ -1706,7 +1722,7 @@ def delMasterRepSlaveUser(version=''):
|
||||
pdb.execute("drop user '" + name + "'@'%'")
|
||||
pdb.execute("drop user '" + name + "'@'localhost'")
|
||||
|
||||
users = pdb.query("select Host from mysql.user where User='" +
|
||||
users = pdb.query("select Host from user where User='" +
|
||||
name + "' AND Host!='localhost'")
|
||||
for us in users:
|
||||
pdb.execute("drop user '" + name + "'@'" + us["Host"] + "'")
|
||||
@@ -2164,8 +2180,11 @@ def installPreInspection(version):
|
||||
|
||||
|
||||
def uninstallPreInspection(version):
|
||||
# return "请手动删除MySQL[{}]".format(version)
|
||||
return 'ok'
|
||||
stop(version)
|
||||
if mw.isDebugMode():
|
||||
return 'ok'
|
||||
|
||||
return "请手动删除MariaDB[{}]<br/> rm -rf {}".format(version, getServerDir())
|
||||
|
||||
if __name__ == "__main__":
|
||||
func = sys.argv[1]
|
||||
|
||||
@@ -445,10 +445,9 @@ function syncToDatabase(type){
|
||||
|
||||
function setRootPwd(type, pwd){
|
||||
if (type==1){
|
||||
var data = $("#mod_pwd").serialize();
|
||||
myPost('set_root_pwd', data, function(data){
|
||||
var password = $("#MyPassword").val();
|
||||
myPost('set_root_pwd', {password:password}, function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
// console.log(rdata);
|
||||
showMsg(rdata.msg,function(){
|
||||
dbList();
|
||||
$('.layui-layer-close1').click();
|
||||
@@ -459,26 +458,23 @@ function setRootPwd(type, pwd){
|
||||
|
||||
var index = layer.open({
|
||||
type: 1,
|
||||
skin: 'demo-class',
|
||||
area: '500px',
|
||||
title: '修改数据库密码',
|
||||
closeBtn: 1,
|
||||
shift: 5,
|
||||
btn:["提交","关闭"],
|
||||
shadeClose: true,
|
||||
content: "<form class='bt-form pd20 pb70' id='mod_pwd'>\
|
||||
content: "<form class='bt-form pd20' id='mod_pwd'>\
|
||||
<div class='line'>\
|
||||
<span class='tname'>root密码</span>\
|
||||
<div class='info-r'><input class='bt-input-text mr5' type='text' name='password' id='MyPassword' style='width:330px' value='"+pwd+"' /><span title='随机密码' class='glyphicon glyphicon-repeat cursor' onclick='repeatPwd(16)'></span></div>\
|
||||
</div>\
|
||||
<div class='bt-form-submit-btn'>\
|
||||
<button id='my_mod_close' type='button' class='btn btn-danger btn-sm btn-title'>关闭</button>\
|
||||
<button type='button' class='btn btn-success btn-sm btn-title' onclick=\"setRootPwd(1)\" >提交</button>\
|
||||
<span class='tname'>root密码</span>\
|
||||
<div class='info-r'><input class='bt-input-text mr5' type='text' name='password' id='MyPassword' style='width:330px' value='"+pwd+"' />\
|
||||
<span title='随机密码' class='glyphicon glyphicon-repeat cursor' onclick='repeatPwd(16)'></span>\
|
||||
</div>\
|
||||
</div>\
|
||||
</form>",
|
||||
});
|
||||
|
||||
$('#my_mod_close').click(function(){
|
||||
$('.layui-layer-close1').click();
|
||||
yes:function(){
|
||||
setRootPwd(1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -632,12 +628,17 @@ function setDbPass(id, username, password){
|
||||
</div>\
|
||||
<div class='line'>\
|
||||
<span class='tname'>密码</span>\
|
||||
<div class='info-r'><input class='bt-input-text mr5' type='text' name='password' id='MyPassword' style='width:330px' value='"+password+"' /><span title='随机密码' class='glyphicon glyphicon-repeat cursor' onclick='repeatPwd(16)'></span></div>\
|
||||
<div class='info-r'>\
|
||||
<input class='bt-input-text mr5' type='text' name='password' id='MyPassword' style='width:330px' value='"+password+"' />\
|
||||
<span title='随机密码' class='glyphicon glyphicon-repeat cursor' onclick='repeatPwd(16)'></span></div>\
|
||||
</div>\
|
||||
<input type='hidden' name='id' value='"+id+"'>\
|
||||
</form>",
|
||||
yes:function(index){
|
||||
var data = $("#mod_pwd").serialize();
|
||||
var data = {};
|
||||
data['name'] = $('input[name=name]').val();
|
||||
data['password'] = $('#MyPassword').val();
|
||||
data['id'] = $('input[name=id]').val();
|
||||
myPost('set_user_pwd', data, function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
showMsg(rdata.msg,function(){
|
||||
@@ -809,7 +810,14 @@ function openPhpmyadmin(name,username,password){
|
||||
layer.msg('phpMyAdmin未启动',{icon:2,shade: [0.3, '#000']});
|
||||
return;
|
||||
}
|
||||
// console.log(data);
|
||||
|
||||
data = syncPost('/plugins/run',{'name':'phpmyadmin','func':'get_cfg'});
|
||||
var rdata = $.parseJSON(data.data);
|
||||
if (rdata.choose != 'mariadb'){
|
||||
layer.msg('当前为['+rdata.choose+']模式,若要使用请切换模式.',{icon:2,shade: [0.3, '#000']});
|
||||
return;
|
||||
}
|
||||
|
||||
data = syncPost('/plugins/run',{'name':'phpmyadmin','func':'get_home_page'});
|
||||
var rdata = $.parseJSON(data.data);
|
||||
if (!rdata.status){
|
||||
|
||||
@@ -14,7 +14,7 @@ sysName=`uname`
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
mariadbDir=${serverPath}/source/mariadb
|
||||
|
||||
MY_VER=10.6.8
|
||||
MY_VER=10.6.9
|
||||
|
||||
Install_app()
|
||||
{
|
||||
@@ -57,10 +57,15 @@ Install_app()
|
||||
fi
|
||||
# ----- cpu end ------
|
||||
|
||||
# https://mirrors.aliyun.com/mariadb/mariadb-10.8.3/source/mariadb-10.8.3.tar.gz
|
||||
if [ ! -f ${mariadbDir}/mariadb-${MY_VER}.tar.gz ];then
|
||||
# https://mirrors.aliyun.com/mariadb/mariadb-10.8.3/source/mariadb-10.8.3.tar.gz
|
||||
wget -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://mirrors.aliyun.com/mariadb/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
|
||||
# wget -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://downloads.mariadb.org/interstitial/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
|
||||
wget --no-check-certificate -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://mirrors.aliyun.com/mariadb/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
|
||||
|
||||
fi
|
||||
|
||||
# https://downloads.mariadb.org/interstitial/mariadb-10.6.8/source/mariadb-10.6.8.tar.gz
|
||||
if [ "$?" != "0" ];then
|
||||
wget --no-check-certificate -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://downloads.mariadb.org/interstitial/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
|
||||
fi
|
||||
|
||||
if [ ! -d ${mariadbDir}/mariadb-${MY_VER} ];then
|
||||
@@ -71,10 +76,15 @@ Install_app()
|
||||
if [ "$sysName" == "Darwin" ];then
|
||||
OPTIONS='-DPLUGIN_TOKUDB=NO'
|
||||
fi
|
||||
|
||||
|
||||
INSTALL_CMD=cmake
|
||||
CMAKE3=`which cmake3`
|
||||
if [ "$?" == "0" ];then
|
||||
INSTALL_CMD=cmake3
|
||||
fi
|
||||
|
||||
if [ ! -d $serverPath/mariadb ];then
|
||||
cd ${mariadbDir}/mariadb-${MY_VER} && cmake \
|
||||
cd ${mariadbDir}/mariadb-${MY_VER} && $INSTALL_CMD \
|
||||
-DCMAKE_INSTALL_PREFIX=$serverPath/mariadb \
|
||||
-DMYSQL_DATADIR=$serverPath/mariadb/data/ \
|
||||
-DMYSQL_USER=mysql \
|
||||
|
||||
@@ -14,7 +14,7 @@ sysName=`uname`
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
mariadbDir=${serverPath}/source/mariadb
|
||||
|
||||
MY_VER=10.7.4
|
||||
MY_VER=10.7.5
|
||||
|
||||
Install_app()
|
||||
{
|
||||
@@ -58,14 +58,16 @@ Install_app()
|
||||
# ----- cpu end ------
|
||||
|
||||
if [ ! -f ${mariadbDir}/mariadb-${MY_VER}.tar.gz ];then
|
||||
wget -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://mirrors.aliyun.com/mariadb/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
|
||||
# wget -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://downloads.mariadb.org/interstitial/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
|
||||
wget --no-check-certificate -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://mirrors.aliyun.com/mariadb/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
|
||||
fi
|
||||
|
||||
if [ "$?" != "0" ];then
|
||||
wget --no-check-certificate -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://downloads.mariadb.org/interstitial/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
|
||||
fi
|
||||
|
||||
if [ ! -d ${mariadbDir}/mariadb-${MY_VER} ];then
|
||||
cd ${mariadbDir} && tar -zxvf ${mariadbDir}/mariadb-${MY_VER}.tar.gz
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -d $serverPath/mariadb ];then
|
||||
cd ${mariadbDir}/mariadb-${MY_VER} && cmake \
|
||||
|
||||
@@ -14,7 +14,7 @@ sysName=`uname`
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
mariadbDir=${serverPath}/source/mariadb
|
||||
|
||||
MY_VER=10.8.3
|
||||
MY_VER=10.8.4
|
||||
|
||||
Install_app()
|
||||
{
|
||||
@@ -58,8 +58,11 @@ Install_app()
|
||||
# ----- cpu end ------
|
||||
|
||||
if [ ! -f ${mariadbDir}/mariadb-${MY_VER}.tar.gz ];then
|
||||
wget -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://mirrors.aliyun.com/mariadb/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
|
||||
# wget -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://downloads.mariadb.org/interstitial/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
|
||||
wget --no-check-certificate -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://mirrors.aliyun.com/mariadb/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
|
||||
fi
|
||||
|
||||
if [ "$?" != "0" ];then
|
||||
wget --no-check-certificate -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://downloads.mariadb.org/interstitial/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
|
||||
fi
|
||||
|
||||
if [ ! -d ${mariadbDir}/mariadb-${MY_VER} ];then
|
||||
@@ -86,7 +89,7 @@ Install_app()
|
||||
make -j${cpuCore} && make install && make clean
|
||||
|
||||
if [ -d $serverPath/mariadb ];then
|
||||
echo '10.7' > $serverPath/mariadb/version.pl
|
||||
echo '10.8' > $serverPath/mariadb/version.pl
|
||||
echo '安装完成' > $install_tmp
|
||||
else
|
||||
# rm -rf ${mariadbDir}/mariadb-${MY_VER}
|
||||
|
||||
@@ -21,14 +21,26 @@ OSNAME=`cat ${rootPath}/data/osname.pl`
|
||||
SYS_VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Install_app_mac()
|
||||
{
|
||||
if [ ! -f $serverPath/source/mongodb-macos-x86_64-${VERSION}.tgz ];then
|
||||
wget -O $serverPath/source/mongodb-macos-x86_64-${VERSION}.tgz https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-${VERSION}.tgz
|
||||
mkdir -p $serverPath/mongodb
|
||||
if [ "$VERSION" == "5.0" ];then
|
||||
G_VERSION="5.0.11"
|
||||
elif [[ "$VERSION" == "4.4" ]]; then
|
||||
G_VERSION="4.4.11"
|
||||
fi
|
||||
|
||||
cd $serverPath/source && tar -zxvf mongodb-macos-x86_64-${VERSION}.tgz
|
||||
cd mongodb-macos-x86_64-${VERSION} && mv ./* $serverPath/mongodb
|
||||
if [ ! -f $serverPath/source/mongodb-macos-x86_64-${G_VERSION}.tgz ];then
|
||||
wget -O $serverPath/source/mongodb-macos-x86_64-${G_VERSION}.tgz https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-${G_VERSION}.tgz
|
||||
fi
|
||||
|
||||
cd $serverPath/source && tar -zxvf mongodb-macos-x86_64-${G_VERSION}.tgz
|
||||
cd mongodb-macos-x86_64-${G_VERSION} && mv ./* $serverPath/mongodb
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,97 +0,0 @@
|
||||
[client]
|
||||
user = root
|
||||
#password = your_password
|
||||
port = 3376
|
||||
socket = {$SERVER_APP_PATH}/mysql.sock
|
||||
default-character-set = UTF8MB4
|
||||
|
||||
[mysqld]
|
||||
pid-file = {$SERVER_APP_PATH}/data/mysql.pid
|
||||
user = mysql
|
||||
port = 3376
|
||||
mysqlx_port = 33760
|
||||
socket = {$SERVER_APP_PATH}/mysql.sock
|
||||
datadir = {$SERVER_APP_PATH}/data
|
||||
log-error = {$SERVER_APP_PATH}/data/error.log
|
||||
default_storage_engine = MyISAM
|
||||
|
||||
key_buffer_size = 8M
|
||||
table_open_cache = 32
|
||||
sort_buffer_size = 256K
|
||||
net_buffer_length = 4K
|
||||
read_buffer_size = 128K
|
||||
read_rnd_buffer_size = 256K
|
||||
myisam_sort_buffer_size = 4M
|
||||
thread_cache_size = 4
|
||||
lower_case_table_names=0
|
||||
tmp_table_size = 8M
|
||||
character-set-server = UTF8MB4
|
||||
|
||||
max_connections = 500
|
||||
max_connect_errors = 100
|
||||
open_files_limit = 2560
|
||||
max_allowed_packet = 128M
|
||||
|
||||
#skip-external-locking
|
||||
#skip-grant-tables
|
||||
#loose-skip-innodb
|
||||
#skip-networking
|
||||
#skip-name-resolve
|
||||
|
||||
log-bin=mysql-bin
|
||||
binlog_format=mixed
|
||||
server-id = 1
|
||||
slow_query_log=1
|
||||
slow-query-log-file={$SERVER_APP_PATH}/data/mysql-slow.log
|
||||
long_query_time=3
|
||||
#log_queries_not_using_indexes=on
|
||||
|
||||
relay-log=mdserver
|
||||
relay-log-index=mdserver
|
||||
|
||||
#master
|
||||
#binlog-do-db
|
||||
binlog-ignore-db = test
|
||||
binlog-ignore-db = mysql
|
||||
binlog-ignore-db = information_schema
|
||||
binlog-ignore-db = performance_schema
|
||||
|
||||
#slave
|
||||
log-slave-updates
|
||||
#replicate-do-db
|
||||
replicate-ignore-db = information_schema
|
||||
replicate-ignore-db = performance_schema
|
||||
replicate-ignore-db = mysql
|
||||
replicate-ignore-db = test
|
||||
|
||||
default_storage_engine = InnoDB
|
||||
innodb_data_home_dir = {$SERVER_APP_PATH}/data
|
||||
innodb_data_file_path = ibdata1:10M:autoextend
|
||||
innodb_log_group_home_dir = {$SERVER_APP_PATH}/data
|
||||
innodb_buffer_pool_size = 16M
|
||||
innodb_log_file_size = 5M
|
||||
innodb_log_buffer_size = 8M
|
||||
innodb_flush_log_at_trx_commit = 1
|
||||
innodb_lock_wait_timeout = 120
|
||||
innodb_max_dirty_pages_pct = 90
|
||||
innodb_read_io_threads = 1
|
||||
innodb_write_io_threads = 1
|
||||
innodb_file_per_table=1
|
||||
binlog_expire_logs_seconds=2592000
|
||||
|
||||
secure-file-priv={$SERVER_APP_PATH}/tmp
|
||||
|
||||
[mysqldump]
|
||||
quick
|
||||
|
||||
[mysql]
|
||||
no-auto-rehash
|
||||
|
||||
[myisamchk]
|
||||
key_buffer_size = 20M
|
||||
sort_buffer_size = 20M
|
||||
read_buffer = 2M
|
||||
write_buffer = 2M
|
||||
|
||||
[mysqlhotcopy]
|
||||
interactive-timeout
|
||||
@@ -1,98 +0,0 @@
|
||||
[client]
|
||||
user = root
|
||||
#password = your_password
|
||||
port = 3386
|
||||
socket = {$SERVER_APP_PATH}/mysql.sock
|
||||
default-character-set = UTF8MB4
|
||||
|
||||
[mysqld]
|
||||
default_authentication_plugin=mysql_native_password
|
||||
pid-file = {$SERVER_APP_PATH}/data/mysql.pid
|
||||
user = mysql
|
||||
port = 3386
|
||||
mysqlx_port = 33860
|
||||
socket = {$SERVER_APP_PATH}/mysql.sock
|
||||
datadir = {$SERVER_APP_PATH}/data
|
||||
log-error = {$SERVER_APP_PATH}/data/error.log
|
||||
default_storage_engine = MyISAM
|
||||
|
||||
key_buffer_size = 8M
|
||||
table_open_cache = 32
|
||||
sort_buffer_size = 256K
|
||||
net_buffer_length = 4K
|
||||
read_buffer_size = 128K
|
||||
read_rnd_buffer_size = 256K
|
||||
myisam_sort_buffer_size = 4M
|
||||
thread_cache_size = 4
|
||||
lower_case_table_names=0
|
||||
tmp_table_size = 8M
|
||||
character-set-server = UTF8MB4
|
||||
|
||||
max_connections = 500
|
||||
max_connect_errors = 100
|
||||
open_files_limit = 2560
|
||||
max_allowed_packet = 128M
|
||||
|
||||
#skip-external-locking
|
||||
#skip-grant-tables
|
||||
#loose-skip-innodb
|
||||
#skip-networking
|
||||
#skip-name-resolve
|
||||
|
||||
log-bin=mysql-bin
|
||||
binlog_format=mixed
|
||||
server-id = 1
|
||||
slow_query_log=1
|
||||
slow-query-log-file={$SERVER_APP_PATH}/data/mysql-slow.log
|
||||
long_query_time=3
|
||||
#log_queries_not_using_indexes=on
|
||||
|
||||
relay-log=mdserver
|
||||
relay-log-index=mdserver
|
||||
|
||||
#master
|
||||
#binlog-do-db
|
||||
binlog-ignore-db = test
|
||||
binlog-ignore-db = mysql
|
||||
binlog-ignore-db = information_schema
|
||||
binlog-ignore-db = performance_schema
|
||||
|
||||
#slave
|
||||
log_replica_updates
|
||||
#replicate-do-db
|
||||
replicate-ignore-db = information_schema
|
||||
replicate-ignore-db = performance_schema
|
||||
replicate-ignore-db = mysql
|
||||
replicate-ignore-db = test
|
||||
|
||||
default_storage_engine = InnoDB
|
||||
innodb_data_home_dir = {$SERVER_APP_PATH}/data
|
||||
innodb_data_file_path = ibdata1:10M:autoextend
|
||||
innodb_log_group_home_dir = {$SERVER_APP_PATH}/data
|
||||
innodb_buffer_pool_size = 16M
|
||||
innodb_log_file_size = 5M
|
||||
innodb_log_buffer_size = 8M
|
||||
innodb_flush_log_at_trx_commit = 1
|
||||
innodb_lock_wait_timeout = 120
|
||||
innodb_max_dirty_pages_pct = 90
|
||||
innodb_read_io_threads = 1
|
||||
innodb_write_io_threads = 1
|
||||
innodb_file_per_table=1
|
||||
binlog_expire_logs_seconds=2592000
|
||||
|
||||
secure-file-priv={$SERVER_APP_PATH}/tmp
|
||||
|
||||
[mysqldump]
|
||||
quick
|
||||
|
||||
[mysql]
|
||||
no-auto-rehash
|
||||
|
||||
[myisamchk]
|
||||
key_buffer_size = 20M
|
||||
sort_buffer_size = 20M
|
||||
read_buffer = 2M
|
||||
write_buffer = 2M
|
||||
|
||||
[mysqlhotcopy]
|
||||
interactive-timeout
|
||||
@@ -1,28 +0,0 @@
|
||||
CREATE TABLE IF NOT EXISTS `config` (
|
||||
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
`mysql_root` TEXT
|
||||
);
|
||||
|
||||
INSERT INTO `config` (`id`, `mysql_root`) VALUES (1, 'admin');
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `databases` (
|
||||
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
`pid` INTEGER,
|
||||
`name` TEXT,
|
||||
`username` TEXT,
|
||||
`password` TEXT,
|
||||
`accept` TEXT,
|
||||
`ps` TEXT,
|
||||
`addtime` TEXT
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `master_replication_user` (
|
||||
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
`username` TEXT,
|
||||
`password` TEXT,
|
||||
`accept` TEXT,
|
||||
`ps` TEXT,
|
||||
`addtime` TEXT
|
||||
);
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 KiB |
@@ -1,58 +0,0 @@
|
||||
<div class="bt-form">
|
||||
<div class='plugin_version'></div>
|
||||
<div class="bt-w-main">
|
||||
<div class="bt-w-menu">
|
||||
<script type="text/javascript">console.log($('.plugin_version').attr('version'));</script>
|
||||
<p class="bgw" onclick="pluginService('mysql-yum', $('.plugin_version').attr('version'));">服务</p>
|
||||
<p onclick="pluginInitD('mysql-yum', $('.plugin_version').attr('version'));">自启动</p>
|
||||
<p onclick="pluginConfig('mysql-yum', $('.plugin_version').attr('version'));">配置文件</p>
|
||||
<p onclick="myDbPos();">存储位置</p>
|
||||
<p onclick="myPort();">端口</p>
|
||||
<p onclick="runInfo();">当前状态</p>
|
||||
<p onclick="myPerfOpt();">性能优化</p>
|
||||
<p onclick="myLogs();">日志</p>
|
||||
<p onclick="pluginLogs('mysql-yum',$('.plugin_version').attr('version'),'error_log');">错误日志</p>
|
||||
<p onclick="pluginLogs('mysql-yum',$('.plugin_version').attr('version'),'show_log');">慢日志</p>
|
||||
<p onclick="dbList()">管理列表</p>
|
||||
</div>
|
||||
<div class="bt-w-con pd15">
|
||||
<div class="soft-man-con"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<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>
|
||||
<script type="text/javascript">
|
||||
resetPluginWinWidth(800);
|
||||
$.getScript( "/plugins/file?name=mysql-yum&f=js/mysql-yum.js", function(){
|
||||
pluginService('mysql-yum',$('.plugin_version').attr('version'));
|
||||
});
|
||||
</script>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,17 +0,0 @@
|
||||
{
|
||||
"title":"MySQL[YUM]",
|
||||
"tip":"soft",
|
||||
"name":"mysql-yum",
|
||||
"type":"运行环境",
|
||||
"ps":"一种关系数据库管理系统(极速安装)[YUM]!",
|
||||
"todo_versions":["5.7","8.0"],
|
||||
"versions":["5.7","8.0"],
|
||||
"shell":"install.sh",
|
||||
"install_pre_inspection":true,
|
||||
"checks":"server/mysql-yum",
|
||||
"path":"server/mysql-yum",
|
||||
"author":"mysql",
|
||||
"home":"https://dev.mysql.com/downloads/mysql",
|
||||
"date":"2022-06-29",
|
||||
"pid": "6"
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
# It's not recommended to modify this file in-place, because it will be
|
||||
# overwritten during package upgrades. If you want to customize, the
|
||||
# best way is to use systemctl edit:
|
||||
#
|
||||
# $ systemctl edit mysqld.service
|
||||
#
|
||||
# this will create file
|
||||
#
|
||||
# /etc/systemd/system/mysqld.service.d/override.conf
|
||||
#
|
||||
# which be parsed after the file mysqld.service itself is parsed.
|
||||
#
|
||||
# For example, if you want to increase mysql's open-files-limit to 20000
|
||||
# add following when editing with command above:
|
||||
#
|
||||
# [Service]
|
||||
# LimitNOFILE=20000
|
||||
#
|
||||
# Or if you require to execute pre and post scripts in the unit file as root, set
|
||||
# PermissionsStartOnly=true
|
||||
#
|
||||
# For more info about custom unit files, see systemd.unit(5) or
|
||||
# http://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom_unit_file.3F
|
||||
#
|
||||
# Don't forget to reload systemd daemon after you change unit configuration:
|
||||
# root> systemctl --system daemon-reload
|
||||
|
||||
[Unit]
|
||||
Description=MySQL 8.0 database server
|
||||
After=syslog.target
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
User=mysql
|
||||
Group=mysql
|
||||
|
||||
ExecStartPre=/usr/libexec/mysql-check-socket
|
||||
ExecStartPre=/usr/libexec/mysql-prepare-db-dir %n
|
||||
# Note: we set --basedir to prevent probes that might trigger SELinux alarms,
|
||||
# per bug #547485
|
||||
ExecStart=/usr/libexec/mysqld --defaults-file={$SERVER_PATH}/mysql-ya/etc/my.cnf --basedir=/usr --user=mysql
|
||||
ExecStartPost=/usr/libexec/mysql-check-upgrade
|
||||
ExecStopPost=/usr/libexec/mysql-wait-stop
|
||||
|
||||
# Give a reasonable amount of time for the server to start up/shut down
|
||||
TimeoutSec=300
|
||||
|
||||
# Place temp files in a secure directory, not /tmp
|
||||
PrivateTmp=false
|
||||
|
||||
Restart=on-failure
|
||||
|
||||
RestartPreventExitStatus=1
|
||||
|
||||
# Sets open_files_limit
|
||||
LimitNOFILE = 10000
|
||||
|
||||
# Set enviroment variable MYSQLD_PARENT_PID. This is required for SQL restart command.
|
||||
Environment=MYSQLD_PARENT_PID=1
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -1,46 +0,0 @@
|
||||
#!/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")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
|
||||
|
||||
# cd /www/server/mdserver-web/plugins/mysql-yum && bash install.sh install 8.0
|
||||
# cd /www/server/mdserver-web/plugins/mysql-yum && bash install.sh uninstall 8.0
|
||||
# cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/mysql-yum/index.py start 8.0
|
||||
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
|
||||
|
||||
action=$1
|
||||
type=$2
|
||||
|
||||
|
||||
|
||||
if [ "${2}" == "" ];then
|
||||
echo '缺少安装脚本...' > $install_tmp
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ ! -d $curPath/versions/$2 ];then
|
||||
echo '缺少安装脚本2...' > $install_tmp
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "${action}" == "uninstall" ];then
|
||||
|
||||
cd ${rootPath} && python3 ${rootPath}/plugins/mysql-yum/index.py stop ${type}
|
||||
cd ${rootPath} && python3 ${rootPath}/plugins/mysql-yum/index.py initd_uninstall ${type}
|
||||
cd $curPath
|
||||
fi
|
||||
|
||||
sh -x $curPath/versions/$2/install.sh $1
|
||||
|
||||
if [ "${action}" == "install" ];then
|
||||
# #初始化
|
||||
cd ${rootPath} && python3 ${rootPath}/plugins/mysql-yum/index.py start ${type}
|
||||
cd ${rootPath} && python3 ${rootPath}/plugins/mysql-yum/index.py initd_install ${type}
|
||||
fi
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,119 +0,0 @@
|
||||
# coding: utf-8
|
||||
#-----------------------------
|
||||
# 网站备份工具
|
||||
#-----------------------------
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
if sys.platform != 'darwin':
|
||||
os.chdir('/www/server/mdserver-web')
|
||||
|
||||
|
||||
chdir = os.getcwd()
|
||||
sys.path.append(chdir + '/class/core')
|
||||
|
||||
# reload(sys)
|
||||
# sys.setdefaultencoding('utf-8')
|
||||
|
||||
|
||||
import mw
|
||||
import db
|
||||
import time
|
||||
|
||||
|
||||
class backupTools:
|
||||
|
||||
def backupDatabase(self, name, count):
|
||||
db_path = mw.getServerDir() + '/mysql-ya'
|
||||
db_name = 'mysql'
|
||||
name = mw.M('databases').dbPos(db_path, 'mysql').where(
|
||||
'name=?', (name,)).getField('name')
|
||||
startTime = time.time()
|
||||
if not name:
|
||||
endDate = time.strftime('%Y/%m/%d %X', time.localtime())
|
||||
log = "数据库[" + name + "]不存在!"
|
||||
print("★[" + endDate + "] " + log)
|
||||
print(
|
||||
"----------------------------------------------------------------------------")
|
||||
return
|
||||
|
||||
backup_path = mw.getRootDir() + '/backup/database'
|
||||
if not os.path.exists(backup_path):
|
||||
mw.execShell("mkdir -p " + backup_path)
|
||||
|
||||
filename = backup_path + "/db_" + name + "_" + \
|
||||
time.strftime('%Y%m%d_%H%M%S', time.localtime()) + ".sql.gz"
|
||||
|
||||
import re
|
||||
mysql_root = mw.M('config').dbPos(db_path, db_name).where(
|
||||
"id=?", (1,)).getField('mysql_root')
|
||||
|
||||
mycnf = mw.readFile(db_path + '/etc/my.cnf')
|
||||
rep = "\[mysqldump\]\nuser=root"
|
||||
sea = "[mysqldump]\n"
|
||||
subStr = sea + "user=root\npassword=" + mysql_root + "\n"
|
||||
mycnf = mycnf.replace(sea, subStr)
|
||||
if len(mycnf) > 100:
|
||||
mw.writeFile(db_path + '/etc/my.cnf', mycnf)
|
||||
|
||||
mw.execShell(
|
||||
db_path + "/bin/mysqldump --opt --default-character-set=utf8 " + name + " | gzip > " + filename)
|
||||
|
||||
if not os.path.exists(filename):
|
||||
endDate = time.strftime('%Y/%m/%d %X', time.localtime())
|
||||
log = "数据库[" + name + "]备份失败!"
|
||||
print("★[" + endDate + "] " + log)
|
||||
print(
|
||||
"----------------------------------------------------------------------------")
|
||||
return
|
||||
|
||||
mycnf = mw.readFile(db_path + '/etc/my.cnf')
|
||||
mycnf = mycnf.replace(subStr, sea)
|
||||
if len(mycnf) > 100:
|
||||
mw.writeFile(db_path + '/etc/my.cnf', mycnf)
|
||||
|
||||
endDate = time.strftime('%Y/%m/%d %X', time.localtime())
|
||||
outTime = time.time() - startTime
|
||||
pid = mw.M('databases').dbPos(db_path, db_name).where(
|
||||
'name=?', (name,)).getField('id')
|
||||
|
||||
mw.M('backup').add('type,name,pid,filename,addtime,size', (1, os.path.basename(
|
||||
filename), pid, filename, endDate, os.path.getsize(filename)))
|
||||
log = "数据库[" + name + "]备份成功,用时[" + str(round(outTime, 2)) + u"]秒"
|
||||
mw.writeLog('计划任务', log)
|
||||
print("★[" + endDate + "] " + log)
|
||||
print("|---保留最新的[" + count + "]份备份")
|
||||
print("|---文件名:" + filename)
|
||||
|
||||
# 清理多余备份
|
||||
backups = mw.M('backup').where(
|
||||
'type=? and pid=?', ('1', pid)).field('id,filename').select()
|
||||
|
||||
num = len(backups) - int(count)
|
||||
if num > 0:
|
||||
for backup in backups:
|
||||
mw.execShell("rm -f " + backup['filename'])
|
||||
mw.M('backup').where('id=?', (backup['id'],)).delete()
|
||||
num -= 1
|
||||
print("|---已清理过期备份文件:" + backup['filename'])
|
||||
if num < 1:
|
||||
break
|
||||
|
||||
def backupDatabaseAll(self, save):
|
||||
db_path = mw.getServerDir() + '/mysql-ya'
|
||||
db_name = 'mysql'
|
||||
databases = mw.M('databases').dbPos(
|
||||
db_path, db_name).field('name').select()
|
||||
for database in databases:
|
||||
self.backupDatabase(database['name'], save)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
backup = backupTools()
|
||||
type = sys.argv[1]
|
||||
if type == 'database':
|
||||
if sys.argv[2] == 'ALL':
|
||||
backup.backupDatabaseAll(sys.argv[3])
|
||||
else:
|
||||
backup.backupDatabase(sys.argv[2], sys.argv[3])
|
||||
@@ -1,119 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#!/bin/bash
|
||||
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
|
||||
#https://dev.mysql.com/downloads/mysql/5.7.html
|
||||
#https://dev.mysql.com/downloads/file/?id=489855
|
||||
|
||||
curPath=`pwd`
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
sysName=`uname`
|
||||
|
||||
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
mysqlDir=${serverPath}/source/mysql
|
||||
|
||||
|
||||
_os=`uname`
|
||||
if [ ${_os} == "Darwin" ]; then
|
||||
OSNAME='macos'
|
||||
elif grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then
|
||||
OSNAME='centos'
|
||||
elif grep -Eqi "Rocky" /etc/issue || grep -Eq "Rocky" /etc/*-release; then
|
||||
OSNAME='rocky'
|
||||
elif grep -Eqi "Red Hat Enterprise Linux Server" /etc/issue || grep -Eq "Red Hat Enterprise Linux Server" /etc/*-release; then
|
||||
OSNAME='rhel'
|
||||
elif grep -Eqi "Aliyun" /etc/issue || grep -Eq "Aliyun" /etc/*-release; then
|
||||
OSNAME='aliyun'
|
||||
elif grep -Eqi "Fedora" /etc/issue || grep -Eq "Fedora" /etc/*-release; then
|
||||
OSNAME='fedora'
|
||||
elif grep -Eqi "Amazon Linux AMI" /etc/issue || grep -Eq "Amazon Linux AMI" /etc/*-release; then
|
||||
OSNAME='amazon'
|
||||
elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then
|
||||
OSNAME='debian'
|
||||
elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then
|
||||
OSNAME='ubuntu'
|
||||
elif grep -Eqi "Raspbian" /etc/issue || grep -Eq "Raspbian" /etc/*-release; then
|
||||
OSNAME='raspbian'
|
||||
elif grep -Eqi "Deepin" /etc/issue || grep -Eq "Deepin" /etc/*-release; then
|
||||
OSNAME='deepin'
|
||||
else
|
||||
OSNAME='unknow'
|
||||
fi
|
||||
|
||||
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
|
||||
|
||||
|
||||
|
||||
YUM_INSTALL()
|
||||
{
|
||||
#######
|
||||
#http://repo.mysql.com/
|
||||
|
||||
if [ "${OSNAME}" == "centos" ] && [ "${VERSION_ID}" -le "7" ] ;then
|
||||
wget -O /tmp/mysql57-community-release-el${VERSION_ID}.rpm http://repo.mysql.com/mysql57-community-release-el${VERSION_ID}.rpm
|
||||
rpm -ivh /tmp/mysql57-community-release-el${VERSION_ID}.rpm
|
||||
yum -y install mysql-server
|
||||
rm -rf /tmp/mysql57-community-release-el${VERSION_ID}.rpm
|
||||
fi
|
||||
#######
|
||||
}
|
||||
|
||||
YUM_UNINSTALL()
|
||||
{
|
||||
### YUM卸载 START ########
|
||||
yum remove -y mysql-server
|
||||
### YUM卸载 END ########
|
||||
}
|
||||
|
||||
|
||||
|
||||
Install_mysql()
|
||||
{
|
||||
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
|
||||
if id mysql &> /dev/null ;then
|
||||
echo "mysql UID is `id -u mysql`"
|
||||
echo "mysql Shell is `grep "^mysql:" /etc/passwd |cut -d':' -f7 `"
|
||||
else
|
||||
groupadd mysql
|
||||
useradd -g mysql mysql
|
||||
fi
|
||||
|
||||
isYum=`which yum`
|
||||
if [ "$isYum" != "" ];then
|
||||
YUM_INSTALL
|
||||
fi
|
||||
|
||||
if [ "$?" == "0" ];then
|
||||
mkdir -p $serverPath/mysql-yum
|
||||
echo '5.7' > $serverPath/mysql-yum/version.pl
|
||||
echo '安装完成' > $install_tmp
|
||||
else
|
||||
echo "暂时不支持该系统" > $install_tmp
|
||||
fi
|
||||
}
|
||||
|
||||
Uninstall_mysql()
|
||||
{
|
||||
isYum=`which yum`
|
||||
if [ "$isYum" != "" ];then
|
||||
YUM_UNINSTALL
|
||||
fi
|
||||
|
||||
|
||||
rm -rf $serverPath/mysql-yum
|
||||
echo '卸载完成' > $install_tmp
|
||||
}
|
||||
|
||||
action=$1
|
||||
if [ "${1}" == 'install' ];then
|
||||
Install_mysql
|
||||
else
|
||||
Uninstall_mysql
|
||||
fi
|
||||
@@ -1,121 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#!/bin/bash
|
||||
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
|
||||
#https://dev.mysql.com/downloads/mysql/5.7.html
|
||||
#https://dev.mysql.com/downloads/file/?id=489855
|
||||
|
||||
curPath=`pwd`
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
sysName=`uname`
|
||||
|
||||
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
mysqlDir=${serverPath}/source/mysql
|
||||
|
||||
|
||||
_os=`uname`
|
||||
if [ ${_os} == "Darwin" ]; then
|
||||
OSNAME='macos'
|
||||
elif grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then
|
||||
OSNAME='centos'
|
||||
elif grep -Eqi "Rocky" /etc/issue || grep -Eq "Rocky" /etc/*-release; then
|
||||
OSNAME='rocky'
|
||||
elif grep -Eqi "Red Hat Enterprise Linux Server" /etc/issue || grep -Eq "Red Hat Enterprise Linux Server" /etc/*-release; then
|
||||
OSNAME='rhel'
|
||||
elif grep -Eqi "Aliyun" /etc/issue || grep -Eq "Aliyun" /etc/*-release; then
|
||||
OSNAME='aliyun'
|
||||
elif grep -Eqi "Fedora" /etc/issue || grep -Eq "Fedora" /etc/*-release; then
|
||||
OSNAME='fedora'
|
||||
elif grep -Eqi "Amazon Linux AMI" /etc/issue || grep -Eq "Amazon Linux AMI" /etc/*-release; then
|
||||
OSNAME='amazon'
|
||||
elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then
|
||||
OSNAME='debian'
|
||||
elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then
|
||||
OSNAME='ubuntu'
|
||||
elif grep -Eqi "Raspbian" /etc/issue || grep -Eq "Raspbian" /etc/*-release; then
|
||||
OSNAME='raspbian'
|
||||
elif grep -Eqi "Deepin" /etc/issue || grep -Eq "Deepin" /etc/*-release; then
|
||||
OSNAME='deepin'
|
||||
else
|
||||
OSNAME='unknow'
|
||||
fi
|
||||
|
||||
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
|
||||
|
||||
|
||||
|
||||
YUM_INSTALL()
|
||||
{
|
||||
#######
|
||||
|
||||
if [ "${OSNAME}" == "centos" ];then
|
||||
wget -O /tmp/mysql80-community-release.rpm http://repo.mysql.com/mysql80-community-release-el${VERSION}.rpm
|
||||
else
|
||||
wget -O /tmp/mysql80-community-release.rpm http://repo.mysql.com/mysql80-community-release-el8.rpm
|
||||
fi
|
||||
rpm -ivh /tmp/mysql80-community-release.rpm
|
||||
yum -y install mysql-server
|
||||
|
||||
rm -rf /tmp/mysql80-community-release.rpm
|
||||
#######
|
||||
}
|
||||
|
||||
YUM_UNINSTALL()
|
||||
{
|
||||
### YUM卸载 START ########
|
||||
yum -y remove mysql-server
|
||||
### YUM卸载 END ########
|
||||
}
|
||||
|
||||
|
||||
Install_mysql()
|
||||
{
|
||||
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
|
||||
if id mysql &> /dev/null ;then
|
||||
echo "mysql UID is `id -u mysql`"
|
||||
echo "mysql Shell is `grep "^mysql:" /etc/passwd |cut -d':' -f7 `"
|
||||
else
|
||||
groupadd mysql
|
||||
useradd -g mysql mysql
|
||||
fi
|
||||
|
||||
isYum=`which yum`
|
||||
if [ "$isYum" != "" ];then
|
||||
YUM_INSTALL
|
||||
fi
|
||||
|
||||
|
||||
if [ "$?" == "0" ];then
|
||||
mkdir -p $serverPath/mysql-yum
|
||||
echo '8.0' > $serverPath/mysql-yum/version.pl
|
||||
echo '安装完成' > $install_tmp
|
||||
else
|
||||
echo "暂时不支持该系统" > $install_tmp
|
||||
fi
|
||||
}
|
||||
|
||||
Uninstall_mysql()
|
||||
{
|
||||
isYum=`which yum`
|
||||
if [ "$isYum" != "" ];then
|
||||
YUM_UNINSTALL
|
||||
fi
|
||||
|
||||
|
||||
rm -rf $serverPath/mysql-ya
|
||||
echo '卸载完成' > $install_tmp
|
||||
}
|
||||
|
||||
action=$1
|
||||
if [ "${1}" == 'install' ];then
|
||||
Install_mysql
|
||||
else
|
||||
Uninstall_mysql
|
||||
fi
|
||||
@@ -53,7 +53,7 @@
|
||||
.conf_p span {
|
||||
display: inline-block;
|
||||
margin-right: 10px;
|
||||
width: 95px;
|
||||
width: 135px;
|
||||
text-align: right;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -821,8 +821,8 @@ def importDbBackup():
|
||||
mw.execShell(cmd)
|
||||
|
||||
pwd = pSqliteDb('config').where('id=?', (1,)).getField('mysql_root')
|
||||
|
||||
mysql_cmd = mw.getRootDir() + '/server/mysql/bin/mysql -uroot -p' + pwd + \
|
||||
sock = getSocketFile()
|
||||
mysql_cmd = getServerDir() + '/bin/mysql -S ' + sock + ' -uroot -p' + pwd + \
|
||||
' ' + name + ' < ' + file_path_sql
|
||||
|
||||
# print(mysql_cmd)
|
||||
@@ -2338,8 +2338,11 @@ def installPreInspection(version):
|
||||
|
||||
|
||||
def uninstallPreInspection(version):
|
||||
# return "请手动删除MySQL[{}]".format(version)
|
||||
return 'ok'
|
||||
stop(version)
|
||||
if mw.isDebugMode():
|
||||
return 'ok'
|
||||
|
||||
return "请手动删除MySQL[{}]<br/> rm -rf {}".format(version, getServerDir())
|
||||
|
||||
if __name__ == "__main__":
|
||||
func = sys.argv[1]
|
||||
|
||||
+27
-17
@@ -445,10 +445,9 @@ function syncToDatabase(type){
|
||||
|
||||
function setRootPwd(type, pwd){
|
||||
if (type==1){
|
||||
var data = $("#mod_pwd").serialize();
|
||||
myPost('set_root_pwd', data, function(data){
|
||||
var password = $("#MyPassword").val();
|
||||
myPost('set_root_pwd', {password:password}, function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
// console.log(rdata);
|
||||
showMsg(rdata.msg,function(){
|
||||
dbList();
|
||||
$('.layui-layer-close1').click();
|
||||
@@ -459,26 +458,23 @@ function setRootPwd(type, pwd){
|
||||
|
||||
var index = layer.open({
|
||||
type: 1,
|
||||
skin: 'demo-class',
|
||||
area: '500px',
|
||||
title: '修改数据库密码',
|
||||
closeBtn: 1,
|
||||
shift: 5,
|
||||
btn:["提交","关闭"],
|
||||
shadeClose: true,
|
||||
content: "<form class='bt-form pd20 pb70' id='mod_pwd'>\
|
||||
content: "<form class='bt-form pd20' id='mod_pwd'>\
|
||||
<div class='line'>\
|
||||
<span class='tname'>root密码</span>\
|
||||
<div class='info-r'><input class='bt-input-text mr5' type='text' name='password' id='MyPassword' style='width:330px' value='"+pwd+"' /><span title='随机密码' class='glyphicon glyphicon-repeat cursor' onclick='repeatPwd(16)'></span></div>\
|
||||
</div>\
|
||||
<div class='bt-form-submit-btn'>\
|
||||
<button id='my_mod_close' type='button' class='btn btn-danger btn-sm btn-title'>关闭</button>\
|
||||
<button type='button' class='btn btn-success btn-sm btn-title' onclick=\"setRootPwd(1)\" >提交</button>\
|
||||
<span class='tname'>root密码</span>\
|
||||
<div class='info-r'><input class='bt-input-text mr5' type='text' name='password' id='MyPassword' style='width:330px' value='"+pwd+"' />\
|
||||
<span title='随机密码' class='glyphicon glyphicon-repeat cursor' onclick='repeatPwd(16)'></span>\
|
||||
</div>\
|
||||
</div>\
|
||||
</form>",
|
||||
});
|
||||
|
||||
$('#my_mod_close').click(function(){
|
||||
$('.layui-layer-close1').click();
|
||||
yes:function(){
|
||||
setRootPwd(1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -632,12 +628,18 @@ function setDbPass(id, username, password){
|
||||
</div>\
|
||||
<div class='line'>\
|
||||
<span class='tname'>密码</span>\
|
||||
<div class='info-r'><input class='bt-input-text mr5' type='text' name='password' id='MyPassword' style='width:330px' value='"+password+"' /><span title='随机密码' class='glyphicon glyphicon-repeat cursor' onclick='repeatPwd(16)'></span></div>\
|
||||
<div class='info-r'>\
|
||||
<input class='bt-input-text mr5' type='text' name='password' id='MyPassword' style='width:330px' value='"+password+"' />\
|
||||
<span title='随机密码' class='glyphicon glyphicon-repeat cursor' onclick='repeatPwd(16)'></span></div>\
|
||||
</div>\
|
||||
<input type='hidden' name='id' value='"+id+"'>\
|
||||
</form>",
|
||||
yes:function(index){
|
||||
var data = $("#mod_pwd").serialize();
|
||||
// var data = $("#mod_pwd").serialize();
|
||||
var data = {};
|
||||
data['name'] = $('input[name=name]').val();
|
||||
data['password'] = $('#MyPassword').val();
|
||||
data['id'] = $('input[name=id]').val();
|
||||
myPost('set_user_pwd', data, function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
showMsg(rdata.msg,function(){
|
||||
@@ -809,6 +811,14 @@ function openPhpmyadmin(name,username,password){
|
||||
layer.msg('phpMyAdmin未启动',{icon:2,shade: [0.3, '#000']});
|
||||
return;
|
||||
}
|
||||
|
||||
data = syncPost('/plugins/run',{'name':'phpmyadmin','func':'get_cfg'});
|
||||
var rdata = $.parseJSON(data.data);
|
||||
if (rdata.choose == 'mariadb'){
|
||||
layer.msg('当前为[mariadb]模式,若要使用请切换模式.',{icon:2,shade: [0.3, '#000']});
|
||||
return;
|
||||
}
|
||||
|
||||
// console.log(data);
|
||||
data = syncPost('/plugins/run',{'name':'phpmyadmin','func':'get_home_page'});
|
||||
var rdata = $.parseJSON(data.data);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -57,10 +57,7 @@ fi
|
||||
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
|
||||
|
||||
|
||||
|
||||
VERSION=8.0.29
|
||||
|
||||
|
||||
VERSION=8.0.28
|
||||
Install_mysql()
|
||||
{
|
||||
mkdir -p ${mysqlDir}
|
||||
@@ -98,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
|
||||
@@ -114,7 +111,7 @@ Install_mysql()
|
||||
fi
|
||||
|
||||
#检测文件是否损坏.
|
||||
md5_mysql_ok=42fbfe0569089c20f9aa457b3f367d50
|
||||
md5_mysql_ok=362b8141ecaf425b803fe55292e2df98
|
||||
if [ -f ${mysqlDir}/mysql-boost-${VERSION}.tar.gz ];then
|
||||
md5_mysql=`md5sum ${mysqlDir}/mysql-boost-${VERSION}.tar.gz | awk '{print $1}'`
|
||||
if [ "${md5_mysql_ok}" == "${md5_mysql}" ]; then
|
||||
@@ -135,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
|
||||
|
||||
@@ -12,6 +12,37 @@ config = C:read_file_body_decode(cpath .. 'config.json')
|
||||
local site_config = C:read_file_body_decode(cpath .. 'site.json')
|
||||
C:setConfData(config, site_config)
|
||||
|
||||
-- D func
|
||||
local function D(msg)
|
||||
local _msg = ''
|
||||
if type(msg) == 'table' then
|
||||
for key, val in pairs(msg) do
|
||||
_msg = key..':'..val.."\n"
|
||||
end
|
||||
elseif type(msg) == 'string' then
|
||||
_msg = msg
|
||||
elseif type(msg) == 'nil' then
|
||||
_msg = 'nil'
|
||||
else
|
||||
_msg = msg
|
||||
end
|
||||
|
||||
if not debug_mode then return true end
|
||||
local fp = io.open(cpath..'debug.log', 'ab')
|
||||
if fp == nil then
|
||||
return nil
|
||||
end
|
||||
local localtime = os.date("%Y-%m-%d %H:%M:%S")
|
||||
if server_name then
|
||||
fp:write(tostring(_msg) .. "\n")
|
||||
else
|
||||
fp:write(localtime..":"..tostring(_msg) .. "\n")
|
||||
end
|
||||
fp:flush()
|
||||
fp:close()
|
||||
return true
|
||||
end
|
||||
|
||||
function initParams()
|
||||
local data = {}
|
||||
data['ip'] = C:get_client_ip()
|
||||
@@ -314,6 +345,7 @@ end
|
||||
function post_data_chekc()
|
||||
if params['method'] =="POST" then
|
||||
if C:return_post_data() then return false end
|
||||
ngx.req.read_body()
|
||||
request_args = ngx.req.get_post_args()
|
||||
if not request_args then return false end
|
||||
|
||||
|
||||
@@ -13,7 +13,10 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- <script type="text/javascript" src="/plugins/file?name=openresty&f=js/openresty.js"></script> -->
|
||||
<script type="text/javascript">
|
||||
|
||||
$.getScript( "/plugins/file?name=openresty&f=js/openresty.js", function(){
|
||||
orPluginService('openresty');
|
||||
});
|
||||
|
||||
@@ -4,6 +4,7 @@ import sys
|
||||
import io
|
||||
import os
|
||||
import time
|
||||
import threading
|
||||
import subprocess
|
||||
|
||||
sys.path.append(os.getcwd() + "/class/core")
|
||||
@@ -216,6 +217,33 @@ def restyOp(method):
|
||||
return data[1]
|
||||
|
||||
|
||||
def op_submit_systemctl_restart():
|
||||
mw.execShell('systemctl restart openresty')
|
||||
|
||||
|
||||
def op_submit_init_restart(file):
|
||||
mw.execShell(file + ' restart')
|
||||
|
||||
|
||||
def restyOp_restart():
|
||||
file = initDreplace()
|
||||
|
||||
# 启动时,先检查一下配置文件
|
||||
check = getServerDir() + "/bin/openresty -t"
|
||||
check_data = mw.execShell(check)
|
||||
if not check_data[1].find('test is successful') > -1:
|
||||
return check_data[1]
|
||||
|
||||
if not mw.isAppleSystem():
|
||||
threading.Timer(2, op_submit_systemctl_restart, args=()).start()
|
||||
# submit_restart1()
|
||||
return 'ok'
|
||||
|
||||
threading.Timer(2, op_submit_init_restart, args=(file,)).start()
|
||||
# submit_restart2(file)
|
||||
return 'ok'
|
||||
|
||||
|
||||
def start():
|
||||
return restyOp('start')
|
||||
|
||||
@@ -225,7 +253,7 @@ def stop():
|
||||
|
||||
|
||||
def restart():
|
||||
return restyOp('restart')
|
||||
return restyOp_restart()
|
||||
|
||||
|
||||
def reload():
|
||||
|
||||
@@ -12,6 +12,6 @@
|
||||
"home":"http://openresty.org",
|
||||
"date":"2017-11-24",
|
||||
"pid": "1",
|
||||
"versions": ["1.15.8.3","1.17.8.2","1.19.3.1","1.21.4.1"],
|
||||
"updates": ["1.15.8.3","1.17.8.2","1.19.3.1","1.21.4.1"]
|
||||
"versions": ["1.17.8.2","1.19.3.1","1.21.4.1"],
|
||||
"updates": ["1.17.8.2","1.19.3.1","1.21.4.1"]
|
||||
}
|
||||
@@ -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 ------
|
||||
@@ -59,10 +58,12 @@ Install_openresty()
|
||||
# --with-openssl=$serverPath/source/lib/openssl-1.0.2q
|
||||
cd ${openrestyDir}/openresty-${VERSION} && ./configure \
|
||||
--prefix=$serverPath/openresty \
|
||||
--with-ipv6 \
|
||||
--with-http_v2_module \
|
||||
--with-http_ssl_module \
|
||||
--with-http_slice_module \
|
||||
--with-http_stub_status_module
|
||||
--with-http_stub_status_module \
|
||||
--with-http_realip_module
|
||||
|
||||
make -j${cpuCore} && make install && make clean
|
||||
|
||||
|
||||
@@ -36,14 +36,14 @@ function orPluginSetService(_name ,status, version){
|
||||
(status?'#20a53a;':'red;')+
|
||||
' margin-left: 3px;" class="glyphicon ' + (status?'glyphicon glyphicon-play':'glyphicon-pause')+'"></span></p><div class="sfm-opt">\
|
||||
<button class="btn btn-default btn-sm" onclick="orPluginOpService(\''+_name+'\',\''+(status?'stop':'start')+'\',\''+version+'\')">'+(status?'停止':'启动')+'</button>\
|
||||
<button class="btn btn-default btn-sm" onclick="orPluginOpService(\''+_name+'\',\'restart\',\''+version+'\')">重启</button>\
|
||||
<button class="btn btn-default btn-sm" onclick="orPluginOpService(\''+_name+'\',\'restart\',\''+version+'\',\'yes\')">重启</button>\
|
||||
<button class="btn btn-default btn-sm" onclick="orPluginOpService(\''+_name+'\',\'reload\',\''+version+'\')">重载配置</button>\
|
||||
</div>';
|
||||
$(".soft-man-con").html(serviceCon);
|
||||
}
|
||||
|
||||
|
||||
function orPluginOpService(a, b, v) {
|
||||
function orPluginOpService(a, b, v,request_callback) {
|
||||
|
||||
var c = "name=" + a + "&func=" + b;
|
||||
if(v != ''){
|
||||
@@ -67,19 +67,25 @@ function orPluginOpService(a, b, v) {
|
||||
layer.close(index);
|
||||
var data = {'pwd':pwd};
|
||||
c += '&args='+JSON.stringify(data);
|
||||
orPluginOpServiceOp(a,b,c,d,a,v);
|
||||
orPluginOpServiceOp(a,b,c,d,a,v,request_callback);
|
||||
});
|
||||
} else {
|
||||
orPluginOpServiceOp(a,b,c,d,a,v);
|
||||
orPluginOpServiceOp(a,b,c,d,a,v,request_callback);
|
||||
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
function orPluginOpServiceOp(a,b,c,d,a,v){
|
||||
function orPluginOpServiceOp(a,b,c,d,a,v,request_callback){
|
||||
|
||||
var request_path = "/plugins/run";
|
||||
if (request_callback == 'yes'){
|
||||
request_path = "/plugins/callback";
|
||||
}
|
||||
|
||||
var e = layer.msg(msgTpl('正在{1}{2}{3}服务,请稍候...',[d,a,v]), {icon: 16,time: 0});
|
||||
$.post("/plugins/run", c, function(g) {
|
||||
$.post(request_path, c, function(g) {
|
||||
layer.close(e);
|
||||
|
||||
var f = g.data == 'ok' ? msgTpl('{1}{2}服务已{3}',[a,v,d]) : msgTpl('{1}{2}服务{3}失败!',[a,v,d]);
|
||||
@@ -97,9 +103,6 @@ function orPluginOpServiceOp(a,b,c,d,a,v){
|
||||
layer.msg(g.data, {icon: 2,time: 10000,shade: 0.3});
|
||||
}
|
||||
|
||||
// setTimeout(function(){
|
||||
// location.reload();
|
||||
// },2000);
|
||||
},'json').error(function() {
|
||||
layer.close(e);
|
||||
layer.msg('操作异常!', {icon: 2});
|
||||
@@ -131,247 +134,3 @@ function getOpenrestyStatus() {
|
||||
}
|
||||
},'json');
|
||||
}
|
||||
|
||||
//nginx
|
||||
function nginxSoftMain(name, version) {
|
||||
var loadT = layer.msg(lan.public.the, { icon: 16, time: 0, shade: [0.3, '#000'] });
|
||||
$.get('/system?action=GetConcifInfo', function(rdata) {
|
||||
layer.close(loadT);
|
||||
nameA = rdata['web'];
|
||||
var status = name == 'nginx' ? '<p onclick="GetNginxStatus()">' + lan.soft.nginx_status + '</p>' : '';
|
||||
var menu = '';
|
||||
if (version != undefined || version != '') {
|
||||
var menu = '<p onclick="softChangeVer(\'' + name + '\',\'' + version + '\')">' + lan.soft.nginx_version + '</p>';
|
||||
}
|
||||
|
||||
var waf = ''
|
||||
if (name == 'nginx') {
|
||||
waf = '<p onclick="waf()">' + lan.soft.waf_title + '</p>'
|
||||
}
|
||||
|
||||
var logsPath = (name == 'nginx') ? '/www/wwwlogs/nginx_error.log' : '/www/wwwlogs/error_log';
|
||||
layer.open({
|
||||
type: 1,
|
||||
area: '640px',
|
||||
title: name + '管理',
|
||||
closeBtn: 2,
|
||||
shift: 0,
|
||||
content: '<div class="bt-w-main" style="width:640px;">\
|
||||
<div class="bt-w-menu">\
|
||||
<p class="bgw" onclick="service(\'' + name + '\',' + nameA.status + ')">' + lan.soft.web_service + '</p>\
|
||||
<p onclick="configChange(\'' + name + '\')">' + lan.soft.config_edit + '</p>\
|
||||
' + waf + '\
|
||||
' + menu + '\
|
||||
' + status + '\
|
||||
<p onclick="showLogs(\'' + logsPath + '\')">错误日志</p>\
|
||||
</div>\
|
||||
<div id="webEdit-con" class="bt-w-con pd15" style="height:555px;overflow:auto">\
|
||||
<div class="soft-man-con"></div>\
|
||||
</div>\
|
||||
</div>'
|
||||
});
|
||||
service(name, nameA.status);
|
||||
$(".bt-w-menu p").click(function() {
|
||||
//var i = $(this).index();
|
||||
$(this).addClass("bgw").siblings().removeClass("bgw");
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
//显示指定日志
|
||||
function showLogs(logPath) {
|
||||
var loadT = layer.msg(lan.public.the_get, { icon: 16, time: 0, shade: [0.3, '#000'] });
|
||||
$.post('/ajax?action=GetOpeLogs', { path: logPath }, function(rdata) {
|
||||
layer.close(loadT);
|
||||
if (rdata.msg == '') rdata.msg = '当前没有日志!';
|
||||
var ebody = '<div class="soft-man-con"><textarea readonly="" style="margin: 0px;width: 500px;height: 520px;background-color: #333;color:#fff; padding:0 5px" id="error_log">' + rdata.msg + '</textarea></div>';
|
||||
$(".soft-man-con").html(ebody);
|
||||
var ob = document.getElementById('error_log');
|
||||
ob.scrollTop = ob.scrollHeight;
|
||||
});
|
||||
}
|
||||
|
||||
//WAF防火墙
|
||||
function waf() {
|
||||
var loadT = layer.msg(lan.public.the_get, { icon: 16, time: 0, shade: [0.3, '#000'] });
|
||||
$.get("/waf?action=GetConfig", function(rdata) {
|
||||
layer.close(loadT);
|
||||
if (rdata.status == -1) {
|
||||
layer.msg(lan.soft.waf_not, { icon: 5, time: 5000 });
|
||||
return;
|
||||
}
|
||||
|
||||
var whiteList = ""
|
||||
for (var i = 0; i < rdata.ipWhitelist.length; i++) {
|
||||
if (rdata.ipWhitelist[i] == "") continue;
|
||||
whiteList += "<tr><td>" + rdata.ipWhitelist[i] + "</td><td><a href=\"javascript:deleteWafKey('ipWhitelist','" + rdata.ipWhitelist[i] + "');\">" + lan.public.del + "</a></td></tr>";
|
||||
}
|
||||
|
||||
var blackList = ""
|
||||
for (var i = 0; i < rdata.ipBlocklist.length; i++) {
|
||||
if (rdata.ipBlocklist[i] == "") continue;
|
||||
blackList += "<tr><td>" + rdata.ipBlocklist[i] + "</td><td><a href=\"javascript:deleteWafKey('ipBlocklist','" + rdata.ipBlocklist[i] + "');\">" + lan.public.del + "</a></td></tr>";
|
||||
}
|
||||
|
||||
var cc = rdata.CCrate.split('/')
|
||||
|
||||
var con = "<div class='wafConf'>\
|
||||
<div class='wafConf-btn'>\
|
||||
<span>" + lan.soft.waf_title + "</span><div class='ssh-item'>\
|
||||
<input class='btswitch btswitch-ios' id='closeWaf' type='checkbox' " + (rdata.status == 1 ? 'checked' : '') + ">\
|
||||
<label class='btswitch-btn' for='closeWaf' onclick='CloseWaf()'></label>\
|
||||
</div>\
|
||||
<div class='pull-right'>\
|
||||
<button class='btn btn-default btn-sm' onclick='gzEdit()'>" + lan.soft.waf_edit + "</button>\
|
||||
<button class='btn btn-default btn-sm' onclick='upLimit()'>" + lan.soft.waf_up_title + "</button>\
|
||||
</div>\
|
||||
</div>\
|
||||
<div class='wafConf_checkbox label-input-group ptb10 relative'>\
|
||||
<input type='checkbox' id='waf_UrlDeny' " + (rdata['UrlDeny'] == 'on' ? 'checked' : '') + " onclick=\"SetWafConfig('UrlDeny','" + (rdata['UrlDeny'] == 'on' ? 'off' : 'on') + "')\" /><label for='waf_UrlDeny'>" + lan.soft.waf_input1 + "</label>\
|
||||
<input type='checkbox' id='waf_CookieMatch' " + (rdata['CookieMatch'] == 'on' ? 'checked' : '') + " onclick=\"SetWafConfig('CookieMatch','" + (rdata['CookieMatch'] == 'on' ? 'off' : 'on') + "')\" /><label for='waf_CookieMatch'>" + lan.soft.waf_input2 + "</label>\
|
||||
<input type='checkbox' id='waf_postMatch' " + (rdata['postMatch'] == 'on' ? 'checked' : '') + " onclick=\"SetWafConfig('postMatch','" + (rdata['postMatch'] == 'on' ? 'off' : 'on') + "')\" /><label for='waf_postMatch'>" + lan.soft.waf_input3 + "</label>\
|
||||
<input type='checkbox' id='waf_CCDeny' " + (rdata['CCDeny'] == 'on' ? 'checked' : '') + " onclick=\"SetWafConfig('CCDeny','" + (rdata['CCDeny'] == 'on' ? 'off' : 'on') + "')\" /><label for='waf_CCDeny'>" + lan.soft.waf_input4 + "</label>\
|
||||
<input type='checkbox' id='waf_attacklog' " + (rdata['attacklog'] == 'on' ? 'checked' : '') + " onclick=\"SetWafConfig('attacklog','" + (rdata['attacklog'] == 'on' ? 'off' : 'on') + "')\" /><label for='waf_attacklog'>" + lan.soft.waf_input5 + "</label>\
|
||||
<span class='glyphicon glyphicon-folder-open' style='position: absolute; right: 10px; top: 12px; color: orange;cursor: pointer' onclick='openPath(\"/www/wwwlogs/waf\")'></span>\
|
||||
</div>\
|
||||
<div class='wafConf_cc'>\
|
||||
<span>" + lan.soft.waf_input6 + "</span><input id='CCrate_1' class='bt-input-text' type='number' value='" + cc[0] + "' style='width:80px;margin-right:30px'/>\
|
||||
<span>" + lan.soft.waf_input7 + "(" + lan.bt.s + ")</span><input id='CCrate_2' class='bt-input-text' type='number' value='" + cc[1] + "' style='width:80px;'/>\
|
||||
<button onclick=\"SetWafConfig('CCrate','')\" class='btn btn-default btn-sm'>" + lan.public.ok + "</button>\
|
||||
</div>\
|
||||
<div class='wafConf_ip'>\
|
||||
<fieldset>\
|
||||
<legend>" + lan.soft.waf_input8 + "</legend>\
|
||||
<input type='text' id='ipWhitelist_val' class='bt-input-text mr5' placeholder='" + lan.soft.waf_ip + "' style='width:175px;' /><button onclick=\"addWafKey('ipWhitelist')\" class='btn btn-default btn-sm'>" + lan.public.add + "</button>\
|
||||
<div class='table-overflow'><table class='table table-hover'>" + whiteList + "</table></div>\
|
||||
</fieldset>\
|
||||
<fieldset>\
|
||||
<legend>" + lan.soft.waf_input9 + "</legend>\
|
||||
<input type='text' id='ipBlocklist_val' class='bt-input-text mr5' placeholder='" + lan.soft.waf_ip + "' style='width:175px;' /><button onclick=\"addWafKey('ipBlocklist')\" class='btn btn-default btn-sm'>" + lan.public.add + "</button>\
|
||||
<div class='table-overflow'><table class='table table-hover'>" + blackList + "</table></div>\
|
||||
</fieldset>\
|
||||
</div>\
|
||||
</div>"
|
||||
$(".soft-man-con").html(con);
|
||||
});
|
||||
}
|
||||
|
||||
//上传限制
|
||||
function upLimit() {
|
||||
var loadT = layer.msg(lan.public.the_get, { icon: 16, time: 0, shade: [0.3, '#000'] });
|
||||
$.get("/waf?action=GetConfig", function(rdata) {
|
||||
layer.close(loadT);
|
||||
var black_fileExt = ''
|
||||
for (var i = 0; i < rdata.black_fileExt.length; i++) {
|
||||
black_fileExt += "<tr><td>" + rdata.black_fileExt[i] + "</td><td><a style='float:right;' href=\"javascript:deleteWafKey('black_fileExt','" + rdata.black_fileExt[i] + "');\">" + lan.public.del + "</a></td></tr>";
|
||||
}
|
||||
|
||||
if ($("#blacktable").html() != undefined) {
|
||||
$("#blacktable").html(black_fileExt);
|
||||
$("#black_fileExt_val").val('');
|
||||
return;
|
||||
}
|
||||
|
||||
layer.open({
|
||||
type: 1,
|
||||
area: '300px',
|
||||
title: lan.soft.waf_up_title,
|
||||
closeBtn: 2,
|
||||
shift: 0,
|
||||
content: "<div class='dirBinding mlr15'>" +
|
||||
"<input class='bt-input-text mr5' type='text' placeholder='" + lan.soft.waf_up_from1 + "' id='black_fileExt_val' style='height: 28px; border-radius: 3px;width: 219px;margin-top:15px' />" +
|
||||
"<button class='btn btn-success btn-sm' onclick=\"addWafKey('black_fileExt')\">" + lan.public.add + "</button>" +
|
||||
"</div>" +
|
||||
"<div class='divtable' style='margin:15px'><table class='table table-hover' width='100%' style='margin-bottom:0'>" +
|
||||
"<thead><tr><th>" + lan.soft.waf_up_from2 + "</th><th width='100' class='text-right'>" + lan.public.action + "</th></tr></thead>" +
|
||||
"<tbody id='blacktable'>" + black_fileExt + "</tbody>" +
|
||||
"</table></div>"
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
//设置waf状态
|
||||
function closeWaf() {
|
||||
var loadT = layer.msg(lan.public.the, { icon: 16, time: 0, shade: [0.3, '#000'] });
|
||||
$.post('/waf?action=SetStatus', '', function(rdata) {
|
||||
layer.close(loadT)
|
||||
layer.msg(rdata.msg, { icon: rdata.status ? 1 : 5 });
|
||||
if (rdata.status) waf();
|
||||
});
|
||||
}
|
||||
|
||||
//取规则文件
|
||||
function getWafFile(name) {
|
||||
onlineEditFile(0, '/www/server/panel/vhost/wafconf/' + name);
|
||||
}
|
||||
//规则编辑
|
||||
function gzEdit() {
|
||||
layer.open({
|
||||
type: 1,
|
||||
area: '360px',
|
||||
title: lan.soft.waf_edit,
|
||||
closeBtn: 2,
|
||||
shift: 0,
|
||||
content: "<div class='gzEdit'><button class='btn btn-default btn-sm' onclick=\"GetWafFile('cookie')\">Cookie</button>\
|
||||
<button class='btn btn-default btn-sm' onclick=\"GetWafFile('post')\">POST</button>\
|
||||
<button class='btn btn-default btn-sm' onclick=\"GetWafFile('url')\">URL</button>\
|
||||
<button class='btn btn-default btn-sm' onclick=\"GetWafFile('user-agent')\">User-Agent</button>\
|
||||
<button class='btn btn-default btn-sm' onclick=\"GetWafFile('args')\">Args</button>\
|
||||
<button class='btn btn-default btn-sm' onclick=\"GetWafFile('whiteurl')\">" + lan.soft.waf_url_white + "</button>\
|
||||
<button class='btn btn-default btn-sm' onclick=\"GetWafFile('returnhtml')\">" + lan.soft.waf_index + "</button>\
|
||||
<button class='btn btn-default btn-sm' onclick=\"updateWaf('returnhtml')\">" + lan.soft.waf_cloud + "</button></div>"
|
||||
});
|
||||
}
|
||||
|
||||
//更新WAF规则
|
||||
function updateWaf() {
|
||||
var loadT = layer.msg(lan.soft.waf_update, { icon: 16, time: 0, shade: [0.3, '#000'] });
|
||||
$.post('/waf?action=updateWaf', '', function(rdata) {
|
||||
layer.close(loadT)
|
||||
layer.msg(rdata.msg, { icon: rdata.status ? 1 : 5 });
|
||||
});
|
||||
}
|
||||
|
||||
//设置WAF配置值
|
||||
function setWafConfig(name, value) {
|
||||
if (name == 'CCrate') {
|
||||
var CCrate_1 = $("#CCrate_1").val();
|
||||
var CCrate_2 = $("#CCrate_2").val();
|
||||
if (CCrate_1 < 1 || CCrate_1 > 3000 || CCrate_2 < 1 || CCrate_2 > 1800) {
|
||||
layer.msg(lan.soft.waf_cc_err, { icon: 5 });
|
||||
return;
|
||||
}
|
||||
value = CCrate_1 + '/' + CCrate_2;
|
||||
}
|
||||
var loadT = layer.msg(lan.public.the, { icon: 16, time: 0, shade: [0.3, '#000'] });
|
||||
$.post('/waf?action=SetConfigString', 'name=' + name + '&value=' + value, function(rdata) {
|
||||
layer.close(loadT)
|
||||
layer.msg(rdata.msg, { icon: rdata.status ? 1 : 5 });
|
||||
if (rdata.status) waf();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//删除WAF指定值
|
||||
function deleteWafKey(name, value) {
|
||||
var loadT = layer.msg(lan.public.the, { icon: 16, time: 0, shade: [0.3, '#000'] });
|
||||
$.post('/waf?action=SetConfigList&act=del', 'name=' + name + '&value=' + value, function(rdata) {
|
||||
layer.close(loadT)
|
||||
layer.msg(rdata.msg, { icon: rdata.status ? 1 : 5 });
|
||||
if (rdata.status) waf();
|
||||
if (name == 'black_fileExt') upLimit();
|
||||
});
|
||||
}
|
||||
|
||||
//删除WAF指定值
|
||||
function addWafKey(name) {
|
||||
var value = $('#' + name + '_val').val();
|
||||
var loadT = layer.msg(lan.public.the, { icon: 16, time: 0, shade: [0.3, '#000'] });
|
||||
$.post('/waf?action=SetConfigList&act=add', 'name=' + name + '&value=' + value, function(rdata) {
|
||||
layer.close(loadT)
|
||||
layer.msg(rdata.msg, { icon: rdata.status ? 1 : 5 });
|
||||
if (rdata.status) waf();
|
||||
if (name == 'black_fileExt') upLimit();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -417,8 +417,8 @@ def setFpmConfig(version):
|
||||
max_spare_servers = args['max_spare_servers']
|
||||
pm = args['pm']
|
||||
|
||||
file = getServerDir() + '/php' + version + '/php-fpm.d/www.conf'
|
||||
conf = mw.readFile(file)
|
||||
filefpm = getFpmConfFile(version)
|
||||
conf = mw.readFile(filefpm)
|
||||
|
||||
rep = "\s*pm.max_children\s*=\s*([0-9]+)\s*"
|
||||
conf = re.sub(rep, "\npm.max_children = " + max_children, conf)
|
||||
@@ -437,7 +437,7 @@ def setFpmConfig(version):
|
||||
rep = "\s*pm\s*=\s*(\w+)\s*"
|
||||
conf = re.sub(rep, "\npm = " + pm + "\n", conf)
|
||||
|
||||
mw.writeFile(file, conf)
|
||||
mw.writeFile(filefpm, conf)
|
||||
reload(version)
|
||||
|
||||
msg = mw.getInfo('设置PHP-{1}并发设置,max_children={2},start_servers={3},min_spare_servers={4},max_spare_servers={5}',
|
||||
|
||||
@@ -2,6 +2,11 @@
|
||||
{
|
||||
"name": "pdo",
|
||||
"versions": [
|
||||
"56",
|
||||
"70",
|
||||
"71",
|
||||
"72",
|
||||
"73",
|
||||
"74",
|
||||
"80",
|
||||
"81",
|
||||
@@ -16,6 +21,11 @@
|
||||
"name": "mysqlnd",
|
||||
"versions": [
|
||||
"56",
|
||||
"70",
|
||||
"71",
|
||||
"72",
|
||||
"73",
|
||||
"74",
|
||||
"80",
|
||||
"81",
|
||||
"82"
|
||||
@@ -29,6 +39,11 @@
|
||||
"name": "sqlite3",
|
||||
"versions": [
|
||||
"56",
|
||||
"70",
|
||||
"71",
|
||||
"72",
|
||||
"73",
|
||||
"74",
|
||||
"80",
|
||||
"81",
|
||||
"82"
|
||||
@@ -50,6 +65,11 @@
|
||||
"name": "odbc",
|
||||
"versions": [
|
||||
"56",
|
||||
"70",
|
||||
"71",
|
||||
"72",
|
||||
"73",
|
||||
"74",
|
||||
"80",
|
||||
"81",
|
||||
"82"
|
||||
|
||||
@@ -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}')
|
||||
|
||||
@@ -412,15 +412,15 @@ def setFpmConfig(version):
|
||||
# if not 'max' in args:
|
||||
# return 'missing time args!'
|
||||
|
||||
version = args['version']
|
||||
max_children = args['max_children']
|
||||
start_servers = args['start_servers']
|
||||
min_spare_servers = args['min_spare_servers']
|
||||
max_spare_servers = args['max_spare_servers']
|
||||
pm = args['pm']
|
||||
|
||||
file = getServerDir() + '/php' + version + '/php-fpm.d/www.conf'
|
||||
conf = mw.readFile(file)
|
||||
# file = getServerDir() + '/php' + version + '/php-fpm.d/www.conf'
|
||||
filefpm = getFpmConfFile(version)
|
||||
conf = mw.readFile(filefpm)
|
||||
|
||||
rep = "\s*pm.max_children\s*=\s*([0-9]+)\s*"
|
||||
conf = re.sub(rep, "\npm.max_children = " + max_children, conf)
|
||||
@@ -439,7 +439,7 @@ def setFpmConfig(version):
|
||||
rep = "\s*pm\s*=\s*(\w+)\s*"
|
||||
conf = re.sub(rep, "\npm = " + pm + "\n", conf)
|
||||
|
||||
mw.writeFile(file, conf)
|
||||
mw.writeFile(filefpm, conf)
|
||||
reload(version)
|
||||
|
||||
msg = mw.getInfo('设置PHP-{1}并发设置,max_children={2},start_servers={3},min_spare_servers={4},max_spare_servers={5}', (version, max_children,
|
||||
|
||||
@@ -15,9 +15,7 @@
|
||||
{
|
||||
"name": "mysqlnd",
|
||||
"versions": [
|
||||
"53",
|
||||
"54",
|
||||
"56",
|
||||
"74",
|
||||
"80",
|
||||
"81",
|
||||
"82"
|
||||
@@ -30,9 +28,7 @@
|
||||
{
|
||||
"name": "oci8",
|
||||
"versions": [
|
||||
"53",
|
||||
"54",
|
||||
"56",
|
||||
"74",
|
||||
"80",
|
||||
"81",
|
||||
"82"
|
||||
@@ -45,9 +41,7 @@
|
||||
{
|
||||
"name": "odbc",
|
||||
"versions": [
|
||||
"53",
|
||||
"54",
|
||||
"56",
|
||||
"74",
|
||||
"80",
|
||||
"81",
|
||||
"82"
|
||||
@@ -101,14 +95,6 @@
|
||||
{
|
||||
"name": "opcache",
|
||||
"versions": [
|
||||
"53",
|
||||
"54",
|
||||
"55",
|
||||
"56",
|
||||
"70",
|
||||
"71",
|
||||
"72",
|
||||
"73",
|
||||
"74",
|
||||
"80",
|
||||
"81",
|
||||
@@ -154,6 +140,26 @@
|
||||
"shell": "fileinfo.sh",
|
||||
"check": "fileinfo"
|
||||
},
|
||||
{
|
||||
"name": "simplexml",
|
||||
"versions": [
|
||||
"53",
|
||||
"54",
|
||||
"55",
|
||||
"56",
|
||||
"70",
|
||||
"71",
|
||||
"72",
|
||||
"73",
|
||||
"74",
|
||||
"80",
|
||||
"81"
|
||||
],
|
||||
"type": "通用扩展",
|
||||
"msg": "用于XML!",
|
||||
"shell": "simplexml.sh",
|
||||
"check": "simplexml"
|
||||
},
|
||||
{
|
||||
"name": "exif",
|
||||
"versions": [
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -146,7 +146,7 @@ def contentReplace(content, version):
|
||||
|
||||
def makeOpenrestyConf():
|
||||
phpversions = ['00', '52', '53', '54', '55', '56',
|
||||
'70', '71', '72', '73', '74', '80', '81']
|
||||
'70', '71', '72', '73', '74', '80', '81', '82']
|
||||
|
||||
sdir = mw.getServerDir()
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -39,7 +39,11 @@ if [ ! -d $sourcePath/php/php${PHP_VER} ];then
|
||||
mv $sourcePath/php/php-${version} $sourcePath/php/php${PHP_VER}
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
|
||||
rm -rf $sourcePath/php/php-${version}.tar.xz
|
||||
echo "reinstall php${version}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd $sourcePath/php/php${PHP_VER}
|
||||
|
||||
|
||||
@@ -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.21
|
||||
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.8
|
||||
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.0alpha2
|
||||
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}
|
||||
|
||||
Executable
+109
@@ -0,0 +1,109 @@
|
||||
#!/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=igbinary
|
||||
LIBV=3.2.7
|
||||
|
||||
if [ "$version" -lt "70" ];then
|
||||
echo "not need"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
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
|
||||
|
||||
php_lib=$sourcePath/php_lib
|
||||
mkdir -p $php_lib
|
||||
if [ ! -f $php_lib/${LIBNAME}-${LIBV}.tgz ];then
|
||||
wget -O $php_lib/${LIBNAME}-${LIBV}.tgz http://pecl.php.net/get/${LIBNAME}-${LIBV}.tgz
|
||||
cd $php_lib
|
||||
tar xvf ${LIBNAME}-${LIBV}.tgz
|
||||
fi
|
||||
cd $php_lib/${LIBNAME}-${LIBV}
|
||||
|
||||
$serverPath/php/$version/bin/phpize
|
||||
./configure --with-php-config=$serverPath/php/$version/bin/php-config
|
||||
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}.use_namespace/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
|
||||
@@ -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
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user