mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
@@ -122,6 +122,7 @@ data/datadir.pl
|
||||
data/502Task.pl
|
||||
data/default.pl
|
||||
data/backup.pl
|
||||
data/default_site.pl
|
||||
lib/python*
|
||||
|
||||
bin
|
||||
@@ -144,3 +145,4 @@ plugins/gdrive
|
||||
plugins/mtproxy
|
||||
debug.out
|
||||
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ class config_api:
|
||||
|
||||
# 进行中.
|
||||
# 兼容主流Linux系统
|
||||
__version = '0.8.6.6'
|
||||
__version = '0.8.6.7'
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
+13
-2
@@ -516,8 +516,9 @@ def getLastLine(inputfile, lineNum):
|
||||
result += lastre[num] + "\n"
|
||||
num -= 1
|
||||
return result
|
||||
except:
|
||||
return getMsg('TASK_SLEEP')
|
||||
except Exception as e:
|
||||
return str(e)
|
||||
# return getMsg('TASK_SLEEP')
|
||||
|
||||
|
||||
def getNumLines(path, num, p=1):
|
||||
@@ -1003,3 +1004,13 @@ def requestFcgiPHP(sock, uri, document_root='/tmp', method='GET', pdata=b''):
|
||||
pdata = url_encode(pdata)
|
||||
result = p.load_url_public(uri, pdata, method)
|
||||
return result
|
||||
|
||||
|
||||
def getMyORM():
|
||||
'''
|
||||
获取MySQL资源的ORM
|
||||
'''
|
||||
sys.path.append(os.getcwd() + "/class/plugin")
|
||||
import orm
|
||||
o = orm.ORM()
|
||||
return o
|
||||
|
||||
@@ -290,7 +290,7 @@ class plugins_api:
|
||||
except:
|
||||
mw.execShell("rm -rf " + tmp_path)
|
||||
return mw.returnJson(False, '在压缩包中没有找到插件信息,请检查插件包!')
|
||||
protectPlist = ('openresty', 'mysql', 'php', 'redis',
|
||||
protectPlist = ('openresty', 'mysql', 'php', 'redis', 'memcached'
|
||||
'mongodb', 'swap', 'gogs', 'pureftp')
|
||||
if data['name'] in protectPlist:
|
||||
return mw.returnJson(False, '[' + data['name'] + '],重要插件不可修改!')
|
||||
|
||||
@@ -61,8 +61,7 @@ class task_api:
|
||||
if not len(find):
|
||||
return mw.returnJson(False, '当前没有任务队列在执行-2!')
|
||||
|
||||
isTask = os.getcwd() + '/tmp/panelTask.pl'
|
||||
mw.writeFile(isTask, 'True')
|
||||
mw.triggerTask()
|
||||
|
||||
echoMsg = {}
|
||||
echoMsg['name'] = find['name']
|
||||
|
||||
Executable
+92
@@ -0,0 +1,92 @@
|
||||
# coding: utf-8
|
||||
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
|
||||
from mysql import connector
|
||||
|
||||
|
||||
class ORM:
|
||||
__DB_PASS = None
|
||||
__DB_USER = 'root'
|
||||
__DB_PORT = 3306
|
||||
__DB_HOST = 'localhost'
|
||||
__DB_CONN = None
|
||||
__DB_CUR = None
|
||||
__DB_ERR = None
|
||||
__DB_CNF = '/etc/my.cnf'
|
||||
__DB_SOCKET = '/www/server/mysql/mysql.sock'
|
||||
|
||||
def __Conn(self):
|
||||
'''连接MYSQL数据库'''
|
||||
try:
|
||||
|
||||
if os.path.exists(self.__DB_SOCKET):
|
||||
try:
|
||||
self.__DB_CONN = connector.connect(host=self.__DB_HOST, user=self.__DB_USER, passwd=self.__DB_PASS,
|
||||
port=self.__DB_PORT, charset="utf8", connect_timeout=1, unix_socket=self.__DB_SOCKET)
|
||||
except Exception as e:
|
||||
self.__DB_HOST = '127.0.0.1'
|
||||
self.__DB_CONN = connector.connect(host=self.__DB_HOST, user=self.__DB_USER, passwd=self.__DB_PASS,
|
||||
port=self.__DB_PORT, charset="utf8", connect_timeout=1, unix_socket=self.__DB_SOCKET)
|
||||
else:
|
||||
try:
|
||||
self.__DB_CONN = connector.connect(host=self.__DB_HOST, user=self.__DB_USER, passwd=self.__DB_PASS,
|
||||
port=self.__DB_PORT, charset="utf8", connect_timeout=1)
|
||||
except Exception as e:
|
||||
self.__DB_HOST = '127.0.0.1'
|
||||
self.__DB_CONN = connector.connect(host=self.__DB_HOST, user=self.__DB_USER, passwd=self.__DB_PASS,
|
||||
port=self.__DB_PORT, charset="utf8", connect_timeout=1)
|
||||
|
||||
self.__DB_CUR = self.__DB_CONN.cursor()
|
||||
return True
|
||||
except Exception as e:
|
||||
self.__DB_ERR = e
|
||||
return False
|
||||
|
||||
def setDbConf(self, conf):
|
||||
self.__DB_CNF = conf
|
||||
|
||||
def setSocket(self, sock):
|
||||
self.__DB_SOCKET = sock
|
||||
|
||||
def setPort(self, port):
|
||||
self.__DB_PORT = port
|
||||
|
||||
def setPwd(self, pwd):
|
||||
self.__DB_PASS = pwd
|
||||
|
||||
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 = list(map(list, result))
|
||||
self.__Close()
|
||||
return result
|
||||
except Exception as ex:
|
||||
return ex
|
||||
|
||||
def __Close(self):
|
||||
# 关闭连接
|
||||
self.__DB_CUR.close()
|
||||
self.__DB_CONN.close()
|
||||
+5
-5
@@ -42,8 +42,8 @@ cd /www/server/mdserver-web/plugins/php/versions && bash all_test.sh
|
||||
| Ubuntu 20.04 |:x: |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |
|
||||
| Ubuntu 22.04 |:x: |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |
|
||||
| Fedora 31 |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |
|
||||
| Fedora 32 |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |
|
||||
| AlmaLinix 9 |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |
|
||||
| Fedora 32 |:x: |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |
|
||||
| AlmaLinix 9 |:x: |✅ |✅ |:x: |:x: |:x: |:x: |:x: |✅ |:x: |:x: |:x: |
|
||||
| RockyLinux 8.6 |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |
|
||||
| openSUSE 15.4 |:x: |:x: |:x: |:x: |:x: |:x: |:x: |:x: |:x: |:x: |:x: |:x: |
|
||||
|
||||
@@ -57,12 +57,12 @@ cd /www/server/mdserver-web/plugins/php/versions && bash all_test.sh
|
||||
| CentOS 9 Stream |✅ |:x: |:x: |:x: |
|
||||
| Debian 10.3 |✅ |✅ |✅ |:x: |
|
||||
| Debian 11.3 |✅ |✅ |✅ |✅ |
|
||||
| Ubuntu 18.04 |✅ |✅ |✅ |✅ |
|
||||
| Ubuntu 20.04 |✅ |✅ |✅ |✅ |
|
||||
| Ubuntu 18.04 |✅ |✅ |✅ |:x: |
|
||||
| Ubuntu 20.04 |✅ |✅ |✅ |:x: |
|
||||
| Ubuntu 22.04 |✅ |✅ |✅ |✅ |
|
||||
| Fedora 31 |✅ |✅ |✅ |✅ |
|
||||
| Fedora 32 |✅ |✅ |✅ |✅ |
|
||||
| AlmaLinix 9 |✅ |✅ |✅ |✅ |
|
||||
| AlmaLinix 9 |✅ |:x: |:x: |:x: |
|
||||
| RockyLinux 8.6 |✅ |✅ |✅ |✅ |
|
||||
| openSUSE 15.4 |:x: |:x: |:x: |:x: |
|
||||
|
||||
|
||||
+21
-12
@@ -216,8 +216,11 @@ def getRootPath():
|
||||
|
||||
|
||||
def getDbConfValue():
|
||||
content = mw.readFile(getConf())
|
||||
conf = getConf()
|
||||
if not os.path.exists(conf):
|
||||
return {}
|
||||
|
||||
content = mw.readFile(conf)
|
||||
rep_scope = "\[database\](.*?)\["
|
||||
tmp = re.findall(rep_scope, content, re.S)
|
||||
|
||||
@@ -383,6 +386,10 @@ def postReceiveLog():
|
||||
|
||||
|
||||
def getGogsConf():
|
||||
conf = getConf()
|
||||
if not os.path.exists(conf):
|
||||
return mw.returnJson(False, "请先安装初始化!")
|
||||
|
||||
gets = [
|
||||
{'name': 'DOMAIN', 'type': -1, 'ps': '服务器域名'},
|
||||
{'name': 'ROOT_URL', 'type': -1, 'ps': '公开的完整URL路径'},
|
||||
@@ -403,7 +410,7 @@ def getGogsConf():
|
||||
{'name': 'SHOW_FOOTER_VERSION', 'type': 2, 'ps': 'Gogs版本信息'},
|
||||
{'name': 'SHOW_FOOTER_TEMPLATE_LOAD_TIME', 'type': 2, 'ps': 'Gogs模板加载时间'},
|
||||
]
|
||||
conf = mw.readFile(getConf())
|
||||
conf = mw.readFile(conf)
|
||||
result = []
|
||||
|
||||
for g in gets:
|
||||
@@ -413,7 +420,7 @@ def getGogsConf():
|
||||
continue
|
||||
g['value'] = tmp.groups()[0]
|
||||
result.append(g)
|
||||
return mw.getJson(result)
|
||||
return mw.returnJson(True, 'OK', result)
|
||||
|
||||
|
||||
def submitGogsConf():
|
||||
@@ -445,6 +452,11 @@ def submitGogsConf():
|
||||
|
||||
|
||||
def userList():
|
||||
|
||||
conf = getConf()
|
||||
if not os.path.exists(conf):
|
||||
return mw.returnJson(False, "请先安装初始化!")
|
||||
|
||||
import math
|
||||
args = getArgs()
|
||||
|
||||
@@ -607,11 +619,9 @@ def projectScriptLoad():
|
||||
|
||||
def projectScriptUnload():
|
||||
args = getArgs()
|
||||
if not 'user' in args:
|
||||
return mw.returnJson(True, 'username missing')
|
||||
|
||||
if not 'name' in args:
|
||||
return mw.returnJson(True, 'project name missing')
|
||||
data = checkArgs(args, ['user', 'name'])
|
||||
if not data[0]:
|
||||
return data[1]
|
||||
|
||||
user = args['user']
|
||||
name = args['name'] + '.git'
|
||||
@@ -628,11 +638,10 @@ def projectScriptUnload():
|
||||
|
||||
def projectScriptDebug():
|
||||
args = getArgs()
|
||||
if not 'user' in args:
|
||||
return mw.returnJson(True, 'username missing')
|
||||
data = checkArgs(args, ['user', 'name'])
|
||||
if not data[0]:
|
||||
return data[1]
|
||||
|
||||
if not 'name' in args:
|
||||
return mw.returnJson(True, 'project name missing')
|
||||
user = args['user']
|
||||
name = args['name'] + '.git'
|
||||
commit_log = getRootPath() + '/' + user + '/' + name + \
|
||||
|
||||
+10
-4
@@ -39,9 +39,12 @@ function gogsPost(method,args,callback, title){
|
||||
|
||||
function gogsSetConfig(){
|
||||
gogsPost('get_gogs_conf', '', function(data){
|
||||
// console.log(data);
|
||||
var rdata = $.parseJSON(data.data);
|
||||
// console.log(rdata);
|
||||
var rrdata = $.parseJSON(data.data);
|
||||
if (!rrdata.status){
|
||||
layer.msg(rrdata.msg,{icon:0,time:2000,shade: [0.3, '#000']});
|
||||
return;
|
||||
}
|
||||
var rdata = rrdata.data;
|
||||
var mlist = '';
|
||||
for (var i = 0; i < rdata.length; i++) {
|
||||
var w = '140';
|
||||
@@ -141,7 +144,10 @@ function gogsUserList(page, search) {
|
||||
gogsPost('user_list', _data, function(data){
|
||||
|
||||
var rdata = $.parseJSON(data.data);
|
||||
// console.log(rdata);
|
||||
if (!rdata.status){
|
||||
layer.msg(rdata.msg,{icon:0,time:2000,shade: [0.3, '#000']});
|
||||
return;
|
||||
}
|
||||
content = '<div class="finduser"><input class="bt-input-text mr5 outline_no" type="text" placeholder="查找用户名" id="find_user" style="height: 28px; border-radius: 3px;width: 435px;">';
|
||||
content += '<button class="btn btn-success btn-sm" onclick="userFind();">查找</button></div>';
|
||||
|
||||
|
||||
Executable
+28
@@ -0,0 +1,28 @@
|
||||
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
|
||||
);
|
||||
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
[client]
|
||||
user = root
|
||||
#password = your_password
|
||||
port = 33106
|
||||
socket = {$SERVER_APP_PATH}/mysql.sock
|
||||
|
||||
[mysqld]
|
||||
pid-file = {$SERVER_APP_PATH}/data/mysql.pid
|
||||
user = mysql
|
||||
port = 33106
|
||||
socket = {$SERVER_APP_PATH}/mysql.sock
|
||||
basedir = {$SERVER_APP_PATH}
|
||||
datadir = {$SERVER_APP_PATH}/data
|
||||
log-error = {$SERVER_APP_PATH}/data/error.log
|
||||
default_storage_engine = MyISAM
|
||||
key_buffer_size = 8M
|
||||
max_allowed_packet = 100M
|
||||
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=1
|
||||
query_cache_size = 4M
|
||||
tmp_table_size = 8M
|
||||
|
||||
max_connections = 500
|
||||
max_connect_errors = 100
|
||||
open_files_limit = 65535
|
||||
|
||||
#skip-networking
|
||||
#skip-name-resolve
|
||||
#skip-external-locking
|
||||
#loose-skip-innodb
|
||||
#skip-grant-tables
|
||||
|
||||
|
||||
log-bin=mysql-bin
|
||||
binlog_format=mixed
|
||||
server-id = 1
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
|
||||
secure-file-priv={$SERVER_APP_PATH}/tmp
|
||||
|
||||
[mysqldump]
|
||||
quick
|
||||
max_allowed_packet = 16M
|
||||
|
||||
[mysql]
|
||||
no-auto-rehash
|
||||
|
||||
[myisamchk]
|
||||
key_buffer_size = 20M
|
||||
sort_buffer_size = 20M
|
||||
read_buffer = 2M
|
||||
write_buffer = 2M
|
||||
|
||||
[mysqlhotcopy]
|
||||
interactive-timeout
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
Executable
+60
@@ -0,0 +1,60 @@
|
||||
<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('mariadb', $('.plugin_version').attr('version'));">服务</p>
|
||||
<p onclick="pluginInitD('mariadb', $('.plugin_version').attr('version'));">自启动</p>
|
||||
<p onclick="pluginConfig('mariadb', $('.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('mariadb',$('.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);
|
||||
|
||||
var loading = layer.msg("资源加载中...", { icon: 16, time: 0, shade: 0.3 });
|
||||
$.getScript( "/plugins/file?name=mariadb&f=js/mariadb.js", function(){
|
||||
layer.close(loading);
|
||||
pluginService('mariadb',$('.plugin_version').attr('version'));
|
||||
});
|
||||
</script>
|
||||
Executable
+1344
File diff suppressed because it is too large
Load Diff
Executable
+18
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"title":"MariaDB",
|
||||
"tip":"soft",
|
||||
"name":"mariadb",
|
||||
"type":"运行环境",
|
||||
"ps":"一种关系数据库管理系统!",
|
||||
"uninstall_pre_inspection":true,
|
||||
"checks": "server/mariadb",
|
||||
"path": "server/mariadb",
|
||||
"versions":["10.6","10.7","10.8"],
|
||||
"shell":"install.sh",
|
||||
"checks":"server/mariadb",
|
||||
"path":"server/mariadb",
|
||||
"author":"mariadb",
|
||||
"home":"https://mariadb.org/",
|
||||
"date":"2022-07-12",
|
||||
"pid": "2"
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
[Unit]
|
||||
Description=MariaDB Server: The open source relational database
|
||||
Documentation=https://mariadb.org/download/?t=mariadb
|
||||
After=network.service
|
||||
After=syslog.target
|
||||
|
||||
[Service]
|
||||
User=mysql
|
||||
Group=mysql
|
||||
Type=simple
|
||||
ExecStart={$SERVER_PATH}/mariadb/bin/mysqld --defaults-file={$SERVER_PATH}/mariadb/etc/my.cnf
|
||||
ExecReload=/bin/kill -USR2 $MAINPID
|
||||
PermissionsStartOnly=true
|
||||
LimitNOFILE=5000
|
||||
Restart=on-failure
|
||||
RestartSec=10
|
||||
RestartPreventExitStatus=1
|
||||
PrivateTmp=false
|
||||
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Executable
+376
@@ -0,0 +1,376 @@
|
||||
#!/bin/sh
|
||||
# Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
|
||||
# This file is public domain and comes with NO WARRANTY of any kind
|
||||
|
||||
# MySQL daemon start/stop script.
|
||||
|
||||
# Usually this is put in /etc/init.d (at least on machines SYSV R4 based
|
||||
# systems) and linked to /etc/rc3.d/S99mysql and /etc/rc0.d/K01mysql.
|
||||
# When this is done the mysql server will be started when the machine is
|
||||
# started and shut down when the systems goes down.
|
||||
|
||||
# Comments to support chkconfig on RedHat Linux
|
||||
# chkconfig: 2345 64 36
|
||||
# description: A very fast and reliable SQL database engine.
|
||||
|
||||
# Comments to support LSB init script conventions
|
||||
### BEGIN INIT INFO
|
||||
# Provides: mysql
|
||||
# Required-Start: $local_fs $network $remote_fs
|
||||
# Should-Start: ypbind nscd ldap ntpd xntpd
|
||||
# Required-Stop: $local_fs $network $remote_fs
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: start and stop MySQL
|
||||
# Description: MySQL is a very fast and reliable SQL database engine.
|
||||
### END INIT INFO
|
||||
|
||||
# If you install MySQL on some other places than /Users/midoks/Desktop/fwww/server/mysql, then you
|
||||
# have to do one of the following things for this script to work:
|
||||
#
|
||||
# - Run this script from within the MySQL installation directory
|
||||
# - Create a /etc/my.cnf file with the following information:
|
||||
# [mysqld]
|
||||
# basedir=<path-to-mysql-installation-directory>
|
||||
# - Add the above to any other configuration file (for example ~/.my.ini)
|
||||
# and copy my_print_defaults to /usr/bin
|
||||
# - Add the path to the mysql-installation-directory to the basedir variable
|
||||
# below.
|
||||
#
|
||||
# If you want to affect other MySQL variables, you should make your changes
|
||||
# in the /etc/my.cnf, ~/.my.cnf or other MySQL configuration files.
|
||||
|
||||
# If you change base dir, you must also change datadir. These may get
|
||||
# overwritten by settings in the MySQL configuration files.
|
||||
|
||||
basedir=
|
||||
datadir=
|
||||
|
||||
# Default value, in seconds, afterwhich the script should timeout waiting
|
||||
# for server start.
|
||||
# Value here is overriden by value in my.cnf.
|
||||
# 0 means don't wait at all
|
||||
# Negative numbers mean to wait indefinitely
|
||||
service_startup_timeout=900
|
||||
|
||||
# Lock directory for RedHat / SuSE.
|
||||
lockdir='/var/lock/subsys'
|
||||
lock_file_path="$lockdir/mysql"
|
||||
|
||||
# The following variables are only set for letting mysql.server find things.
|
||||
|
||||
# Set some defaults
|
||||
mysqld_pid_file_path=
|
||||
if test -z "$basedir"
|
||||
then
|
||||
basedir={$SERVER_APP_PATH}
|
||||
bindir={$SERVER_APP_PATH}/bin
|
||||
if test -z "$datadir"
|
||||
then
|
||||
datadir={$SERVER_APP_PATH}/data
|
||||
fi
|
||||
sbindir={$SERVER_APP_PATH}/bin
|
||||
libexecdir={$SERVER_APP_PATH}/bin
|
||||
else
|
||||
bindir="$basedir/bin"
|
||||
if test -z "$datadir"
|
||||
then
|
||||
datadir="$basedir/data"
|
||||
fi
|
||||
sbindir="$basedir/sbin"
|
||||
libexecdir="$basedir/libexec"
|
||||
fi
|
||||
|
||||
# datadir_set is used to determine if datadir was set (and so should be
|
||||
# *not* set inside of the --basedir= handler.)
|
||||
datadir_set=
|
||||
|
||||
#
|
||||
# Use LSB init script functions for printing messages, if possible
|
||||
#
|
||||
lsb_functions="/lib/lsb/init-functions"
|
||||
if test -f $lsb_functions ; then
|
||||
. $lsb_functions
|
||||
else
|
||||
log_success_msg()
|
||||
{
|
||||
echo " SUCCESS! $@"
|
||||
}
|
||||
log_failure_msg()
|
||||
{
|
||||
echo " ERROR! $@"
|
||||
}
|
||||
fi
|
||||
|
||||
PATH="/sbin:/usr/sbin:/bin:/usr/bin:$basedir/bin"
|
||||
export PATH
|
||||
|
||||
mode=$1 # start or stop
|
||||
|
||||
[ $# -ge 1 ] && shift
|
||||
|
||||
|
||||
other_args="$*" # uncommon, but needed when called from an RPM upgrade action
|
||||
# Expected: "--skip-networking --skip-grant-tables"
|
||||
# They are not checked here, intentionally, as it is the resposibility
|
||||
# of the "spec" file author to give correct arguments only.
|
||||
|
||||
case `echo "testing\c"`,`echo -n testing` in
|
||||
*c*,-n*) echo_n= echo_c= ;;
|
||||
*c*,*) echo_n=-n echo_c= ;;
|
||||
*) echo_n= echo_c='\c' ;;
|
||||
esac
|
||||
|
||||
parse_server_arguments() {
|
||||
for arg do
|
||||
case "$arg" in
|
||||
--basedir=*) basedir=`echo "$arg" | sed -e 's/^[^=]*=//'`
|
||||
bindir="$basedir/bin"
|
||||
if test -z "$datadir_set"; then
|
||||
datadir="$basedir/data"
|
||||
fi
|
||||
sbindir="$basedir/sbin"
|
||||
libexecdir="$basedir/libexec"
|
||||
;;
|
||||
--datadir=*) datadir=`echo "$arg" | sed -e 's/^[^=]*=//'`
|
||||
datadir_set=1
|
||||
;;
|
||||
--pid-file=*) mysqld_pid_file_path=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
|
||||
--service-startup-timeout=*) service_startup_timeout=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
wait_for_pid () {
|
||||
verb="$1" # created | removed
|
||||
pid="$2" # process ID of the program operating on the pid-file
|
||||
pid_file_path="$3" # path to the PID file.
|
||||
|
||||
i=0
|
||||
avoid_race_condition="by checking again"
|
||||
|
||||
while test $i -ne $service_startup_timeout ; do
|
||||
|
||||
case "$verb" in
|
||||
'created')
|
||||
# wait for a PID-file to pop into existence.
|
||||
test -s "$pid_file_path" && i='' && break
|
||||
;;
|
||||
'removed')
|
||||
# wait for this PID-file to disappear
|
||||
test ! -s "$pid_file_path" && i='' && break
|
||||
;;
|
||||
*)
|
||||
echo "wait_for_pid () usage: wait_for_pid created|removed pid pid_file_path"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# if server isn't running, then pid-file will never be updated
|
||||
if test -n "$pid"; then
|
||||
if kill -0 "$pid" 2>/dev/null; then
|
||||
: # the server still runs
|
||||
else
|
||||
# The server may have exited between the last pid-file check and now.
|
||||
if test -n "$avoid_race_condition"; then
|
||||
avoid_race_condition=""
|
||||
continue # Check again.
|
||||
fi
|
||||
|
||||
# there's nothing that will affect the file.
|
||||
log_failure_msg "The server quit without updating PID file ($pid_file_path)."
|
||||
return 1 # not waiting any more.
|
||||
fi
|
||||
fi
|
||||
|
||||
echo $echo_n ".$echo_c"
|
||||
i=`expr $i + 1`
|
||||
sleep 1
|
||||
|
||||
done
|
||||
|
||||
if test -z "$i" ; then
|
||||
log_success_msg
|
||||
return 0
|
||||
else
|
||||
log_failure_msg
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Get arguments from the my.cnf file,
|
||||
# the only group, which is read from now on is [mysqld]
|
||||
if test -x "$bindir/my_print_defaults"; then
|
||||
print_defaults="$bindir/my_print_defaults"
|
||||
else
|
||||
# Try to find basedir in /etc/my.cnf
|
||||
conf=/etc/my.cnf
|
||||
print_defaults=
|
||||
if test -r $conf
|
||||
then
|
||||
subpat='^[^=]*basedir[^=]*=\(.*\)$'
|
||||
dirs=`sed -e "/$subpat/!d" -e 's//\1/' $conf`
|
||||
for d in $dirs
|
||||
do
|
||||
d=`echo $d | sed -e 's/[ ]//g'`
|
||||
if test -x "$d/bin/my_print_defaults"
|
||||
then
|
||||
print_defaults="$d/bin/my_print_defaults"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# Hope it's in the PATH ... but I doubt it
|
||||
test -z "$print_defaults" && print_defaults="my_print_defaults"
|
||||
fi
|
||||
|
||||
#
|
||||
# Read defaults file from 'basedir'. If there is no defaults file there
|
||||
# check if it's in the old (depricated) place (datadir) and read it from there
|
||||
#
|
||||
|
||||
extra_args=""
|
||||
if test -r "$basedir/my.cnf"
|
||||
then
|
||||
extra_args="-e $basedir/my.cnf"
|
||||
fi
|
||||
|
||||
parse_server_arguments `$print_defaults $extra_args mysqld server mysql_server mysql.server`
|
||||
|
||||
#
|
||||
# Set pid file if not given
|
||||
#
|
||||
if test -z "$mysqld_pid_file_path"
|
||||
then
|
||||
mysqld_pid_file_path=$datadir/`hostname`.pid
|
||||
else
|
||||
case "$mysqld_pid_file_path" in
|
||||
/* ) ;;
|
||||
* ) mysqld_pid_file_path="$datadir/$mysqld_pid_file_path" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
case "$mode" in
|
||||
'start')
|
||||
# Start daemon
|
||||
|
||||
# Safeguard (relative paths, core dumps..)
|
||||
cd $basedir
|
||||
|
||||
echo $echo_n "Starting MySQL"
|
||||
if test -x $bindir/mysqld_safe
|
||||
then
|
||||
# Give extra arguments to mysqld with the my.cnf file. This script
|
||||
# may be overwritten at next upgrade.
|
||||
$bindir/mysqld_safe --datadir="$datadir" --pid-file="$mysqld_pid_file_path" $other_args >/dev/null &
|
||||
wait_for_pid created "$!" "$mysqld_pid_file_path"; return_value=$?
|
||||
|
||||
# Make lock for RedHat / SuSE
|
||||
if test -w "$lockdir"
|
||||
then
|
||||
touch "$lock_file_path"
|
||||
fi
|
||||
|
||||
exit $return_value
|
||||
else
|
||||
log_failure_msg "Couldn't find MySQL server ($bindir/mysqld_safe)"
|
||||
fi
|
||||
;;
|
||||
|
||||
'stop')
|
||||
# Stop daemon. We use a signal here to avoid having to know the
|
||||
# root password.
|
||||
|
||||
if test -s "$mysqld_pid_file_path"
|
||||
then
|
||||
# signal mysqld_safe that it needs to stop
|
||||
touch "$mysqld_pid_file_path.shutdown"
|
||||
|
||||
mysqld_pid=`cat "$mysqld_pid_file_path"`
|
||||
|
||||
if (kill -0 $mysqld_pid 2>/dev/null)
|
||||
then
|
||||
echo $echo_n "Shutting down MySQL"
|
||||
kill $mysqld_pid
|
||||
# mysqld should remove the pid file when it exits, so wait for it.
|
||||
wait_for_pid removed "$mysqld_pid" "$mysqld_pid_file_path"; return_value=$?
|
||||
else
|
||||
log_failure_msg "MySQL server process #$mysqld_pid is not running!"
|
||||
rm "$mysqld_pid_file_path"
|
||||
fi
|
||||
|
||||
# Delete lock for RedHat / SuSE
|
||||
if test -f "$lock_file_path"
|
||||
then
|
||||
rm -f "$lock_file_path"
|
||||
fi
|
||||
exit $return_value
|
||||
else
|
||||
log_failure_msg "MySQL server PID file could not be found!"
|
||||
fi
|
||||
;;
|
||||
|
||||
'restart')
|
||||
# Stop the service and regardless of whether it was
|
||||
# running or not, start it again.
|
||||
if $0 stop $other_args; then
|
||||
$0 start $other_args
|
||||
else
|
||||
log_failure_msg "Failed to stop running server, so refusing to try to start."
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
'reload'|'force-reload')
|
||||
if test -s "$mysqld_pid_file_path" ; then
|
||||
read mysqld_pid < "$mysqld_pid_file_path"
|
||||
kill -HUP $mysqld_pid && log_success_msg "Reloading service MySQL"
|
||||
touch "$mysqld_pid_file_path"
|
||||
else
|
||||
log_failure_msg "MySQL PID file could not be found!"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
'status')
|
||||
# First, check to see if pid file exists
|
||||
if test -s "$mysqld_pid_file_path" ; then
|
||||
read mysqld_pid < "$mysqld_pid_file_path"
|
||||
if kill -0 $mysqld_pid 2>/dev/null ; then
|
||||
log_success_msg "MySQL running ($mysqld_pid)"
|
||||
exit 0
|
||||
else
|
||||
log_failure_msg "MySQL is not running, but PID file exists"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
# Try to find appropriate mysqld process
|
||||
mysqld_pid=`pgrep -d' ' -f $libexecdir/mysqld`
|
||||
|
||||
# test if multiple pids exist
|
||||
pid_count=`echo $mysqld_pid | wc -w`
|
||||
if test $pid_count -gt 1 ; then
|
||||
log_failure_msg "Multiple MySQL running but PID file could not be found ($mysqld_pid)"
|
||||
exit 5
|
||||
elif test -z $mysqld_pid ; then
|
||||
if test -f "$lock_file_path" ; then
|
||||
log_failure_msg "MySQL is not running, but lock file ($lock_file_path) exists"
|
||||
exit 2
|
||||
fi
|
||||
log_failure_msg "MySQL is not running"
|
||||
exit 3
|
||||
else
|
||||
log_failure_msg "MySQL is running but PID file could not be found"
|
||||
exit 4
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
# usage
|
||||
basename=`basename "$0"`
|
||||
echo "Usage: $basename {start|stop|restart|reload|force-reload|status} [ MySQL server options ]"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
Executable
+44
@@ -0,0 +1,44 @@
|
||||
#!/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
|
||||
|
||||
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/mariadb.service ] || [ -f /lib/systemd/system/mariadb.service ];then
|
||||
systemctl stop mariadb
|
||||
systemctl disable mariadb
|
||||
rm -rf /usr/lib/systemd/system/mariadb.service
|
||||
rm -rf /lib/systemd/system/mariadb.service
|
||||
systemctl daemon-reload
|
||||
fi
|
||||
fi
|
||||
|
||||
sh -x $curPath/versions/$2/install.sh $1
|
||||
|
||||
if [ "${action}" == "install" ] && [ -d $serverPath/mariadb ];then
|
||||
#初始化
|
||||
cd ${rootPath} && python3 ${rootPath}/plugins/mariadb/index.py start ${type}
|
||||
cd ${rootPath} && python3 ${rootPath}/plugins/mariadb/index.py initd_install ${type}
|
||||
fi
|
||||
Executable
+1221
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,66 @@
|
||||
# coding:utf-8
|
||||
|
||||
import sys
|
||||
import io
|
||||
import os
|
||||
import time
|
||||
import subprocess
|
||||
import re
|
||||
import json
|
||||
|
||||
cur_dir = os.getcwd()
|
||||
plugin_dir = os.path.dirname(cur_dir)
|
||||
|
||||
# print(plugin_dir)
|
||||
root_dir = os.path.dirname(os.path.dirname(plugin_dir))
|
||||
# print(root_dir)
|
||||
|
||||
sys.path.append(root_dir + "/class/core")
|
||||
import mw
|
||||
|
||||
os.chdir(root_dir)
|
||||
|
||||
|
||||
def getPluginName():
|
||||
return 'mariadb'
|
||||
|
||||
|
||||
def getPluginDir():
|
||||
return root_dir + '/plugins/' + getPluginName()
|
||||
|
||||
|
||||
def getServerDir():
|
||||
return os.path.dirname(root_dir) + '/' + getPluginName()
|
||||
|
||||
|
||||
def pSqliteDb(dbname='databases'):
|
||||
file = getServerDir() + '/mariadb.db'
|
||||
name = 'mysql'
|
||||
if not os.path.exists(file):
|
||||
conn = mw.M(dbname).dbPos(getServerDir(), name)
|
||||
csql = mw.readFile(getPluginDir() + '/conf/mariadb.sql')
|
||||
csql_list = csql.split(';')
|
||||
for index in range(len(csql_list)):
|
||||
conn.execute(csql_list[index], ())
|
||||
else:
|
||||
conn = mw.M(dbname).dbPos(getServerDir(), name)
|
||||
return conn
|
||||
|
||||
|
||||
def getConf():
|
||||
path = getServerDir() + '/etc/my.cnf'
|
||||
return path
|
||||
|
||||
|
||||
def pMysqlDb():
|
||||
db = mw.getMyORM()
|
||||
db.setDbConf(getConf())
|
||||
db.__DB_SOCKET = mw.getServerDir() + '/mysql/mysql.socket'
|
||||
|
||||
print(mw.getServerDir() + '/mysql/mysql.socket')
|
||||
db.setPwd(pSqliteDb('config').where('id=?', (1,)).getField('mysql_root'))
|
||||
return db
|
||||
|
||||
if __name__ == '__main__':
|
||||
p = pMysqlDb()
|
||||
print(p.query("select User,Host from mysql.user where User!='root' AND Host!='localhost' AND Host!=''"))
|
||||
Executable
+69
@@ -0,0 +1,69 @@
|
||||
# coding: utf-8
|
||||
|
||||
import sys
|
||||
import os
|
||||
import json
|
||||
import time
|
||||
|
||||
sys.path.append(os.getcwd() + "/class/core")
|
||||
import mw
|
||||
import db
|
||||
|
||||
cmd = 'ls /usr/local/lib/ | grep python | cut -d \\ -f 1 | awk \'END {print}\''
|
||||
info = mw.execShell(cmd)
|
||||
p = "/usr/local/lib/" + info[0].strip() + "/site-packages"
|
||||
sys.path.append(p)
|
||||
|
||||
|
||||
def set_mysql_root(password):
|
||||
# 设置MySQL密码
|
||||
import db
|
||||
import os
|
||||
sql = db.Sql()
|
||||
|
||||
root_mysql = '''#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
pwd=$1
|
||||
${server}/init.d/mysql stop
|
||||
${server}/bin/mysqld_safe --skip-grant-tables&
|
||||
echo '正在修改密码...';
|
||||
echo 'The set password...';
|
||||
sleep 6
|
||||
m_version=$(cat ${server}/version.pl|grep -E "(5.1.|5.5.|5.6.|mariadb)")
|
||||
if [ "$m_version" != "" ];then
|
||||
${server}/bin/mysql -uroot -e "insert into mysql.user(Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv,Reload_priv,Shutdown_priv,Process_priv,File_priv,Grant_priv,References_priv,Index_priv,Alter_priv,Show_db_priv,Super_priv,Create_tmp_table_priv,Lock_tables_priv,Execute_priv,Repl_slave_priv,Repl_client_priv,Create_view_priv,Show_view_priv,Create_routine_priv,Alter_routine_priv,Create_user_priv,Event_priv,Trigger_priv,Create_tablespace_priv,User,Password,host)values('Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','root',password('${pwd}'),'127.0.0.1')"
|
||||
${server}/bin/mysql -uroot -e "insert into mysql.user(Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv,Reload_priv,Shutdown_priv,Process_priv,File_priv,Grant_priv,References_priv,Index_priv,Alter_priv,Show_db_priv,Super_priv,Create_tmp_table_priv,Lock_tables_priv,Execute_priv,Repl_slave_priv,Repl_client_priv,Create_view_priv,Show_view_priv,Create_routine_priv,Alter_routine_priv,Create_user_priv,Event_priv,Trigger_priv,Create_tablespace_priv,User,Password,host)values('Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','root',password('${pwd}'),'localhost')"
|
||||
${server}/bin/mysql -uroot -e "UPDATE mysql.user SET password=PASSWORD('${pwd}') WHERE user='root'";
|
||||
else
|
||||
${server}/bin/mysql -uroot -e "UPDATE mysql.user SET authentication_string='' WHERE user='root'";
|
||||
${server}/bin/mysql -uroot -e "FLUSH PRIVILEGES";
|
||||
${server}/bin/mysql -uroot -e "ALTER USER 'root'@'localhost' IDENTIFIED BY '${pwd}';";
|
||||
fi
|
||||
${server} -uroot -e "FLUSH PRIVILEGES";
|
||||
pkill -9 mysqld_safe
|
||||
pkill -9 mysqld
|
||||
sleep 2
|
||||
${server}/init.d/mysql start
|
||||
|
||||
echo '==========================================='
|
||||
echo "root密码成功修改为: ${pwd}"
|
||||
echo "The root password set ${pwd} successuful"'''
|
||||
|
||||
server = mw.getServerDir() + '/mariadb'
|
||||
root_mysql = root_mysql.replace('${server}', server)
|
||||
mw.writeFile('mysql_root.sh', root_mysql)
|
||||
os.system("/bin/bash mysql_root.sh " + password)
|
||||
os.system("rm -f mysql_root.sh")
|
||||
|
||||
pos = mw.getServerDir() + '/mariadb'
|
||||
result = sql.table('config').dbPos(pos, 'mysql').where(
|
||||
'id=?', (1,)).setField('mysql_root', password)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
type = sys.argv[1]
|
||||
if type == 'root':
|
||||
set_mysql_root(sys.argv[2])
|
||||
else:
|
||||
print('ERROR: Parameter error')
|
||||
Executable
+87
@@ -0,0 +1,87 @@
|
||||
#!/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.5.html#downloads
|
||||
#https://dev.mysql.com/downloads/file/?id=480541
|
||||
|
||||
curPath=`pwd`
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
sysName=`uname`
|
||||
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
mariadbDir=${serverPath}/source/mariadb
|
||||
|
||||
MY_VER=10.6.8
|
||||
|
||||
Install_app()
|
||||
{
|
||||
mkdir -p ${mariadbDir}
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
|
||||
if id mysql &> /dev/null ;then
|
||||
echo "mysql UID is `id -u www`"
|
||||
echo "mysql Shell is `grep "^www:" /etc/passwd |cut -d':' -f7 `"
|
||||
else
|
||||
groupadd mysql
|
||||
useradd -g mysql mysql
|
||||
fi
|
||||
|
||||
if [ "$sysName" != "Darwin" ];then
|
||||
mkdir -p /var/log/mariadb
|
||||
touch /var/log/mariadb/mariadb.log
|
||||
fi
|
||||
|
||||
if [ ! -f ${mariadbDir}/mariadb-${MY_VER}.tar.gz ];then
|
||||
wget -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 \
|
||||
-DCMAKE_INSTALL_PREFIX=$serverPath/mariadb \
|
||||
-DMYSQL_DATADIR=$serverPath/mariadb/data/ \
|
||||
-DMYSQL_USER=mysql \
|
||||
-DMYSQL_UNIX_ADDR=$serverPath/mariadb/mysql.sock \
|
||||
-DWITH_MYISAM_STORAGE_ENGINE=1 \
|
||||
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
|
||||
-DWITH_MEMORY_STORAGE_ENGINE=1 \
|
||||
-DENABLED_LOCAL_INFILE=1 \
|
||||
-DWITH_PARTITION_STORAGE_ENGINE=1 \
|
||||
-DEXTRA_CHARSETS=all \
|
||||
-DDEFAULT_CHARSET=utf8mb4 \
|
||||
-DDEFAULT_COLLATION=utf8mb4_general_ci \
|
||||
-DCMAKE_C_COMPILER=/usr/bin/gcc \
|
||||
-DCMAKE_CXX_COMPILER=/usr/bin/g++
|
||||
make && make install && make clean
|
||||
|
||||
if [ -d $serverPath/mariadb ];then
|
||||
echo '10.6' > $serverPath/mariadb/version.pl
|
||||
echo '安装完成' > $install_tmp
|
||||
else
|
||||
# rm -rf ${mariadbDir}/mariadb-${MY_VER}
|
||||
echo '安装失败' > $install_tmp
|
||||
echo 'install fail'>&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
Uninstall_app()
|
||||
{
|
||||
rm -rf $serverPath/mariadb
|
||||
echo '卸载完成' > $install_tmp
|
||||
}
|
||||
|
||||
action=$1
|
||||
if [ "${1}" == 'install' ];then
|
||||
Install_app
|
||||
else
|
||||
Uninstall_app
|
||||
fi
|
||||
Executable
+87
@@ -0,0 +1,87 @@
|
||||
#!/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.5.html#downloads
|
||||
#https://dev.mysql.com/downloads/file/?id=480541
|
||||
|
||||
curPath=`pwd`
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
sysName=`uname`
|
||||
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
mariadbDir=${serverPath}/source/mariadb
|
||||
|
||||
MY_VER=10.7.4
|
||||
|
||||
Install_app()
|
||||
{
|
||||
mkdir -p ${mariadbDir}
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
|
||||
if id mysql &> /dev/null ;then
|
||||
echo "mysql UID is `id -u www`"
|
||||
echo "mysql Shell is `grep "^www:" /etc/passwd |cut -d':' -f7 `"
|
||||
else
|
||||
groupadd mysql
|
||||
useradd -g mysql mysql
|
||||
fi
|
||||
|
||||
if [ "$sysName" != "Darwin" ];then
|
||||
mkdir -p /var/log/mariadb
|
||||
touch /var/log/mariadb/mariadb.log
|
||||
fi
|
||||
|
||||
if [ ! -f ${mariadbDir}/mariadb-${MY_VER}.tar.gz ];then
|
||||
wget -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 \
|
||||
-DCMAKE_INSTALL_PREFIX=$serverPath/mariadb \
|
||||
-DMYSQL_DATADIR=$serverPath/mariadb/data/ \
|
||||
-DMYSQL_USER=mysql \
|
||||
-DMYSQL_UNIX_ADDR=$serverPath/mariadb/mysql.sock \
|
||||
-DWITH_MYISAM_STORAGE_ENGINE=1 \
|
||||
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
|
||||
-DWITH_MEMORY_STORAGE_ENGINE=1 \
|
||||
-DENABLED_LOCAL_INFILE=1 \
|
||||
-DWITH_PARTITION_STORAGE_ENGINE=1 \
|
||||
-DEXTRA_CHARSETS=all \
|
||||
-DDEFAULT_CHARSET=utf8mb4 \
|
||||
-DDEFAULT_COLLATION=utf8mb4_general_ci \
|
||||
-DCMAKE_C_COMPILER=/usr/bin/gcc \
|
||||
-DCMAKE_CXX_COMPILER=/usr/bin/g++
|
||||
make && make install && make clean
|
||||
|
||||
if [ -d $serverPath/mariadb ];then
|
||||
echo '10.7' > $serverPath/mariadb/version.pl
|
||||
echo '安装完成' > $install_tmp
|
||||
else
|
||||
# rm -rf ${mariadbDir}/mariadb-${MY_VER}
|
||||
echo '安装失败' > $install_tmp
|
||||
echo 'install fail'>&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
Uninstall_app()
|
||||
{
|
||||
rm -rf $serverPath/mariadb
|
||||
echo '卸载完成' > $install_tmp
|
||||
}
|
||||
|
||||
action=$1
|
||||
if [ "${1}" == 'install' ];then
|
||||
Install_app
|
||||
else
|
||||
Uninstall_app
|
||||
fi
|
||||
Executable
+87
@@ -0,0 +1,87 @@
|
||||
#!/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.5.html#downloads
|
||||
#https://dev.mysql.com/downloads/file/?id=480541
|
||||
|
||||
curPath=`pwd`
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
sysName=`uname`
|
||||
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
mariadbDir=${serverPath}/source/mariadb
|
||||
|
||||
MY_VER=10.8.3
|
||||
|
||||
Install_app()
|
||||
{
|
||||
mkdir -p ${mariadbDir}
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
|
||||
if id mysql &> /dev/null ;then
|
||||
echo "mysql UID is `id -u www`"
|
||||
echo "mysql Shell is `grep "^www:" /etc/passwd |cut -d':' -f7 `"
|
||||
else
|
||||
groupadd mysql
|
||||
useradd -g mysql mysql
|
||||
fi
|
||||
|
||||
if [ "$sysName" != "Darwin" ];then
|
||||
mkdir -p /var/log/mariadb
|
||||
touch /var/log/mariadb/mariadb.log
|
||||
fi
|
||||
|
||||
if [ ! -f ${mariadbDir}/mariadb-${MY_VER}.tar.gz ];then
|
||||
wget -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 \
|
||||
-DCMAKE_INSTALL_PREFIX=$serverPath/mariadb \
|
||||
-DMYSQL_DATADIR=$serverPath/mariadb/data/ \
|
||||
-DMYSQL_USER=mysql \
|
||||
-DMYSQL_UNIX_ADDR=$serverPath/mariadb/mysql.sock \
|
||||
-DWITH_MYISAM_STORAGE_ENGINE=1 \
|
||||
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
|
||||
-DWITH_MEMORY_STORAGE_ENGINE=1 \
|
||||
-DENABLED_LOCAL_INFILE=1 \
|
||||
-DWITH_PARTITION_STORAGE_ENGINE=1 \
|
||||
-DEXTRA_CHARSETS=all \
|
||||
-DDEFAULT_CHARSET=utf8mb4 \
|
||||
-DDEFAULT_COLLATION=utf8mb4_general_ci \
|
||||
-DCMAKE_C_COMPILER=/usr/bin/gcc \
|
||||
-DCMAKE_CXX_COMPILER=/usr/bin/g++
|
||||
make && make install && make clean
|
||||
|
||||
if [ -d $serverPath/mariadb ];then
|
||||
echo '10.7' > $serverPath/mariadb/version.pl
|
||||
echo '安装完成' > $install_tmp
|
||||
else
|
||||
# rm -rf ${mariadbDir}/mariadb-${MY_VER}
|
||||
echo '安装失败' > $install_tmp
|
||||
echo 'install fail'>&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
Uninstall_app()
|
||||
{
|
||||
rm -rf $serverPath/mariadb
|
||||
echo '卸载完成' > $install_tmp
|
||||
}
|
||||
|
||||
action=$1
|
||||
if [ "${1}" == 'install' ];then
|
||||
Install_app
|
||||
else
|
||||
Uninstall_app
|
||||
fi
|
||||
@@ -238,8 +238,8 @@ def installPreInspection(version):
|
||||
sysName = sys[0].strip().lower()
|
||||
sysId = sys_id[0].strip()
|
||||
|
||||
if not sysName in ('centos', 'ubuntu', 'debian'):
|
||||
return '暂时仅支持centos,ubuntu,debian'
|
||||
if not sysName in ('centos', 'fedora', 'ubuntu', 'debian'):
|
||||
return '暂时仅不支持{}'.format(sysName)
|
||||
|
||||
if sysName == 'debian':
|
||||
if version > 10:
|
||||
|
||||
@@ -1,99 +0,0 @@
|
||||
# coding: utf-8
|
||||
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
|
||||
# sys.path.append("/usr/local/lib/python3.9/site-packages")
|
||||
|
||||
sys.path.append(os.getcwd() + "/class/core")
|
||||
import mw
|
||||
|
||||
# if mw.isAppleSystem():
|
||||
# cmd = 'ls /usr/local/lib/ | grep python | cut -d \\ -f 1 | awk \'END {print}\''
|
||||
# info = mw.execShell(cmd)
|
||||
# p = "/usr/local/lib/" + info[0].strip() + "/site-packages"
|
||||
# sys.path.append(p)
|
||||
|
||||
|
||||
class mysqlDb:
|
||||
__DB_PASS = None
|
||||
__DB_USER = 'root'
|
||||
__DB_PORT = 3306
|
||||
__DB_HOST = 'localhost'
|
||||
__DB_CONN = None
|
||||
__DB_CUR = None
|
||||
__DB_ERR = None
|
||||
__DB_CNF = '/etc/my.cnf'
|
||||
|
||||
def __Conn(self):
|
||||
'''连接MYSQL数据库'''
|
||||
try:
|
||||
import mw
|
||||
socket = '/www/server/mysql-ya/mysql.sock'
|
||||
try:
|
||||
import MySQLdb
|
||||
except Exception as ex:
|
||||
# print('dd')
|
||||
self.__DB_ERR = ex
|
||||
return False
|
||||
try:
|
||||
myconf = mw.readFile(self.__DB_CNF)
|
||||
rep = "port\s*=\s*([0-9]+)"
|
||||
self.__DB_PORT = int(re.search(rep, myconf).groups()[0])
|
||||
except:
|
||||
self.__DB_PORT = 3306
|
||||
# print self.__DB_PASS
|
||||
#self.__DB_PASS = mw.M('config').where('id=?', (1,)).getField('mysql_root')
|
||||
try:
|
||||
self.__DB_CONN = MySQLdb.connect(host=self.__DB_HOST, user=self.__DB_USER, passwd=self.__DB_PASS,
|
||||
port=self.__DB_PORT, charset="utf8", connect_timeout=1, 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, charset="utf8", connect_timeout=1, unix_socket=socket)
|
||||
self.__DB_CUR = self.__DB_CONN.cursor()
|
||||
return True
|
||||
except MySQLdb.Error as e:
|
||||
self.__DB_ERR = e
|
||||
return False
|
||||
|
||||
def setDbConf(self, conf):
|
||||
self.__DB_CNF = conf
|
||||
|
||||
def setPwd(self, pwd):
|
||||
self.__DB_PASS = pwd
|
||||
|
||||
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 = list(map(list, result))
|
||||
self.__Close()
|
||||
return result
|
||||
except Exception as ex:
|
||||
return ex
|
||||
|
||||
# 关闭连接
|
||||
def __Close(self):
|
||||
self.__DB_CUR.close()
|
||||
self.__DB_CONN.close()
|
||||
+36
-45
@@ -35,39 +35,14 @@ def getPluginName():
|
||||
def getPluginDir():
|
||||
return mw.getPluginDir() + '/' + getPluginName()
|
||||
|
||||
sys.path.append(getPluginDir() + "/class")
|
||||
import mysqlDb
|
||||
|
||||
|
||||
def getServerDir():
|
||||
return mw.getServerDir() + '/' + getPluginName()
|
||||
|
||||
|
||||
def is_number(s):
|
||||
try:
|
||||
float(s)
|
||||
return True
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
try:
|
||||
import unicodedata
|
||||
unicodedata.numeric(s)
|
||||
return True
|
||||
except (TypeError, ValueError):
|
||||
pass
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def getArgs():
|
||||
args = sys.argv[2:]
|
||||
|
||||
# print(args)
|
||||
|
||||
# if is_number(args):
|
||||
# args = sys.argv[3:]
|
||||
|
||||
tmp = {}
|
||||
args_len = len(args)
|
||||
|
||||
@@ -95,6 +70,38 @@ def getConf():
|
||||
return path
|
||||
|
||||
|
||||
def getDataDir():
|
||||
file = getConf()
|
||||
content = mw.readFile(file)
|
||||
rep = 'datadir\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
return tmp.groups()[0].strip()
|
||||
|
||||
|
||||
def getPidFile():
|
||||
file = getConf()
|
||||
content = mw.readFile(file)
|
||||
rep = 'pid-file\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
return tmp.groups()[0].strip()
|
||||
|
||||
|
||||
def getDbPort():
|
||||
file = getConf()
|
||||
content = mw.readFile(file)
|
||||
rep = 'port\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
return tmp.groups()[0].strip()
|
||||
|
||||
|
||||
def getSocketFile():
|
||||
file = getConf()
|
||||
content = mw.readFile(file)
|
||||
rep = 'socket\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
return tmp.groups()[0].strip()
|
||||
|
||||
|
||||
def contentReplace(content):
|
||||
service_path = mw.getServerDir()
|
||||
content = content.replace('{$ROOT_PATH}', mw.getRootDir())
|
||||
@@ -125,11 +132,11 @@ def pSqliteDb(dbname='databases'):
|
||||
|
||||
|
||||
def pMysqlDb():
|
||||
db = mysqlDb.mysqlDb()
|
||||
db = mw.getMyORM()
|
||||
db.__DB_CNF = getConf()
|
||||
db.setDbConf(getConf())
|
||||
db.setPwd(pSqliteDb('config').where(
|
||||
'id=?', (1,)).getField('mysql_root'))
|
||||
db.setPort(getDbPort())
|
||||
db.setSocket(getSocketFile())
|
||||
db.setPwd(pSqliteDb('config').where('id=?', (1,)).getField('mysql_root'))
|
||||
return db
|
||||
|
||||
|
||||
@@ -174,22 +181,6 @@ def status(version=''):
|
||||
return 'start'
|
||||
|
||||
|
||||
def getDataDir():
|
||||
file = getConf()
|
||||
content = mw.readFile(file)
|
||||
rep = 'datadir\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
return tmp.groups()[0].strip()
|
||||
|
||||
|
||||
def getPidFile():
|
||||
file = getConf()
|
||||
content = mw.readFile(file)
|
||||
rep = 'pid-file\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
return tmp.groups()[0].strip()
|
||||
|
||||
|
||||
def binLog():
|
||||
args = getArgs()
|
||||
conf = getConf()
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"tip":"soft",
|
||||
"name":"mysql-yum",
|
||||
"type":"运行环境",
|
||||
"ps":"[开发中..不要使用]一种关系数据库管理系统(极速安装)[YUM]!",
|
||||
"ps":"一种关系数据库管理系统(极速安装)[YUM]!",
|
||||
"todo_versions":["5.7","8.0"],
|
||||
"versions":["5.7","8.0"],
|
||||
"shell":"install.sh",
|
||||
|
||||
@@ -1,99 +0,0 @@
|
||||
# coding: utf-8
|
||||
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
|
||||
# sys.path.append("/usr/local/lib/python3.9/site-packages")
|
||||
|
||||
sys.path.append(os.getcwd() + "/class/core")
|
||||
import mw
|
||||
|
||||
# if mw.isAppleSystem():
|
||||
# cmd = 'ls /usr/local/lib/ | grep python | cut -d \\ -f 1 | awk \'END {print}\''
|
||||
# info = mw.execShell(cmd)
|
||||
# p = "/usr/local/lib/" + info[0].strip() + "/site-packages"
|
||||
# sys.path.append(p)
|
||||
|
||||
|
||||
class mysqlDb:
|
||||
__DB_PASS = None
|
||||
__DB_USER = 'root'
|
||||
__DB_PORT = 3306
|
||||
__DB_HOST = 'localhost'
|
||||
__DB_CONN = None
|
||||
__DB_CUR = None
|
||||
__DB_ERR = None
|
||||
__DB_CNF = '/etc/my.cnf'
|
||||
|
||||
def __Conn(self):
|
||||
'''连接MYSQL数据库'''
|
||||
try:
|
||||
import mw
|
||||
socket = '/www/server/mysql/mysql.sock'
|
||||
try:
|
||||
import MySQLdb
|
||||
except Exception as ex:
|
||||
# print('dd')
|
||||
self.__DB_ERR = ex
|
||||
return False
|
||||
try:
|
||||
myconf = mw.readFile(self.__DB_CNF)
|
||||
rep = "port\s*=\s*([0-9]+)"
|
||||
self.__DB_PORT = int(re.search(rep, myconf).groups()[0])
|
||||
except:
|
||||
self.__DB_PORT = 3306
|
||||
# print self.__DB_PASS
|
||||
#self.__DB_PASS = mw.M('config').where('id=?', (1,)).getField('mysql_root')
|
||||
try:
|
||||
self.__DB_CONN = MySQLdb.connect(host=self.__DB_HOST, user=self.__DB_USER, passwd=self.__DB_PASS,
|
||||
port=self.__DB_PORT, charset="utf8", connect_timeout=1, 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, charset="utf8", connect_timeout=1, unix_socket=socket)
|
||||
self.__DB_CUR = self.__DB_CONN.cursor()
|
||||
return True
|
||||
except MySQLdb.Error as e:
|
||||
self.__DB_ERR = e
|
||||
return False
|
||||
|
||||
def setDbConf(self, conf):
|
||||
self.__DB_CNF = conf
|
||||
|
||||
def setPwd(self, pwd):
|
||||
self.__DB_PASS = pwd
|
||||
|
||||
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 = list(map(list, result))
|
||||
self.__Close()
|
||||
return result
|
||||
except Exception as ex:
|
||||
return ex
|
||||
|
||||
# 关闭连接
|
||||
def __Close(self):
|
||||
self.__DB_CUR.close()
|
||||
self.__DB_CONN.close()
|
||||
+45
-41
@@ -35,9 +35,6 @@ def getPluginName():
|
||||
def getPluginDir():
|
||||
return mw.getPluginDir() + '/' + getPluginName()
|
||||
|
||||
sys.path.append(getPluginDir() + "/class")
|
||||
import mysqlDb
|
||||
|
||||
|
||||
def getServerDir():
|
||||
return mw.getServerDir() + '/' + getPluginName()
|
||||
@@ -49,31 +46,9 @@ def getInitDFile():
|
||||
return '/etc/init.d/' + getPluginName()
|
||||
|
||||
|
||||
def is_number(s):
|
||||
try:
|
||||
float(s)
|
||||
return True
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
try:
|
||||
import unicodedata
|
||||
unicodedata.numeric(s)
|
||||
return True
|
||||
except (TypeError, ValueError):
|
||||
pass
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def getArgs():
|
||||
args = sys.argv[2:]
|
||||
|
||||
# print(args)
|
||||
|
||||
# if is_number(args):
|
||||
# args = sys.argv[3:]
|
||||
|
||||
tmp = {}
|
||||
args_len = len(args)
|
||||
|
||||
@@ -101,6 +76,22 @@ def getConf():
|
||||
return path
|
||||
|
||||
|
||||
def getDbPort():
|
||||
file = getConf()
|
||||
content = mw.readFile(file)
|
||||
rep = 'port\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
return tmp.groups()[0].strip()
|
||||
|
||||
|
||||
def getSocketFile():
|
||||
file = getConf()
|
||||
content = mw.readFile(file)
|
||||
rep = 'socket\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
return tmp.groups()[0].strip()
|
||||
|
||||
|
||||
def getInitdTpl(version=''):
|
||||
path = getPluginDir() + '/init.d/mysql' + version + '.tpl'
|
||||
if not os.path.exists(path):
|
||||
@@ -143,11 +134,10 @@ def pSqliteDb(dbname='databases'):
|
||||
|
||||
|
||||
def pMysqlDb():
|
||||
db = mysqlDb.mysqlDb()
|
||||
db.__DB_CNF = getConf()
|
||||
db.setDbConf(getConf())
|
||||
db.setPwd(pSqliteDb('config').where(
|
||||
'id=?', (1,)).getField('mysql_root'))
|
||||
db = mw.getMyORM()
|
||||
db.setPort(getDbPort())
|
||||
db.setSocket(getSocketFile())
|
||||
db.setPwd(pSqliteDb('config').where('id=?', (1,)).getField('mysql_root'))
|
||||
return db
|
||||
|
||||
|
||||
@@ -198,11 +188,6 @@ def initDreplace(version=''):
|
||||
|
||||
|
||||
def status(version=''):
|
||||
data = mw.execShell(
|
||||
"ps -ef|grep mysqld |grep -v grep | grep -v python | awk '{print $2}'")
|
||||
if data[0] == '':
|
||||
return 'stop'
|
||||
|
||||
pid = getPidFile()
|
||||
if not os.path.exists(pid):
|
||||
return 'stop'
|
||||
@@ -322,6 +307,9 @@ def initMysqlData():
|
||||
|
||||
|
||||
def initMysql57Data():
|
||||
'''
|
||||
cd /www/server/mysql && /www/server/mysql/bin/mysqld --defaults-file=/www/server/mysql/etc/my.cnf --initialize-insecure --explicit_defaults_for_timestamp
|
||||
'''
|
||||
datadir = getDataDir()
|
||||
if not os.path.exists(datadir + '/mysql'):
|
||||
serverdir = getServerDir()
|
||||
@@ -329,8 +317,8 @@ def initMysql57Data():
|
||||
user = pGetDbUser()
|
||||
cmd = 'cd ' + serverdir + ' && ./bin/mysqld --defaults-file=' + myconf + \
|
||||
' --initialize-insecure --explicit_defaults_for_timestamp'
|
||||
# print(mw.execShell(cmd))
|
||||
|
||||
data = mw.execShell(cmd)
|
||||
# print(data)
|
||||
return False
|
||||
return True
|
||||
|
||||
@@ -347,7 +335,8 @@ def initMysql8Data():
|
||||
datadir + ' --initialize-insecure'
|
||||
|
||||
# print(cmd)
|
||||
mw.execShell(cmd)
|
||||
data = mw.execShell(cmd)
|
||||
# print(data)
|
||||
return False
|
||||
return True
|
||||
|
||||
@@ -356,10 +345,21 @@ def initMysqlPwd():
|
||||
time.sleep(5)
|
||||
|
||||
serverdir = getServerDir()
|
||||
|
||||
pwd = mw.getRandomString(16)
|
||||
cmd_pass = serverdir + '/bin/mysqladmin -uroot password ' + pwd
|
||||
mw.execShell(cmd_pass)
|
||||
# cmd_pass = serverdir + '/bin/mysqladmin -uroot password ' + pwd
|
||||
|
||||
# cmd_pass = "insert into mysql.user(Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv,Reload_priv,Shutdown_priv,Process_priv,File_priv,Grant_priv,References_priv,Index_priv,Alter_priv,Show_db_priv,Super_priv,Create_tmp_table_priv,Lock_tables_priv,Execute_priv,Repl_slave_priv,Repl_client_priv,Create_view_priv,Show_view_priv,Create_routine_priv,Alter_routine_priv,Create_user_priv,Event_priv,Trigger_priv,Create_tablespace_priv,User,Password,host)values('Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','root',password('" + pwd + "'),'127.0.0.1')"
|
||||
# cmd_pass = cmd_pass + \
|
||||
# "insert into mysql.user(Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv,Reload_priv,Shutdown_priv,Process_priv,File_priv,Grant_priv,References_priv,Index_priv,Alter_priv,Show_db_priv,Super_priv,Create_tmp_table_priv,Lock_tables_priv,Execute_priv,Repl_slave_priv,Repl_client_priv,Create_view_priv,Show_view_priv,Create_routine_priv,Alter_routine_priv,Create_user_priv,Event_priv,Trigger_priv,Create_tablespace_priv,User,Password,host)values('Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','root',password('" + pwd + "'),'localhost')"
|
||||
# cmd_pass = cmd_pass + \
|
||||
# "UPDATE mysql.user SET password=PASSWORD('" + \
|
||||
# pwd + "') WHERE user='root'"
|
||||
cmd_pass = serverdir + '/bin/mysql -uroot -e'
|
||||
cmd_pass = cmd_pass + "\"UPDATE mysql.user SET password=PASSWORD('" + \
|
||||
pwd + "') WHERE user='root';"
|
||||
cmd_pass = cmd_pass + "flush privileges;\""
|
||||
data = mw.execShell(cmd_pass)
|
||||
# print(data)
|
||||
pSqliteDb('config').where('id=?', (1,)).save('mysql_root', (pwd,))
|
||||
return True
|
||||
|
||||
@@ -371,6 +371,10 @@ def initMysql8Pwd():
|
||||
pwd = mw.getRandomString(16)
|
||||
|
||||
alter_root_pwd = 'flush privileges;'
|
||||
|
||||
alter_root_pwd = alter_root_pwd + \
|
||||
"UPDATE mysql.user SET authentication_string='' WHERE user='root';"
|
||||
alter_root_pwd = alter_root_pwd + "flush privileges;"
|
||||
alter_root_pwd = alter_root_pwd + \
|
||||
"alter user 'root'@'localhost' IDENTIFIED by '" + pwd + "';"
|
||||
alter_root_pwd = alter_root_pwd + \
|
||||
|
||||
@@ -26,10 +26,11 @@ fi
|
||||
|
||||
if [ "${action}" == "uninstall" ];then
|
||||
|
||||
if [ -f /usr/lib/systemd/system/mysql.service ];then
|
||||
if [ -f /usr/lib/systemd/system/mysql.service ] || [ -f /lib/systemd/system/mysql.service ];then
|
||||
systemctl stop mysql
|
||||
systemctl disable mysql
|
||||
rm -rf /usr/lib/systemd/system/mysql.service
|
||||
rm -rf /lib/systemd/system/mysql.service
|
||||
systemctl daemon-reload
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -835,7 +835,7 @@ function openPhpmyadmin(name,username,password){
|
||||
//检查版本
|
||||
data = syncPost('/plugins/run',{'name':'phpmyadmin','func':'version'});
|
||||
bigVer = data.data.split('.')[0]
|
||||
if (bigVer>=5){
|
||||
if (bigVer>=4.5){
|
||||
|
||||
setTimeout(function(){
|
||||
$("#toPHPMyAdmin").submit();
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
#!/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")
|
||||
|
||||
# echo $rootPath
|
||||
|
||||
SERVER_ROOT=$rootPath/lib
|
||||
SOURCE_ROOT=$rootPath/source/lib
|
||||
|
||||
which rpcgen
|
||||
if [ "$?" != "0" ];then
|
||||
|
||||
if [ ! -f ${SOURCE_ROOT}/rpcsvc-proto-1.4.tar.gz ];then
|
||||
wget -O ${SOURCE_ROOT}/rpcsvc-proto-1.4.tar.gz https://github.com/thkukuk/rpcsvc-proto/releases/download/v1.4/rpcsvc-proto-1.4.tar.gz
|
||||
fi
|
||||
|
||||
if [ ! -d ${SERVER_ROOT}/rpcsvc-proto-1.4 ];then
|
||||
cd ${SOURCE_ROOT} && tar -zxvf rpcsvc-proto-1.4.tar.gz
|
||||
cd ${SOURCE_ROOT}/rpcsvc-proto-1.4
|
||||
./configure && make && make install
|
||||
fi
|
||||
|
||||
fi
|
||||
@@ -66,6 +66,7 @@ Install_mysql()
|
||||
else
|
||||
rm -rf ${mysqlDir}/mysql-5.5.62
|
||||
echo '安装失败' > $install_tmp
|
||||
echo 'install fail'>&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -82,6 +82,7 @@ Install_mysql()
|
||||
else
|
||||
rm -rf ${mysqlDir}/mysql-5.6.50
|
||||
echo '安装失败' > $install_tmp
|
||||
echo 'install fail'>&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -38,6 +38,7 @@ Install_mysql()
|
||||
touch /var/log/mariadb/mariadb.log
|
||||
fi
|
||||
|
||||
cd $serverPath/mdserver-web/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
|
||||
@@ -95,8 +96,9 @@ Install_mysql()
|
||||
echo '5.7' > $serverPath/mysql/version.pl
|
||||
echo '安装完成' > $install_tmp
|
||||
else
|
||||
rm -rf ${mysqlDir}/mysql-${VERSION}
|
||||
# rm -rf ${mysqlDir}/mysql-${VERSION}
|
||||
echo '安装失败' > $install_tmp
|
||||
echo 'install fail'>&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -75,6 +75,8 @@ Install_mysql()
|
||||
useradd -g mysql mysql
|
||||
fi
|
||||
|
||||
cd $serverPath/mdserver-web/plugins/mysql/lib && /bin/bash rpcgen.sh
|
||||
|
||||
INSTALL_CMD=cmake
|
||||
# check cmake version
|
||||
CMAKE_VERSION=`cmake -version | grep version | awk '{print $3}' | awk -F '.' '{print $1}'`
|
||||
@@ -154,8 +156,9 @@ Install_mysql()
|
||||
echo '8.0' > $serverPath/mysql/version.pl
|
||||
echo '安装完成' > $install_tmp
|
||||
else
|
||||
rm -rf ${mysqlDir}/mysql-${VERSION}
|
||||
# rm -rf ${mysqlDir}/mysql-${VERSION}
|
||||
echo '安装失败' > $install_tmp
|
||||
echo 'install fail'>&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
+10
-14
@@ -186,7 +186,7 @@ def status():
|
||||
|
||||
def contentReplace(content):
|
||||
service_path = mw.getServerDir()
|
||||
waf_path = mw.getServerDir() + "/openresty/nginx/conf/waf"
|
||||
waf_path = getServerDir() + "/waf"
|
||||
content = content.replace('{$ROOT_PATH}', mw.getRootDir())
|
||||
content = content.replace('{$SERVER_PATH}', service_path)
|
||||
content = content.replace('{$WAF_PATH}', waf_path)
|
||||
@@ -195,20 +195,21 @@ def contentReplace(content):
|
||||
|
||||
def initDreplace():
|
||||
|
||||
path = mw.getServerDir() + "/openresty/nginx/conf"
|
||||
path = getServerDir()
|
||||
if not os.path.exists(path + '/waf'):
|
||||
sdir = getPluginDir() + '/waf'
|
||||
cmd = 'cp -rf ' + sdir + ' ' + path
|
||||
mw.execShell(cmd)
|
||||
|
||||
config = mw.getServerDir() + '/openresty/nginx/conf/waf/config.json'
|
||||
config = path + '/waf/config.json'
|
||||
content = mw.readFile(config)
|
||||
content = json.loads(content)
|
||||
content['reqfile_path'] = mw.getServerDir(
|
||||
) + "/openresty/nginx/conf/waf/html"
|
||||
|
||||
wfDir = path + "/waf/html"
|
||||
content['reqfile_path'] = wfDir
|
||||
mw.writeFile(config, mw.getJson(content))
|
||||
|
||||
config = mw.getServerDir() + "/openresty/nginx/conf/waf/lua/init.lua"
|
||||
config = path + "/waf/lua/init.lua"
|
||||
content = mw.readFile(config)
|
||||
content = contentReplace(content)
|
||||
mw.writeFile(config, content)
|
||||
@@ -230,18 +231,13 @@ def start():
|
||||
path = getConf()
|
||||
conf = mw.readFile(path)
|
||||
conf = conf.replace('#include luawaf.conf;', "include luawaf.conf;")
|
||||
|
||||
mw.writeFile(path, conf)
|
||||
|
||||
mw.restartWeb()
|
||||
return 'ok'
|
||||
|
||||
|
||||
def stop():
|
||||
path = mw.getServerDir() + "/openresty/nginx/conf/waf"
|
||||
if os.path.exists(path):
|
||||
cmd = 'rm -rf ' + path
|
||||
mw.execShell(cmd)
|
||||
|
||||
path = getConf()
|
||||
conf = mw.readFile(path)
|
||||
conf = conf.replace('include luawaf.conf;', "#include luawaf.conf;")
|
||||
@@ -265,12 +261,12 @@ def reload():
|
||||
|
||||
|
||||
def getJsonPath(name):
|
||||
path = mw.getServerDir() + "/openresty/nginx/conf/waf/" + name + ".json"
|
||||
path = getServerDir() + "/waf/" + name + ".json"
|
||||
return path
|
||||
|
||||
|
||||
def getRuleJsonPath(name):
|
||||
path = mw.getServerDir() + "/openresty/nginx/conf/waf/rule/" + name + ".json"
|
||||
path = getServerDir() + "/waf/rule/" + name + ".json"
|
||||
return path
|
||||
|
||||
|
||||
|
||||
@@ -16,9 +16,6 @@ Install_of(){
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
mkdir -p $serverPath/op_waf
|
||||
|
||||
if [ -f $serverPath/openresty ];then
|
||||
mkdir -p $serverPath/openresty/nginx/conf/waf
|
||||
fi
|
||||
echo '0.1' > $serverPath/op_waf/version.pl
|
||||
echo 'install ok' > $install_tmp
|
||||
}
|
||||
|
||||
@@ -32,6 +32,26 @@ if [ ! -d $curPath/versions/$2 ];then
|
||||
fi
|
||||
|
||||
|
||||
|
||||
#获取信息和版本
|
||||
# bash /www/server/mdsever-web/scripts/getos.sh
|
||||
bash ${rootPath}/scripts/getos.sh
|
||||
OSNAME=`cat ${rootPath}/data/osname.pl`
|
||||
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
|
||||
|
||||
|
||||
if [ "$OSNAME" == "centos" ];then
|
||||
rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-${VERSION_ID}.rpm
|
||||
fi
|
||||
|
||||
|
||||
# rpm -Uvh http://rpms.remirepo.net/fedora/remi-release-31.rpm
|
||||
if [ "$OSNAME" == "fedora" ];then
|
||||
rpm -Uvh http://rpms.remirepo.net/fedora/remi-release-${VERSION_ID}.rpm
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if [ "${action}" == "uninstall" ] && [ -d ${serverPath}/php-yum/${type} ];then
|
||||
#初始化
|
||||
cd ${rootPath} && python3 ${rootPath}/plugins/php-yum/index.py stop ${type}
|
||||
|
||||
@@ -10,13 +10,6 @@ sourcePath=${serverPath}/source
|
||||
sysName=`uname`
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
|
||||
|
||||
#获取信息和版本
|
||||
# bash /www/server/mdsever-web/scripts/getos.sh
|
||||
bash ${rootPath}/scripts/getos.sh
|
||||
OSNAME=`cat ${rootPath}/data/osname.pl`
|
||||
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
|
||||
|
||||
version=7.4.x
|
||||
PHP_VER=74
|
||||
|
||||
@@ -25,11 +18,7 @@ Install_php()
|
||||
{
|
||||
#------------------------ install start ------------------------------------#
|
||||
|
||||
### centos start ################
|
||||
rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-${VERSION_ID}.rpm
|
||||
yum install -y php74 php74-php-fpm
|
||||
### centos start ################
|
||||
|
||||
yum install -y php74 php74-php-fpm
|
||||
if [ "$?" == "0" ];then
|
||||
mkdir -p $serverPath/php-yum/${PHP_VER}
|
||||
fi
|
||||
|
||||
@@ -11,12 +11,6 @@ sysName=`uname`
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
|
||||
|
||||
#获取信息和版本
|
||||
# bash /www/server/mdsever-web/scripts/getos.sh
|
||||
bash ${rootPath}/scripts/getos.sh
|
||||
OSNAME=`cat ${rootPath}/data/osname.pl`
|
||||
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
|
||||
|
||||
version=8.0.x
|
||||
PHP_VER=80
|
||||
|
||||
@@ -25,11 +19,8 @@ Install_php()
|
||||
{
|
||||
#------------------------ install start ------------------------------------#
|
||||
|
||||
### centos start ################
|
||||
rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-${VERSION_ID}.rpm
|
||||
yum install -y php80 php80-php-fpm
|
||||
### centos start ################
|
||||
|
||||
yum install -y php80 php80-php-fpm
|
||||
if [ "$?" == "0" ];then
|
||||
mkdir -p $serverPath/php-yum/${PHP_VER}
|
||||
fi
|
||||
|
||||
@@ -11,12 +11,6 @@ sysName=`uname`
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
|
||||
|
||||
#获取信息和版本
|
||||
# bash /www/server/mdsever-web/scripts/getos.sh
|
||||
bash ${rootPath}/scripts/getos.sh
|
||||
OSNAME=`cat ${rootPath}/data/osname.pl`
|
||||
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
|
||||
|
||||
version=8.1.x
|
||||
PHP_VER=81
|
||||
|
||||
@@ -24,12 +18,7 @@ PHP_VER=81
|
||||
Install_php()
|
||||
{
|
||||
#------------------------ install start ------------------------------------#
|
||||
|
||||
### centos start ################
|
||||
rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-${VERSION_ID}.rpm
|
||||
yum install -y php81 php81-php-fpm
|
||||
### centos start ################
|
||||
|
||||
yum install -y php81 php81-php-fpm
|
||||
if [ "$?" == "0" ];then
|
||||
mkdir -p $serverPath/php-yum/${PHP_VER}
|
||||
fi
|
||||
|
||||
@@ -11,12 +11,6 @@ sysName=`uname`
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
|
||||
|
||||
#获取信息和版本
|
||||
# bash /www/server/mdsever-web/scripts/getos.sh
|
||||
bash ${rootPath}/scripts/getos.sh
|
||||
OSNAME=`cat ${rootPath}/data/osname.pl`
|
||||
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
|
||||
|
||||
version=8.2.x
|
||||
PHP_VER=82
|
||||
|
||||
@@ -24,12 +18,7 @@ PHP_VER=82
|
||||
Install_php()
|
||||
{
|
||||
#------------------------ install start ------------------------------------#
|
||||
|
||||
### centos start ################
|
||||
rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-${VERSION_ID}.rpm
|
||||
yum install -y php82 php82-php-fpm
|
||||
### centos start ################
|
||||
|
||||
if [ "$?" == "0" ];then
|
||||
mkdir -p $serverPath/php-yum/${PHP_VER}
|
||||
fi
|
||||
@@ -39,7 +28,7 @@ fi
|
||||
|
||||
Uninstall_php()
|
||||
{
|
||||
# $serverPath/php-ya/init.d/php${PHP_VER} stop
|
||||
# $serverPath/php-yum/init.d/php${PHP_VER} stop
|
||||
rm -rf $serverPath/php-yum/${PHP_VER}
|
||||
echo "卸载php-${version}..." > $install_tmp
|
||||
}
|
||||
|
||||
+32
-4
@@ -78,7 +78,7 @@ def getFpmConfFile(version):
|
||||
return getServerDir() + '/' + version + '/etc/php-fpm.d/www.conf'
|
||||
|
||||
|
||||
def status(version):
|
||||
def status_progress(version):
|
||||
# ps -ef|grep 'php/81' |grep -v grep | grep -v python | awk '{print $2}
|
||||
cmd = "ps -ef|grep 'php/" + version + \
|
||||
"' |grep -v grep | grep -v python | awk '{print $2}'"
|
||||
@@ -88,6 +88,27 @@ def status(version):
|
||||
return 'start'
|
||||
|
||||
|
||||
def getPhpSocket(version):
|
||||
path = getFpmConfFile(version)
|
||||
content = mw.readFile(path)
|
||||
rep = 'listen\s*=\s*(.*)'
|
||||
tmp = re.search(rep, content)
|
||||
return tmp.groups()[0].strip()
|
||||
|
||||
|
||||
def status(version):
|
||||
'''
|
||||
sock文件判断是否启动
|
||||
'''
|
||||
sock = getPhpSocket(version)
|
||||
if sock.find(':'):
|
||||
return status_progress(version)
|
||||
|
||||
if not os.path.exists(sock):
|
||||
return 'stop'
|
||||
return 'start'
|
||||
|
||||
|
||||
def contentReplace(content, version):
|
||||
service_path = mw.getServerDir()
|
||||
content = content.replace('{$ROOT_PATH}', mw.getRootDir())
|
||||
@@ -705,7 +726,7 @@ def installLib(version):
|
||||
|
||||
name = args['name']
|
||||
execstr = "cd " + getPluginDir() + "/versions && /bin/bash common.sh " + \
|
||||
version + ' install ' + ' ' + name
|
||||
version + ' install ' + name
|
||||
|
||||
rettime = time.strftime('%Y-%m-%d %H:%M:%S')
|
||||
insert_info = (None, '安装[' + name + '-' + version + ']',
|
||||
@@ -724,7 +745,7 @@ def uninstallLib(version):
|
||||
|
||||
name = args['name']
|
||||
execstr = "cd " + getPluginDir() + "/versions && /bin/bash common.sh " + \
|
||||
version + ' uninstall ' + ' ' + name
|
||||
version + ' uninstall ' + name
|
||||
|
||||
data = mw.execShell(execstr)
|
||||
# data[0] == '' and
|
||||
@@ -759,8 +780,15 @@ def installPreInspection(version):
|
||||
if sysName == 'ubuntu':
|
||||
return 'ubuntu已经安装不了'
|
||||
|
||||
if sysName == 'debian' and sys_id > 10:
|
||||
if sysName == 'debian' and sysId > 10:
|
||||
return 'debian10可以安装'
|
||||
|
||||
if sysName == 'fedora':
|
||||
sys_id = mw.execShell(
|
||||
"cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}'")
|
||||
sysId = sys_id[0].strip()
|
||||
if int(sysId) > 31:
|
||||
return 'fedora[{}]不可安装'.format(sysId)
|
||||
return 'ok'
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
"name": "php",
|
||||
"title": "PHP",
|
||||
"coexist": true,
|
||||
"versions": ["52","53","54","55","56","70","71","72","73","74","80","81"],
|
||||
"updates": ["5.2.17","5.3.29","5.4.45","5.6.36","7.0.30","7.1.33","7.2.32","7.3.20","7.4.8","8.0.13","8.1.0"],
|
||||
"versions": ["52","53","54","55","56","70","71","72","73","74","80","81","82"],
|
||||
"updates": ["5.2.17","5.3.29","5.4.45","5.6.36","7.0.30","7.1.33","7.2.32","7.3.20","7.4.30","8.0.30","8.1.8","8.2.0"],
|
||||
"tip": "soft",
|
||||
"install_pre_inspection":true,
|
||||
"checks": "server/php/VERSION/bin/php",
|
||||
|
||||
@@ -15,14 +15,27 @@ rootPath=$(dirname "$rootPath")
|
||||
SERVER_ROOT=$rootPath/lib
|
||||
SOURCE_ROOT=$rootPath/source/lib
|
||||
|
||||
#----------------------------- libmemcached start -------------------------#
|
||||
# if [ ! -d ${SERVER_ROOT}/libmemcached ];then
|
||||
# cd ${SOURCE_ROOT}
|
||||
# if [ ! -f ${SOURCE_ROOT}/libmemcached-1.0.4.tar.gz ];then
|
||||
# wget -O libmemcached-1.0.4.tar.gz https://launchpad.net/libmemcached/1.0/1.0.4/+download/libmemcached-1.0.4.tar.gz -T 20
|
||||
# fi
|
||||
# tar -zxf libmemcached-1.0.4.tar.gz
|
||||
# cd libmemcached-1.0.4
|
||||
# ./configure --prefix=${SERVER_ROOT}/libmemcached -with-memcached && make && make install
|
||||
# fi
|
||||
#----------------------------- libmemcached end -------------------------#
|
||||
|
||||
|
||||
#----------------------------- libmemcached start -------------------------#
|
||||
if [ ! -d ${SERVER_ROOT}/libmemcached ];then
|
||||
cd ${SOURCE_ROOT}
|
||||
if [ ! -f ${SOURCE_ROOT}/libmemcached-1.0.4.tar.gz ];then
|
||||
wget -O libmemcached-1.0.4.tar.gz https://launchpad.net/libmemcached/1.0/1.0.4/+download/libmemcached-1.0.4.tar.gz -T 20
|
||||
if [ ! -f ${SOURCE_ROOT}/libmemcached-1.0.18.tar.gz ];then
|
||||
wget -O libmemcached-1.0.18.tar.gz https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz -T 20
|
||||
fi
|
||||
tar -zxf libmemcached-1.0.4.tar.gz
|
||||
cd libmemcached-1.0.4
|
||||
tar -zxf libmemcached-1.0.18.tar.gz
|
||||
cd libmemcached-1.0.18
|
||||
./configure --prefix=${SERVER_ROOT}/libmemcached -with-memcached && make && make install
|
||||
fi
|
||||
#----------------------------- libmemcached end -------------------------#
|
||||
@@ -0,0 +1,25 @@
|
||||
#!/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")
|
||||
|
||||
# echo $rootPath
|
||||
|
||||
SERVER_ROOT=$rootPath/lib
|
||||
SOURCE_ROOT=$rootPath/source/lib
|
||||
|
||||
which onig-config
|
||||
if [ "$?" != "0" ];then
|
||||
cd ${SOURCE_ROOT}
|
||||
if [ ! -f ${SOURCE_ROOT}/oniguruma-6.9.4.tar.gz ];then
|
||||
wget -O ${SOURCE_ROOT}/oniguruma-6.9.4.tar.gz https://github.com/kkos/oniguruma/archive/v6.9.4.tar.gz
|
||||
fi
|
||||
cd ${SOURCE_ROOT} && tar -zxvf oniguruma-6.9.4.tar.gz
|
||||
cd ${SOURCE_ROOT}/oniguruma-6.9.4 && ./autogen.sh && ./configure --prefix=/usr && make && make install
|
||||
fi
|
||||
|
||||
@@ -57,10 +57,17 @@ Install_lib()
|
||||
fi
|
||||
|
||||
|
||||
if [ "$OSNAME" == "debian" ] && [ "$OSNAME" == "ubuntu" ];then
|
||||
# cp -frp /usr/lib64/libldap* /usr/lib/
|
||||
|
||||
# ln -s /usr/lib64/libjpeg.so /usr/lib/libjpeg.so
|
||||
# ln -s /usr/lib64/libpng.so /usr/lib/libpng.so
|
||||
|
||||
if [ ! -f /usr/lib/libjpeg.so ];then
|
||||
ln -s /usr/lib64/libjpeg.so /usr/lib/libjpeg.so
|
||||
ln -s /usr/lib64/libpng.so /usr/lib/
|
||||
cp -frp /usr/lib64/libldap* /usr/lib/
|
||||
fi
|
||||
|
||||
if [ ! -f /usr/lib/libpng.so ];then
|
||||
ln -s /usr/lib64/libpng.so /usr/lib/libpng.so
|
||||
fi
|
||||
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ echo "安装php-5.3.29 ..." > $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 libiconv.sh
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash zlib.sh
|
||||
|
||||
@@ -39,6 +38,9 @@ if [ -f $serverPath/php/53/bin/php ];then
|
||||
return
|
||||
fi
|
||||
|
||||
# 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"
|
||||
OPTIONS=''
|
||||
if [ $sysName == 'Darwin' ]; then
|
||||
OPTIONS='--without-iconv'
|
||||
@@ -46,9 +48,6 @@ if [ $sysName == 'Darwin' ]; then
|
||||
OPTIONS="${OPTIONS} --with-curl=${serverPath}/lib/curl"
|
||||
else
|
||||
OPTIONS="--with-iconv=${serverPath}/lib/libiconv"
|
||||
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"
|
||||
OPTIONS="${OPTIONS} --with-curl"
|
||||
fi
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ 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 libiconv.sh
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash zlib.sh
|
||||
|
||||
@@ -40,9 +40,6 @@ if [ $sysName == 'Darwin' ]; then
|
||||
OPTIONS="${OPTIONS} --with-curl=${serverPath}/lib/curl"
|
||||
else
|
||||
OPTIONS="--with-iconv=${serverPath}/lib/libiconv"
|
||||
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"
|
||||
OPTIONS="${OPTIONS} --with-curl"
|
||||
fi
|
||||
|
||||
|
||||
@@ -39,9 +39,6 @@ if [ $sysName == 'Darwin' ]; then
|
||||
OPTIONS="${OPTIONS} --with-curl=${serverPath}/lib/curl"
|
||||
else
|
||||
OPTIONS="--with-iconv=${serverPath}/lib/libiconv"
|
||||
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"
|
||||
OPTIONS="${OPTIONS} --with-curl"
|
||||
fi
|
||||
|
||||
|
||||
@@ -39,9 +39,6 @@ if [ $sysName == 'Darwin' ]; then
|
||||
OPTIONS="${OPTIONS} --with-curl=${serverPath}/lib/curl"
|
||||
else
|
||||
OPTIONS="--with-iconv=${serverPath}/lib/libiconv"
|
||||
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"
|
||||
OPTIONS="${OPTIONS} --with-curl"
|
||||
fi
|
||||
|
||||
|
||||
@@ -39,9 +39,6 @@ if [ $sysName == 'Darwin' ]; then
|
||||
OPTIONS="${OPTIONS} --with-curl=${serverPath}/lib/curl"
|
||||
else
|
||||
OPTIONS="--with-iconv=${serverPath}/lib/libiconv"
|
||||
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"
|
||||
OPTIONS="${OPTIONS} --with-curl"
|
||||
fi
|
||||
|
||||
|
||||
@@ -38,9 +38,6 @@ if [ $sysName == 'Darwin' ]; then
|
||||
OPTIONS="${OPTIONS} --with-curl=${serverPath}/lib/curl"
|
||||
else
|
||||
OPTIONS="--with-iconv=${serverPath}/lib/libiconv"
|
||||
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"
|
||||
OPTIONS="${OPTIONS} --with-curl"
|
||||
fi
|
||||
|
||||
|
||||
@@ -39,9 +39,6 @@ if [ $sysName == 'Darwin' ]; then
|
||||
OPTIONS="${OPTIONS} --with-curl=${serverPath}/lib/curl"
|
||||
else
|
||||
OPTIONS="--with-iconv=${serverPath}/lib/libiconv"
|
||||
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"
|
||||
OPTIONS="${OPTIONS} --with-curl"
|
||||
fi
|
||||
|
||||
|
||||
@@ -43,9 +43,6 @@ if [ $sysName == 'Darwin' ]; then
|
||||
# OPTIONS="${OPTIONS} --enable-zip"
|
||||
else
|
||||
OPTIONS="--with-iconv=${serverPath}/lib/libiconv"
|
||||
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"
|
||||
OPTIONS="${OPTIONS} --with-curl"
|
||||
OPTIONS="${OPTIONS} --with-libzip=${serverPath}/lib/libzip"
|
||||
fi
|
||||
|
||||
@@ -11,7 +11,7 @@ sysName=`uname`
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
|
||||
|
||||
version=7.4.26
|
||||
version=7.4.30
|
||||
PHP_VER=74
|
||||
Install_php()
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@ sysName=`uname`
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
|
||||
|
||||
version=8.0.20
|
||||
version=8.0.21
|
||||
PHP_VER=80
|
||||
Install_php()
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@ sysName=`uname`
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
|
||||
|
||||
version=8.1.7
|
||||
version=8.1.8
|
||||
PHP_VER=81
|
||||
Install_php()
|
||||
{
|
||||
|
||||
Executable
+97
@@ -0,0 +1,97 @@
|
||||
#!/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")
|
||||
sourcePath=${serverPath}/source
|
||||
sysName=`uname`
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
|
||||
|
||||
version=8.2.0alpha2
|
||||
PHP_VER=82
|
||||
Install_php()
|
||||
{
|
||||
#------------------------ install start ------------------------------------#
|
||||
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 libiconv.sh
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash zlib.sh
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash libzip.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
|
||||
fi
|
||||
|
||||
cd $sourcePath/php && tar -Jxf $sourcePath/php/php-${version}.tar.xz
|
||||
mv $sourcePath/php/php-${version} $sourcePath/php/php${PHP_VER}
|
||||
fi
|
||||
|
||||
cd $sourcePath/php/php${PHP_VER}
|
||||
|
||||
OPTIONS=''
|
||||
if [ $sysName == 'Darwin' ]; then
|
||||
OPTIONS='--without-iconv'
|
||||
OPTIONS="${OPTIONS} --with-curl=${serverPath}/lib/curl"
|
||||
# OPTIONS="${OPTIONS} --enable-zip"
|
||||
else
|
||||
OPTIONS="--with-iconv=${serverPath}/lib/libiconv"
|
||||
OPTIONS="${OPTIONS} --with-freetype-dir=${serverPath}/lib/freetype"
|
||||
OPTIONS="${OPTIONS} --with-curl"
|
||||
OPTIONS="${OPTIONS} --with-libzip=${serverPath}/lib/libzip"
|
||||
fi
|
||||
|
||||
|
||||
echo "$sourcePath/php/php${PHP_VER}"
|
||||
|
||||
if [ ! -d $serverPath/php/${PHP_VER} ];then
|
||||
cd $sourcePath/php/php${PHP_VER}
|
||||
./buildconf --force
|
||||
./configure \
|
||||
--prefix=$serverPath/php/${PHP_VER} \
|
||||
--exec-prefix=$serverPath/php/${PHP_VER} \
|
||||
--with-config-file-path=$serverPath/php/${PHP_VER}/etc \
|
||||
--enable-mysqlnd \
|
||||
--with-mysqli=mysqlnd \
|
||||
--with-pdo-mysql=mysqlnd \
|
||||
--enable-mbstring \
|
||||
--with-zlib-dir=$serverPath/lib/zlib \
|
||||
--enable-ftp \
|
||||
--enable-sockets \
|
||||
--enable-simplexml \
|
||||
--enable-soap \
|
||||
--enable-posix \
|
||||
--enable-sysvmsg \
|
||||
--enable-sysvsem \
|
||||
--enable-sysvshm \
|
||||
--disable-intl \
|
||||
--disable-fileinfo \
|
||||
$OPTIONS \
|
||||
--enable-fpm
|
||||
make clean && make && make install && make clean
|
||||
fi
|
||||
#------------------------ install end ------------------------------------#
|
||||
}
|
||||
|
||||
Uninstall_php()
|
||||
{
|
||||
$serverPath/php/init.d/php${PHP_VER} stop
|
||||
rm -rf $serverPath/php/${PHP_VER}
|
||||
echo "卸载php-${version}..." > $install_tmp
|
||||
}
|
||||
|
||||
action=${1}
|
||||
if [ "${1}" == 'install' ];then
|
||||
Install_php
|
||||
else
|
||||
Uninstall_php
|
||||
fi
|
||||
@@ -6,13 +6,7 @@ ROOT_DIR=$(cd "$(dirname "$0")"; pwd)
|
||||
# cd /www/server/mdserver-web/scripts/quick && bash debug.sh
|
||||
# cd /www/server/mdserver-web/plugins/php/versions && /bin/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
|
||||
# cd /www/server/mdserver-web/plugins/php/versions/common && bash swoole.sh install 81
|
||||
|
||||
|
||||
# PHP_VER=52
|
||||
@@ -30,7 +24,7 @@ ROOT_DIR=$(cd "$(dirname "$0")"; pwd)
|
||||
# echo "php${PHP_VER} -- end"
|
||||
|
||||
|
||||
PHP_VER_LIST=(53 54 55 56 70 71 72 73 74 80 81)
|
||||
PHP_VER_LIST=(53 54 55 56 70 71 72 73 74 80 81 82)
|
||||
# PHP_VER_LIST=(81)
|
||||
for PHP_VER in ${PHP_VER_LIST[@]}; do
|
||||
echo "php${PHP_VER} -- start"
|
||||
@@ -41,7 +35,7 @@ for PHP_VER in ${PHP_VER_LIST[@]}; do
|
||||
done
|
||||
|
||||
cd $DIR
|
||||
PHP_VER_LIST=(53 54 55 56 70 71 72 73 74 80 81)
|
||||
PHP_VER_LIST=(53 54 55 56 70 71 72 73 74 80 81 82)
|
||||
PHP_EXT_LIST=(ioncube ZendGuardLoader pdo mysqlnd sqlite3 openssl pcntl opcache mcrypt fileinfo \
|
||||
exif gd intl memcache memcached redis imagemagick xdebug xhprof \
|
||||
swoole yaf yar yac apc mongo mongodb solr seaslog mbstring zip)
|
||||
@@ -49,6 +43,11 @@ PHP_EXT_LIST=(ioncube ZendGuardLoader pdo mysqlnd sqlite3 openssl pcntl opcache
|
||||
for PHP_VER in ${PHP_VER_LIST[@]}; do
|
||||
echo "php${PHP_VER} -- start"
|
||||
|
||||
if [ ! -d /www/server/php/${PHP_VER} ];then
|
||||
echo "php${PHP_VER} is not install!"
|
||||
break;
|
||||
fi
|
||||
|
||||
NON_ZTS_FILENAME=`ls /www/server/php/${PHP_VER}/lib/php/extensions | grep no-debug-non-zts`
|
||||
for EXT in ${PHP_EXT_LIST[@]}; do
|
||||
extFile=/www/server/php/${PHP_VER}/lib/php/extensions/${NON_ZTS_FILENAME}/${EXT}.so
|
||||
|
||||
@@ -36,9 +36,9 @@ fi
|
||||
|
||||
if [ "$action" == 'uninstall' ];then
|
||||
if [ -f $FILE ];then
|
||||
cd ${curPath}/${version} && bash ${extName}.sh install ${version}
|
||||
cd ${curPath}/${version} && bash ${extName}.sh uninstall ${version}
|
||||
elif [ -f $FILE_COMMON ];then
|
||||
cd ${curPath}/common && bash ${extName}.sh install ${version}
|
||||
cd ${curPath}/common && bash ${extName}.sh uninstall ${version}
|
||||
else
|
||||
echo 'no such extension'
|
||||
fi
|
||||
@@ -46,5 +46,5 @@ fi
|
||||
|
||||
echo "cd ${curPath}/common && bash ${extName}.sh install ${version}"
|
||||
echo "cd ${curPath}/${version} && bash ${extName}.sh install ${version}"
|
||||
echo "cd ${curPath}/common && bash ${extName}.sh uinstall ${version}"
|
||||
echo "cd ${curPath}/${version} && bash ${extName}.sh uinstall ${version}"
|
||||
echo "cd ${curPath}/common && bash ${extName}.sh uninstall ${version}"
|
||||
echo "cd ${curPath}/${version} && bash ${extName}.sh uninstall ${version}"
|
||||
|
||||
@@ -59,8 +59,7 @@ Install_lib()
|
||||
sed -i $BAK 's/CFLAGS \=/CFLAGS \= -std=c99/g' Makefile
|
||||
fi
|
||||
|
||||
|
||||
make && make install && make clean
|
||||
make clean && make && make install && make clean
|
||||
|
||||
fi
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ Install_lib()
|
||||
sed -i $BAK 's/CFLAGS \=/CFLAGS \= -std=c99/g' Makefile
|
||||
fi
|
||||
|
||||
make && make install && make clean
|
||||
make clean && make && make install && make clean
|
||||
|
||||
fi
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@ LIBV=0
|
||||
|
||||
|
||||
if [ "$version" -lt "74" ];then
|
||||
echo "not need!"
|
||||
exit 1
|
||||
bash $curPath/gd_old.sh $1 $2
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
|
||||
Executable
+117
@@ -0,0 +1,117 @@
|
||||
#!/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=gd
|
||||
LIBV=0
|
||||
|
||||
|
||||
# if [ "$version" -lt "74" ];then
|
||||
# echo "not need!"
|
||||
# exit 1
|
||||
# fi
|
||||
|
||||
|
||||
NON_ZTS_FILENAME=`ls $serverPath/php/${version}/lib/php/extensions | grep no-debug-non-zts`
|
||||
extFile=$serverPath/php/${version}/lib/php/extensions/${NON_ZTS_FILENAME}/${LIBNAME}.so
|
||||
|
||||
sysName=`uname`
|
||||
if [ "$sysName" == "Darwin" ];then
|
||||
BAK='_bak'
|
||||
else
|
||||
BAK=''
|
||||
fi
|
||||
|
||||
|
||||
# cd $serverPath/mdserver-web/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"
|
||||
|
||||
|
||||
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 $serverPath/mdserver-web/plugins/php && /bin/bash install.sh install ${version}
|
||||
fi
|
||||
|
||||
cd $sourcePath/php${version}/ext/${LIBNAME}
|
||||
|
||||
$serverPath/php/$version/bin/phpize
|
||||
|
||||
#--with-xpm
|
||||
./configure --with-php-config=$serverPath/php/$version/bin/php-config \
|
||||
--with-gd \
|
||||
--with-jpeg \
|
||||
--with-freetype \
|
||||
--enable-gd-jis-conv \
|
||||
--enable-gd-native-ttf
|
||||
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
|
||||
|
||||
$serverPath/php/init.d/php${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
|
||||
@@ -53,8 +53,8 @@ Install_lib()
|
||||
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
|
||||
./configure --with-php-config=$serverPath/php/$version/bin/php-config
|
||||
make clean && make && make install && make clean
|
||||
|
||||
fi
|
||||
|
||||
|
||||
@@ -53,8 +53,7 @@ Install_lib()
|
||||
|
||||
$serverPath/php/$version/bin/phpize
|
||||
./configure --with-php-config=$serverPath/php/$version/bin/php-config $OPTIONS
|
||||
|
||||
make && make install && make clean
|
||||
make clean && make && make install && make clean
|
||||
|
||||
fi
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ Install_lib()
|
||||
|
||||
php_lib=$sourcePath/php_lib
|
||||
mkdir -p $php_lib
|
||||
if [ ! -f $php_lib/${LIBNAME}-${LIBV} ];then
|
||||
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
|
||||
@@ -54,7 +54,7 @@ Install_lib()
|
||||
|
||||
$serverPath/php/$version/bin/phpize
|
||||
./configure --with-php-config=$serverPath/php/$version/bin/php-config
|
||||
make && make install && make clean
|
||||
make clean && make && make install && make clean
|
||||
|
||||
fi
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ Install_lib()
|
||||
cd ${LIBNAME}-${LIBV}
|
||||
$serverPath/php/$version/bin/phpize
|
||||
./configure --with-php-config=$serverPath/php/$version/bin/php-config --enable-memcache --with-zlib-dir
|
||||
make && make install && make clean
|
||||
make clean && make && make install && make clean
|
||||
|
||||
fi
|
||||
|
||||
|
||||
@@ -21,6 +21,10 @@ if [ "$version" -lt "70" ];then
|
||||
LIBV=2.2.0
|
||||
fi
|
||||
|
||||
if [ "$version" -eq "70" ] || [ "$version" -eq "71" ];then
|
||||
LIBV=3.1.5
|
||||
fi
|
||||
|
||||
|
||||
NON_ZTS_FILENAME=`ls $serverPath/php/${version}/lib/php/extensions | grep no-debug-non-zts`
|
||||
extFile=$serverPath/php/${version}/lib/php/extensions/${NON_ZTS_FILENAME}/${LIBNAME}.so
|
||||
@@ -37,26 +41,24 @@ Install_lib()
|
||||
echo "php-$version 已安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
php_lib=$sourcePath/php_lib
|
||||
mkdir -p $php_lib
|
||||
|
||||
rm -rf $php_lib/${LIBNAME}-${LIBV}
|
||||
|
||||
if [ ! -d $php_lib/${LIBNAME}-${LIBV} ];then
|
||||
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}
|
||||
|
||||
sed -i '_bak' "3237,3238s#ulong#zend_ulong#g" $php_lib/${LIBNAME}-${LIBV}/php_memcached.c
|
||||
# sed -i '_bak' "3237,3238s#ulong#zend_ulong#g" $php_lib/${LIBNAME}-${LIBV}/php_memcached.c
|
||||
$serverPath/php/$version/bin/phpize
|
||||
|
||||
./configure --with-php-config=$serverPath/php/$version/bin/php-config \
|
||||
--enable-memcached \
|
||||
--disable-memcached-sasl && \
|
||||
--disable-memcached-sasl
|
||||
make clean && make && make install && make clean
|
||||
fi
|
||||
|
||||
|
||||
@@ -58,8 +58,7 @@ Install_lib()
|
||||
|
||||
$serverPath/php/$version/bin/phpize
|
||||
./configure --with-php-config=$serverPath/php/$version/bin/php-config $OPTIONS
|
||||
|
||||
make && make install && make clean
|
||||
make clean && make && make install && make clean
|
||||
|
||||
fi
|
||||
|
||||
|
||||
@@ -67,8 +67,8 @@ Install_lib()
|
||||
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
|
||||
./configure --with-php-config=$serverPath/php/$version/bin/php-config
|
||||
make clean && make && make install && make clean
|
||||
|
||||
fi
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ fi
|
||||
|
||||
|
||||
NON_ZTS_FILENAME=`ls $serverPath/php/${version}/lib/php/extensions | grep no-debug-non-zts`
|
||||
extDir=$serverPath/php/${version}/lib/php/extensions/${NON_ZTS_FILENAME}/
|
||||
extFile=$serverPath/php/${version}/lib/php/extensions/${NON_ZTS_FILENAME}/${LIBNAME}.so
|
||||
|
||||
if [ "$sysName" == "Darwin" ];then
|
||||
BAK='_bak'
|
||||
@@ -37,13 +37,13 @@ fi
|
||||
|
||||
Install_lib()
|
||||
{
|
||||
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
|
||||
isInstall=`cat $serverPath/php/${version}/etc/php.ini|grep "${LIBNAME}.so"`
|
||||
if [ "${isInstall}" != "" ];then
|
||||
echo "php-$version 已安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
extFile=$extDir${LIBNAME}.so
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
php_lib=$sourcePath/php_lib
|
||||
@@ -56,7 +56,7 @@ Install_lib()
|
||||
|
||||
$serverPath/php/$version/bin/phpize
|
||||
./configure --with-php-config=$serverPath/php/$version/bin/php-config
|
||||
make && make install && make clean
|
||||
make clean && make && make install && make clean
|
||||
|
||||
fi
|
||||
|
||||
@@ -80,8 +80,7 @@ Uninstall_lib()
|
||||
echo "php-$version 未安装,请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
extFile=$extDir${LIBNAME}.so
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "php-$version 未安装${LIBNAME},请选择其它版本!"
|
||||
echo "php-$version not install memcache, Plese select other version!"
|
||||
|
||||
@@ -24,7 +24,7 @@ if [ "$version" -lt "72" ];then
|
||||
fi
|
||||
|
||||
NON_ZTS_FILENAME=`ls $serverPath/php/${version}/lib/php/extensions | grep no-debug-non-zts`
|
||||
extDir=$serverPath/php/${version}/lib/php/extensions/${NON_ZTS_FILENAME}/
|
||||
extFile=$serverPath/php/${version}/lib/php/extensions/${NON_ZTS_FILENAME}/${_LIBNAME}.so
|
||||
|
||||
if [ "$sysName" == "Darwin" ];then
|
||||
BAK='_bak'
|
||||
@@ -40,7 +40,7 @@ Install_lib()
|
||||
return
|
||||
fi
|
||||
|
||||
extFile=$extDir${_LIBNAME}.so
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
OPTIONS=''
|
||||
@@ -58,7 +58,7 @@ Install_lib()
|
||||
|
||||
$serverPath/php/$version/bin/phpize
|
||||
./configure --with-php-config=$serverPath/php/$version/bin/php-config
|
||||
make && make install && make clean
|
||||
make clean && make && make install && make clean
|
||||
|
||||
fi
|
||||
sleep 1
|
||||
@@ -85,12 +85,12 @@ Uninstall_lib()
|
||||
return
|
||||
fi
|
||||
|
||||
extFile=$extDir${_LIBNAME}.so
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "php-$version 未安装${LIBNAME},请选择其它版本!"
|
||||
echo "php-$version not install ${LIBNAME}, Plese select other version!"
|
||||
return
|
||||
fi
|
||||
|
||||
_LIBNAME=$(echo $LIBNAME | tr '[A-Z]' '[a-z]')
|
||||
sed -i $BAK "/${_LIBNAME}.so/d" $serverPath/php/$version/etc/php.ini
|
||||
sed -i $BAK "/${_LIBNAME}/d" $serverPath/php/$version/etc/php.ini
|
||||
|
||||
@@ -57,7 +57,7 @@ Install_lib()
|
||||
cd $php_lib/${LIBNAME}-${LIBV}
|
||||
$serverPath/php/$version/bin/phpize
|
||||
./configure --with-php-config=$serverPath/php/$version/bin/php-config $OPTIONS
|
||||
make && make install && make clean
|
||||
make clean && make && make install && make clean
|
||||
fi
|
||||
sleep 1
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
@@ -27,6 +27,11 @@ else
|
||||
echo '72+'
|
||||
fi
|
||||
|
||||
if [ "$version" -eq "82" ];then
|
||||
echo "not need"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
NON_ZTS_FILENAME=`ls $serverPath/php/${version}/lib/php/extensions | grep no-debug-non-zts`
|
||||
extFile=$serverPath/php/${version}/lib/php/extensions/${NON_ZTS_FILENAME}/${LIBNAME}.so
|
||||
|
||||
@@ -62,7 +67,7 @@ Install_lib()
|
||||
--enable-openssl \
|
||||
--with-openssl-dir=$serverPath/lib/openssl \
|
||||
--enable-sockets
|
||||
make && make install && make clean
|
||||
make clean && make && make install && make clean
|
||||
fi
|
||||
|
||||
while [[ ! -f "$extFile" ]];
|
||||
|
||||
@@ -25,6 +25,11 @@ if [ "$version" -eq "70" ] || [ "$version" -eq "71" ];then
|
||||
LIBV=2.7.0
|
||||
fi
|
||||
|
||||
if [ "$version" -eq "82" ];then
|
||||
echo "not need"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
NON_ZTS_FILENAME=`ls $serverPath/php/${version}/lib/php/extensions | grep no-debug-non-zts`
|
||||
extFile=$serverPath/php/${version}/lib/php/extensions/${NON_ZTS_FILENAME}/${LIBNAME}.so
|
||||
|
||||
@@ -36,7 +41,7 @@ fi
|
||||
|
||||
Install_lib()
|
||||
{
|
||||
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
|
||||
isInstall=`cat $serverPath/php/${version}/etc/php.ini|grep "${LIBNAME}.so"`
|
||||
if [ "${isInstall}" != "" ];then
|
||||
echo "php-$version 已安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
@@ -56,7 +61,7 @@ Install_lib()
|
||||
|
||||
$serverPath/php/$version/bin/phpize
|
||||
./configure --with-php-config=$serverPath/php/$version/bin/php-config
|
||||
make && make install && make clean
|
||||
make clean && make && make install && make clean
|
||||
|
||||
fi
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ Install_lib()
|
||||
$serverPath/php/$version/bin/phpize
|
||||
./configure --enable-xhprof \
|
||||
--with-php-config=$serverPath/php/$version/bin/php-config
|
||||
make && make install && make clean
|
||||
make clean && make && make install && make clean
|
||||
|
||||
fi
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ Install_lib()
|
||||
php_lib=$sourcePath/php_lib
|
||||
mkdir -p $php_lib
|
||||
|
||||
if [ ! -f $php_lib/${LIBNAME}-${LIBV} ];then
|
||||
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
|
||||
@@ -56,7 +56,7 @@ Install_lib()
|
||||
|
||||
$serverPath/php/$version/bin/phpize
|
||||
./configure --with-php-config=$serverPath/php/$version/bin/php-config
|
||||
make && make install && make clean
|
||||
make clean && make && make install && make clean
|
||||
cd ..
|
||||
fi
|
||||
|
||||
|
||||
@@ -23,6 +23,19 @@ if [ "$version" -lt "70" ];then
|
||||
LIBV=2.3.5
|
||||
fi
|
||||
|
||||
if [ "$version" -eq "70" ] || [ "$version" -eq "71" ];then
|
||||
LIBV=3.2.5
|
||||
fi
|
||||
|
||||
if [ "$version" -eq "72" ] || [ "$version" -eq "73" ];then
|
||||
LIBV=3.2.5
|
||||
fi
|
||||
|
||||
if [ "$version" -eq "82" ];then
|
||||
echo "not need"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
NON_ZTS_FILENAME=`ls $serverPath/php/${version}/lib/php/extensions | grep no-debug-non-zts`
|
||||
extFile=$serverPath/php/${version}/lib/php/extensions/${NON_ZTS_FILENAME}/${LIBNAME}.so
|
||||
@@ -54,7 +67,7 @@ Install_lib()
|
||||
|
||||
$serverPath/php/$version/bin/phpize
|
||||
./configure --with-php-config=$serverPath/php/$version/bin/php-config
|
||||
make && make install && make clean
|
||||
make clean && make && make install && make clean
|
||||
|
||||
fi
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ Install_lib()
|
||||
$serverPath/php/$version/bin/phpize
|
||||
./configure --with-php-config=$serverPath/php/$version/bin/php-config \
|
||||
--with-curl=$serverPath/lib/curl
|
||||
make && make install && make clean
|
||||
make clean && make && make install && make clean
|
||||
|
||||
fi
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ Install_lib()
|
||||
./configure --with-php-config=$serverPath/php/$version/bin/php-config \
|
||||
--with-zip
|
||||
|
||||
make && make install && make clean
|
||||
make clean && make && make install && make clean
|
||||
|
||||
fi
|
||||
|
||||
|
||||
@@ -53,7 +53,8 @@
|
||||
"73",
|
||||
"74",
|
||||
"80",
|
||||
"81"
|
||||
"81",
|
||||
"82"
|
||||
],
|
||||
"type": "缓存器",
|
||||
"msg": "用于加速PHP脚本!",
|
||||
@@ -73,7 +74,8 @@
|
||||
"73",
|
||||
"74",
|
||||
"80",
|
||||
"81"
|
||||
"81",
|
||||
"82"
|
||||
],
|
||||
"type": "通用扩展",
|
||||
"msg": "SSL!",
|
||||
@@ -88,7 +90,8 @@
|
||||
"73",
|
||||
"74",
|
||||
"80",
|
||||
"81"
|
||||
"81",
|
||||
"82"
|
||||
],
|
||||
"type": "通用扩展",
|
||||
"msg": "加密软件!",
|
||||
@@ -108,7 +111,8 @@
|
||||
"73",
|
||||
"74",
|
||||
"80",
|
||||
"81"
|
||||
"81",
|
||||
"82"
|
||||
],
|
||||
"type": "缓存器",
|
||||
"msg": "用于信号控制!",
|
||||
@@ -127,7 +131,8 @@
|
||||
"73",
|
||||
"74",
|
||||
"80",
|
||||
"81"
|
||||
"81",
|
||||
"82"
|
||||
],
|
||||
"type": "通用扩展",
|
||||
"msg": "用于FILE!",
|
||||
@@ -146,7 +151,8 @@
|
||||
"73",
|
||||
"74",
|
||||
"80",
|
||||
"81"
|
||||
"81",
|
||||
"82"
|
||||
],
|
||||
"type": "通用扩展",
|
||||
"msg": "用于图像文件格式!",
|
||||
@@ -157,9 +163,18 @@
|
||||
"name": "gd",
|
||||
"versions": [
|
||||
"52",
|
||||
"53",
|
||||
"54",
|
||||
"55",
|
||||
"56",
|
||||
"70",
|
||||
"71",
|
||||
"72",
|
||||
"73",
|
||||
"74",
|
||||
"80",
|
||||
"81"
|
||||
"81",
|
||||
"82"
|
||||
],
|
||||
"type": "通用扩展",
|
||||
"msg": "通用GD库!",
|
||||
@@ -180,7 +195,8 @@
|
||||
"73",
|
||||
"74",
|
||||
"80",
|
||||
"81"
|
||||
"81",
|
||||
"82"
|
||||
],
|
||||
"type": "通用扩展",
|
||||
"msg": "提供国际化支持",
|
||||
@@ -214,7 +230,8 @@
|
||||
"73",
|
||||
"74",
|
||||
"80",
|
||||
"81"
|
||||
"81",
|
||||
"82"
|
||||
],
|
||||
"type": "缓存器",
|
||||
"msg": "强大的内容缓存器,支持集群",
|
||||
@@ -235,7 +252,8 @@
|
||||
"73",
|
||||
"74",
|
||||
"80",
|
||||
"81"
|
||||
"81",
|
||||
"82"
|
||||
],
|
||||
"type": "缓存器",
|
||||
"msg": "更强大的内容缓存器,支持集群",
|
||||
@@ -265,7 +283,8 @@
|
||||
"73",
|
||||
"74",
|
||||
"80",
|
||||
"81"
|
||||
"81",
|
||||
"82"
|
||||
],
|
||||
"type": "通用扩展",
|
||||
"msg": "比GD更强大的图形库",
|
||||
@@ -284,7 +303,9 @@
|
||||
"72",
|
||||
"73",
|
||||
"74",
|
||||
"80"
|
||||
"80",
|
||||
"81",
|
||||
"82"
|
||||
],
|
||||
"type": "调试器",
|
||||
"msg": "不多说,不了解的不要安装",
|
||||
@@ -305,7 +326,8 @@
|
||||
"73",
|
||||
"74",
|
||||
"80",
|
||||
"81"
|
||||
"81",
|
||||
"82"
|
||||
],
|
||||
"type": "性能分析",
|
||||
"msg": "不多说,不了解的不要安装!",
|
||||
@@ -324,7 +346,9 @@
|
||||
"72",
|
||||
"73",
|
||||
"74",
|
||||
"80"
|
||||
"80",
|
||||
"81",
|
||||
"82"
|
||||
],
|
||||
"type": "通用扩展",
|
||||
"msg": "异步、并行、高性能网络通信引擎",
|
||||
@@ -355,7 +379,8 @@
|
||||
"73",
|
||||
"74",
|
||||
"80",
|
||||
"81"
|
||||
"81",
|
||||
"82"
|
||||
],
|
||||
"type": "框架",
|
||||
"msg": "Yaf是一个C语言编写的PHP框架",
|
||||
@@ -375,7 +400,8 @@
|
||||
"73",
|
||||
"74",
|
||||
"80",
|
||||
"81"
|
||||
"81",
|
||||
"82"
|
||||
],
|
||||
"type": "框架",
|
||||
"msg": "Yar是一个RPC框架",
|
||||
@@ -406,7 +432,8 @@
|
||||
"73",
|
||||
"74",
|
||||
"80",
|
||||
"81"
|
||||
"81",
|
||||
"82"
|
||||
],
|
||||
"type": "通用扩展",
|
||||
"msg": "Mongodb数据库连接驱动",
|
||||
@@ -422,7 +449,8 @@
|
||||
"73",
|
||||
"74",
|
||||
"80",
|
||||
"81"
|
||||
"81",
|
||||
"82"
|
||||
],
|
||||
"type": "缓存器",
|
||||
"msg": "高性能无锁共享内存Cache",
|
||||
@@ -442,7 +470,8 @@
|
||||
"73",
|
||||
"74",
|
||||
"80",
|
||||
"81"
|
||||
"81",
|
||||
"82"
|
||||
],
|
||||
"type": "大数据",
|
||||
"msg": "SOLR全文搜索服务",
|
||||
@@ -462,7 +491,8 @@
|
||||
"73",
|
||||
"74",
|
||||
"80",
|
||||
"81"
|
||||
"81",
|
||||
"82"
|
||||
],
|
||||
"type": "日志",
|
||||
"msg": "SeasLog高性能日志记录",
|
||||
@@ -478,7 +508,8 @@
|
||||
"73",
|
||||
"74",
|
||||
"80",
|
||||
"81"
|
||||
"81",
|
||||
"82"
|
||||
],
|
||||
"type": "压缩",
|
||||
"msg": "压缩组件",
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
"type":"运行环境",
|
||||
"ps":"著名Web端MySQL管理工具",
|
||||
"to_ver":["4.8.4"],
|
||||
"versions":["4.4.15","5.2.0"],
|
||||
"updates":["4.4.15","5.2.0"],
|
||||
"versions":["4.4.15","4.9.10","5.2.0"],
|
||||
"updates":["4.4.15","4.9.10","5.2.0"],
|
||||
"shell":"install.sh",
|
||||
"checks":"server/phpmyadmin",
|
||||
"path": "server/phpmyadmin",
|
||||
|
||||
@@ -51,8 +51,10 @@ Install_pureftp()
|
||||
VER=$1
|
||||
DOWNLOAD=https://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-${VER}.tar.gz
|
||||
|
||||
# curl -sSLo pure-ftpd-1.0.49.tar.gz https://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.49.tar.gz
|
||||
if [ ! -f $serverPath/source/pureftp/pure-ftpd-${VER}.tar.gz ];then
|
||||
wget --no-check-certificate -O $serverPath/source/pureftp/pure-ftpd-${VER}.tar.gz $DOWNLOAD
|
||||
# wget --no-check-certificate -O $serverPath/source/pureftp/pure-ftpd-${VER}.tar.gz $DOWNLOAD
|
||||
curl -sSLo $serverPath/source/pureftp/pure-ftpd-${VER}.tar.gz $DOWNLOAD
|
||||
fi
|
||||
|
||||
#检测文件是否损坏.
|
||||
@@ -64,7 +66,7 @@ Install_pureftp()
|
||||
else
|
||||
# 重新下载
|
||||
rm -rf $serverPath/source/pureftp/pure-ftpd-${VER}
|
||||
wget --no-check-certificate -O $serverPath/source/pureftp/pure-ftpd-${VER}.tar.gz $DOWNLOAD
|
||||
curl -sSLo $serverPath/source/pureftp/pure-ftpd-${VER}.tar.gz $DOWNLOAD
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
@@ -23,8 +23,10 @@ Install_rsyncd()
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
mkdir -p $serverPath/rsyncd
|
||||
|
||||
if [ $OSNAME == 'debian' ];then
|
||||
if [ "$OSNAME" == "debian'" ] || [ "$OSNAME" == "ubuntu'" ];then
|
||||
apt install -y rsync
|
||||
else
|
||||
yum install -y rsync
|
||||
fi
|
||||
|
||||
|
||||
@@ -36,10 +38,11 @@ Install_rsyncd()
|
||||
|
||||
Uninstall_rsyncd()
|
||||
{
|
||||
if [ -f /usr/lib/systemd/system/rsyncd.service ];then
|
||||
if [ -f /usr/lib/systemd/system/rsyncd.service ] || [ -f /lib/systemd/system/rsyncd.service ];then
|
||||
systemctl stop rsyncd
|
||||
systemctl disable rsyncd
|
||||
rm -rf /usr/lib/systemd/system/rsyncd.service
|
||||
rm -rf /lib/systemd/system/rsyncd.service
|
||||
systemctl daemon-reload
|
||||
fi
|
||||
|
||||
|
||||
+20
-27
@@ -11,32 +11,16 @@ sysName=`uname`
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
|
||||
|
||||
sysName=`uname`
|
||||
echo "use system: ${sysName}"
|
||||
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}'`
|
||||
|
||||
if [ ${sysName} == "Darwin" ]; then
|
||||
OSNAME='macos'
|
||||
elif grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then
|
||||
OSNAME='centos'
|
||||
elif grep -Eqi "Fedora" /etc/issue || grep -Eq "Fedora" /etc/*-release; then
|
||||
OSNAME='fedora'
|
||||
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'
|
||||
else
|
||||
OSNAME='unknow'
|
||||
fi
|
||||
|
||||
if [ ${OSNAME} == "centos" ] || [ ${OSNAME} == "fedora" ]; then
|
||||
if [ ${OSNAME} == "centos" ] ||
|
||||
[ ${OSNAME} == "fedora" ] ||
|
||||
[ ${OSNAME} == "alma" ]; then
|
||||
yum install -y postgresql-libs unixODBC
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
Install_sphinx()
|
||||
{
|
||||
|
||||
@@ -44,18 +28,26 @@ Install_sphinx()
|
||||
mkdir -p $serverPath/sphinx
|
||||
|
||||
SPHINX_DIR=${serverPath}/source/sphinx
|
||||
mkdir -p $SPHINX_DIR
|
||||
if [ ! -f ${SPHINX_DIR}/sphinx-3.1.1.tar.gz ];then
|
||||
if [ $sysName == 'Darwin' ]; then
|
||||
wget -O ${SPHINX_DIR}/sphinx-3.1.1.tar.gz http://sphinxsearch.com/files/sphinx-3.1.1-612d99f-darwin-amd64.tar.gz
|
||||
else
|
||||
wget -O ${SPHINX_DIR}/sphinx-3.1.1.tar.gz http://sphinxsearch.com/files/sphinx-3.1.1-612d99f-linux-amd64.tar.gz
|
||||
curl -sSLo ${SPHINX_DIR}/sphinx-3.1.1.tar.gz http://sphinxsearch.com/files/sphinx-3.1.1-612d99f-linux-amd64.tar.gz
|
||||
fi
|
||||
fi
|
||||
|
||||
cd ${SPHINX_DIR} && tar -zxvf sphinx-3.1.1.tar.gz
|
||||
cp -rf ${SPHINX_DIR}/sphinx-3.1.1/ $serverPath/sphinx/bin
|
||||
if [ ! -f ${SPHINX_DIR}/sphinx-3.1.1.tar.gz ];then
|
||||
curl -sSLo ${SPHINX_DIR}/sphinx-3.1.1.tar.gz https://github.com/midoks/mdserver-web/releases/download/init/sphinx-3.1.1.tar.gz
|
||||
fi
|
||||
|
||||
|
||||
cd ${SPHINX_DIR} && tar -zxvf sphinx-3.1.1.tar.gz
|
||||
|
||||
if [ "$?" == "0" ];then
|
||||
mkdir -p $SPHINX_DIR
|
||||
cp -rf ${SPHINX_DIR}/sphinx-3.1.1/ $serverPath/sphinx/bin
|
||||
fi
|
||||
|
||||
if [ -d $serverPath/sphinx ];then
|
||||
echo '3.1.1' > $serverPath/sphinx/version.pl
|
||||
echo '安装完成' > $install_tmp
|
||||
@@ -66,10 +58,11 @@ Install_sphinx()
|
||||
|
||||
Uninstall_sphinx()
|
||||
{
|
||||
if [ -f /usr/lib/systemd/system/sphinx.service ];then
|
||||
if [ -f /usr/lib/systemd/system/sphinx.service ] || [ -f /lib/systemd/system/sphinx.service ];then
|
||||
systemctl stop sphinx
|
||||
systemctl disable sphinx
|
||||
rm -rf /usr/lib/systemd/system/sphinx.service
|
||||
rm -rf /lib/systemd/system/sphinx.service
|
||||
systemctl daemon-reload
|
||||
fi
|
||||
|
||||
|
||||
@@ -7,27 +7,14 @@ rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
|
||||
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
|
||||
VERSION=$2
|
||||
|
||||
_os=`uname`
|
||||
if [ ${_os} == "Darwin" ]; then
|
||||
OSNAME='macos'
|
||||
elif grep -Eq "openSUSE" /etc/*-release; then
|
||||
OSNAME='opensuse'
|
||||
elif grep -Eq "CentOS" /etc/*-release; then
|
||||
OSNAME='centos'
|
||||
elif grep -Eq "Fedora" /etc/*-release; then
|
||||
OSNAME='fedora'
|
||||
elif grep -Eq "Debian" /etc/*-release; then
|
||||
OSNAME='debian'
|
||||
elif grep -Eq "Ubuntu" /etc/*-release; then
|
||||
OSNAME='ubuntu'
|
||||
else
|
||||
OSNAME='unknow'
|
||||
fi
|
||||
|
||||
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}'`
|
||||
|
||||
|
||||
Install_varnish()
|
||||
{
|
||||
@@ -36,7 +23,7 @@ Install_varnish()
|
||||
|
||||
if [ "${OSNAME}" == "macos" ]; then
|
||||
brew install varnish
|
||||
elif [ "${OSNAME}" == "centos" ]; then
|
||||
elif [ "${OSNAME}" == "centos" ] || [ "${OSNAME}" == "fedora" ] || [ "${OSNAME}" == "alma" ] || [ "${OSNAME}" == "rocky" ]; then
|
||||
yum install varnish -y
|
||||
elif [ "${OSNAME}" == "debian" ] || [ "${OSNAME}" == "ubuntu" ]; then
|
||||
apt install varnish -y
|
||||
@@ -62,7 +49,7 @@ Uninstall_varnish()
|
||||
|
||||
if [ "${OSNAME}" == "macos" ]; then
|
||||
brew uninstall varnish
|
||||
elif [ "${OSNAME}" == "centos" ]; then
|
||||
elif [ "${OSNAME}" == "centos" ] || [ "${OSNAME}" == "fedora" ] || [ "${OSNAME}" == "alma" ] || [ "${OSNAME}" == "rocky" ]; then
|
||||
yum remove varnish -y
|
||||
elif [ "${OSNAME}" == "debian" ] || [ "${OSNAME}" == "ubuntu" ]; then
|
||||
apt remove varnish -y
|
||||
|
||||
@@ -281,7 +281,7 @@ function getPanelSSL(){
|
||||
</div>\
|
||||
</div>\
|
||||
<ul class="help-info-text c7 pull-left">\
|
||||
<li>粘贴您的*.key以及*.pem内容,然后保存即可<a href="http://www.bt.cn/bbs/thread-704-1-1.html" class="btlink" target="_blank">[帮助]</a>。</li>\
|
||||
<li>粘贴您的*.key以及*.pem内容,然后保存即可。</li>\
|
||||
<li>如果浏览器提示证书链不完整,请检查是否正确拼接PEM证书</li><li>PEM格式证书 = 域名证书.crt + 根证书(root_bundle).crt</li>\
|
||||
</ul>\
|
||||
</div>'
|
||||
|
||||
@@ -1107,6 +1107,31 @@ function execLog(){
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取时分秒
|
||||
* @param {Number} seconds 总秒数
|
||||
* @param {String} dateFormat 返回的日期格式,默认为'H:i:s'
|
||||
*/
|
||||
function getSFM(seconds, dateFormat = 'H:i:s') {
|
||||
var obj = {};
|
||||
obj.H = Number.parseInt(seconds / 3600);
|
||||
obj.i = Number.parseInt((seconds - obj.H * 3600) / 60);
|
||||
obj.s = Number.parseInt(seconds - obj.H * 3600 - obj.i * 60);
|
||||
if (obj.H < 10) {
|
||||
obj.H = '0' + obj.H;
|
||||
}
|
||||
if (obj.i < 10) {
|
||||
obj.i = '0' + obj.i;
|
||||
}
|
||||
if (obj.s < 10) {
|
||||
obj.s = '0' + obj.s;
|
||||
}
|
||||
|
||||
// 3.解析
|
||||
var rs = dateFormat.replace('H', obj.H).replace('i', obj.i).replace('s', obj.s);
|
||||
return rs;
|
||||
}
|
||||
|
||||
function remind(a){
|
||||
a = a == undefined ? 1 : a;
|
||||
$.post("/task/list", "table=tasks&result=2,4,6,8&limit=10&p=" + a, function(g) {
|
||||
@@ -1117,9 +1142,9 @@ function remind(a){
|
||||
for(var d = 0; d < g.data.length; d++) {
|
||||
if(g.data[d].status != '1'){
|
||||
task_count++;
|
||||
e += '<tr><td><input type="checkbox"></td><td><div class="titlename c3">'+g.data[d].name+'</span><span class="rs-status">【'+lan.bt.task_the+'】<span><span class="rs-time">'+ lan.bt.time + (g.data[d].end - g.data[d].start) + lan.bt.s+'</span></div></td><td class="text-right c3">'+g.data[d].addtime+'</td></tr>'
|
||||
e += '<tr><td><input type="checkbox"></td><td><div class="titlename c3">'+g.data[d].name+'</span><span class="rs-status">【'+lan.bt.task_the+'】<span><span class="rs-time">耗时['+ getSFM(g.data[d].end - g.data[d].start) +']</span></div></td><td class="text-right c3">'+g.data[d].addtime+'</td></tr>'
|
||||
} else{
|
||||
e += '<tr><td><input type="checkbox"></td><td><div class="titlename c3">'+g.data[d].name+'</span><span class="rs-status">【'+lan.bt.task_ok+'】<span><span class="rs-time">'+ lan.bt.time + (g.data[d].end - g.data[d].start) + lan.bt.s+'</span></div></td><td class="text-right c3">'+g.data[d].addtime+'</td></tr>';
|
||||
e += '<tr><td><input type="checkbox"></td><td><div class="titlename c3">'+g.data[d].name+'</span><span class="rs-status">【'+lan.bt.task_ok+'】<span><span class="rs-time">耗时['+ getSFM(g.data[d].end - g.data[d].start) +']</span></div></td><td class="text-right c3">'+g.data[d].addtime+'</td></tr>';
|
||||
}
|
||||
}
|
||||
var con = '<div class="divtable"><table class="table table-hover">\
|
||||
|
||||
@@ -108,17 +108,17 @@ var lan = {
|
||||
},
|
||||
|
||||
"config":{
|
||||
"close_panel_msg":"关闭面板会导致您无法访问面板 ,您真的要关闭宝塔Linux面板吗?",
|
||||
"close_panel_msg":"关闭面板会导致您无法访问面板 ,您真的要关闭Linux面板吗?",
|
||||
"close_panel_title":"关闭面板",
|
||||
"config_save":"正在保存配置...",
|
||||
"config_sync":"正在同步时间...",
|
||||
"config_user_binding":"绑定宝塔帐号",
|
||||
"config_user_edit":"修改绑定宝塔账号",
|
||||
"config_user_binding":"绑定帐号",
|
||||
"config_user_edit":"修改绑定账号",
|
||||
"binding":"绑定",
|
||||
"token_get":"正在获取密钥...",
|
||||
"user_bt":"宝塔官网账户",
|
||||
"pass_bt":"宝塔官网密码",
|
||||
"binding_un_msg":"您确定要解除绑定宝塔帐号码?",
|
||||
"user_bt":"官网账户",
|
||||
"pass_bt":"官网密码",
|
||||
"binding_un_msg":"您确定要解除绑定帐号码?",
|
||||
"binding_un_title":"解除绑定",
|
||||
"binding_un":"解绑",
|
||||
"ssl_close_msg":"关闭SSL后,必需使用http协议访问面板,继续吗?",
|
||||
@@ -333,7 +333,7 @@ var lan = {
|
||||
"install_ok":"已将安装请求添加到安装器",
|
||||
"task_add":"已添加到队列",
|
||||
"panel_open":"正在打开面板...",
|
||||
"panel_add":"关联宝塔面板",
|
||||
"panel_add":"关联面板",
|
||||
"panel_edit":"修改关联",
|
||||
"panel_err_format":"面板地址格式不正确,示例:",
|
||||
"panel_err_empty":"面板资料不能为空",
|
||||
@@ -890,7 +890,7 @@ var lan = {
|
||||
"enable_301":"启用301",
|
||||
"to301_help_1":"选择[整站]时请不要将目标URL设为同一站点下的域名.",
|
||||
"to301_help_2":"取消301重定向后,需清空浏览器缓存才能看到生效结果.",
|
||||
"bt_ssl":"宝塔SSL",
|
||||
"bt_ssl":"SSL",
|
||||
"lets_ssl":"Let\'s Encrypt免费证书",
|
||||
"other":"其它",
|
||||
"other_ssl":"其他证书",
|
||||
@@ -901,23 +901,23 @@ var lan = {
|
||||
"ssl_key":"密钥(KEY)",
|
||||
"ssl_crt":"证书(PEM格式)",
|
||||
"ssl_close":"关闭SSL",
|
||||
"bt_bind_no":"未绑定宝塔账号,请注册绑定,绑定宝塔账号(非论坛账号)可实现一键部署SSL",
|
||||
"bt_user":"宝塔账号",
|
||||
"bt_bind_no":"未绑定账号,请注册绑定,绑定账号(非论坛账号)可实现一键部署SSL",
|
||||
"bt_user":"账号",
|
||||
"login":"登录",
|
||||
"bt_reg":"注册宝塔账号",
|
||||
"bt_ssl_help_1":"宝塔SSL证书为亚洲诚信证书,需要实名认证才能申请使用",
|
||||
"bt_ssl_help_2":"已有宝塔账号请登录绑定",
|
||||
"bt_ssl_help_3":"宝塔SSL申请的是TrustAsia DV SSL CA - G5 原价:1900元/1年,宝塔用户免费!",
|
||||
"bt_reg":"注册账号",
|
||||
"bt_ssl_help_1":"SSL证书为亚洲诚信证书,需要实名认证才能申请使用",
|
||||
"bt_ssl_help_2":"已有账号请登录绑定",
|
||||
"bt_ssl_help_3":"SSL申请的是TrustAsia DV SSL CA - G5 原价:1900元/1年,用户免费!",
|
||||
"bt_ssl_help_4":"一年满期后免费颁发。",
|
||||
"btapply":"申请",
|
||||
"endtime":"到期时间",
|
||||
"status":"状态",
|
||||
"bt_ssl_help_5":"申请之前,请确保域名已解析,如未解析会导致审核失败",
|
||||
"bt_ssl_help_6":"宝塔SSL申请的是免费版TrustAsia DV SSL CA - G5证书,仅支持单个域名申请",
|
||||
"bt_ssl_help_6":"SSL申请的是免费版TrustAsia DV SSL CA - G5证书,仅支持单个域名申请",
|
||||
"bt_ssl_help_7":"有效期1年,不支持续签,到期后需要重新申请",
|
||||
"bt_ssl_help_8":"Let\'s Encrypt免费证书,有效期3个月,支持多域名。默认会自动续签",
|
||||
"bt_ssl_help_9":"若您的站点使用了CDN或301重定向会导致续签失败",
|
||||
"bt_ssl_help_10":"粘贴您的*.key以及*.pem内容,然后保存即可<a href='http://www.bt.cn/bbs/thread-704-1-1.html' class='btlink' target='_blank'>[帮助]</a>。",
|
||||
"bt_ssl_help_10":"粘贴您的*.key以及*.pem内容,然后保存即可。",
|
||||
"phone_input":"请输入手机号码",
|
||||
"ssl_apply_1":"正在提交订单,请稍后..",
|
||||
"ssl_apply_2":"正在校验域名,请稍后..",
|
||||
|
||||
@@ -14,6 +14,8 @@ elif grep -Eqi "Arch" /etc/issue || grep -Eq "Arch" /etc/*-release; then
|
||||
OSNAME='arch'
|
||||
elif grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then
|
||||
OSNAME='centos'
|
||||
elif grep -Eqi "AlmaLinux" /etc/issue || grep -Eq "AlmaLinux" /etc/*-release; then
|
||||
OSNAME='alma'
|
||||
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
|
||||
|
||||
@@ -81,6 +81,10 @@ for yumPack in make cmake gcc gcc-c++ gcc-g77 flex bison file libtool libtool-li
|
||||
do yum -y install $yumPack;done
|
||||
|
||||
|
||||
# findLD=`cat /etc/ld.so.conf | grep '/usr/local/lib64'`
|
||||
# echo "/usr/local/lib64" >> /etc/ld.so.conf
|
||||
|
||||
|
||||
cd /www/server/mdserver-web/scripts && bash lib.sh
|
||||
chmod 755 /www/server/mdserver-web/data
|
||||
|
||||
@@ -99,11 +103,9 @@ do
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
cd /www/server/mdserver-web && /etc/init.d/mw stop
|
||||
cd /www/server/mdserver-web && /etc/init.d/mw start
|
||||
cd /www/server/mdserver-web && /etc/init.d/mw default
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -70,8 +70,9 @@ yum -y install epel-release
|
||||
|
||||
yum install -y libevent libevent-devel libxslt* libjpeg* libpng* gd* zip libmcrypt libmcrypt-devel
|
||||
yum install -y gcc libffi-devel python-devel openssl-devel
|
||||
yum install -y curl-devel libmcrypt libmcrypt-devel python3-devel
|
||||
|
||||
yum -y install wget python-devel python-imaging libicu-devel unzip bzip2-devel gcc libxml2 libxml2-dev libjpeg-devel libpng-devel libwebp libwebp-devel lsof pcre pcre-devel vixie-cron crontabs
|
||||
yum -y install wget python-devel python-imaging libicu-devel unzip bzip2-devel gcc libxml2 libxml2-devel libjpeg-devel libpng-devel libwebp libwebp-devel lsof pcre pcre-devel crontabs
|
||||
yum -y install net-tools
|
||||
yum -y install ncurses-devel mysql-devel cmake
|
||||
yum -y install python-devel
|
||||
@@ -81,6 +82,8 @@ yum -y install python3-devel
|
||||
for yumPack in make cmake gcc gcc-c++ gcc-g77 flex bison file libtool libtool-libs autoconf kernel-devel patch wget libjpeg libjpeg-devel libpng libpng-devel libpng10 libpng10-devel gd gd-devel libxml2 libxml2-devel zlib zlib-devel glib2 glib2-devel tar bzip2 bzip2-devel libevent libevent-devel ncurses ncurses-devel curl curl-devel libcurl libcurl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel vim-minimal gettext gettext-devel ncurses-devel gmp-devel pspell-devel libcap diffutils ca-certificates net-tools libc-client-devel psmisc libXpm-devel git-core c-ares-devel libicu-devel libxslt libxslt-devel zip unzip glibc.i686 libstdc++.so.6 cairo-devel bison-devel ncurses-devel libaio-devel perl perl-devel perl-Data-Dumper lsof vixie-cron crontabs expat-devel readline-devel;
|
||||
do yum -y install $yumPack;done
|
||||
|
||||
dnf install libxml2 libxml2-devel -y
|
||||
|
||||
cd /www/server/mdserver-web/scripts && bash lib.sh
|
||||
chmod 755 /www/server/mdserver-web/data
|
||||
|
||||
|
||||
@@ -13,11 +13,11 @@ fi
|
||||
setenforce 0
|
||||
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config
|
||||
|
||||
yum install -y wget lsof crontabs
|
||||
yum install -y wget lsof
|
||||
yum install -y python3-devel
|
||||
yum install -y python-devel
|
||||
yum install -y vixie-cron
|
||||
|
||||
yum install -y crontabs
|
||||
yum install -y curl curl-devel libcurl libcurl-devel
|
||||
#https need
|
||||
|
||||
if [ ! -d /root/.acme.sh ];then
|
||||
@@ -76,8 +76,17 @@ yum install -y lsof net-tools
|
||||
yum install -y ncurses-devel mysql-devel cmake
|
||||
yum install -y MySQL-python
|
||||
|
||||
for yumPack in make cmake gcc gcc-c++ gcc-g77 flex bison file libtool libtool-libs autoconf kernel-devel patch wget libjpeg libjpeg-devel libpng libpng-devel libpng10 libpng10-devel gd gd-devel libxml2 libxml2-devel zlib zlib-devel glib2 glib2-devel tar bzip2 bzip2-devel libevent libevent-devel ncurses ncurses-devel curl curl-devel libcurl libcurl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel vim-minimal gettext gettext-devel ncurses-devel gmp-devel pspell-devel libcap diffutils ca-certificates net-tools libc-client-devel psmisc libXpm-devel git-core c-ares-devel libicu-devel libxslt libxslt-devel zip unzip glibc.i686 libstdc++.so.6 cairo-devel bison-devel ncurses-devel libaio-devel perl perl-devel perl-Data-Dumper lsof vixie-cron crontabs expat-devel readline-devel;
|
||||
do yum -y install $yumPack;done
|
||||
for yumPack in make cmake gcc gcc-c++ flex bison file libtool libtool-libs autoconf kernel-devel patch wget libjpeg libjpeg-devel libpng libpng-devel gd gd-devel libxml2 libxml2-devel zlib zlib-devel glib2 glib2-devel tar bzip2 bzip2-devel libevent libevent-devel ncurses ncurses-devel curl curl-devel libcurl libcurl-devel e2fsprogs e2fsprogs-devel libidn libidn-devel vim-minimal gettext gettext-devel ncurses-devel gmp-devel libcap diffutils ca-certificates net-tools libc-client-devel psmisc libXpm-devel git-core c-ares-devel libicu-devel libxslt libxslt-devel zip unzip glibc.i686 libstdc++.so.6 cairo-devel bison-devel ncurses-devel libaio-devel perl perl-devel perl-Data-Dumper lsof crontabs expat-devel readline-devel;
|
||||
do dnf --enablerepo=powertools install -y $yumPack;done
|
||||
|
||||
yum install -y libtirpc libtirpc-devel
|
||||
|
||||
dnf install boost-locale
|
||||
|
||||
dnf --enablerepo=powertools install -y libmemcached libmemcached-devel
|
||||
dnf --enablerepo=powertools install -y rpcgen
|
||||
dnf --enablerepo=powertools install -y oniguruma oniguruma-devel
|
||||
dnf --enablerepo=powertools install -y re2c bison
|
||||
|
||||
cd /www/server/mdserver-web/scripts && bash lib.sh
|
||||
chmod 755 /www/server/mdserver-web/data
|
||||
|
||||
+2
-13
@@ -109,11 +109,6 @@ else
|
||||
yum install -y mysql-devel
|
||||
yum install -y oniguruma oniguruma-devel
|
||||
yum install -y ImageMagick ImageMagick-devel
|
||||
|
||||
if [ "$OSNAME" == "fedora" ]; then
|
||||
dnf install libxml2 libxml2-devel -y
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
@@ -128,13 +123,10 @@ pip3 install --upgrade setuptools
|
||||
cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt
|
||||
|
||||
pip3 install gevent-websocket==0.10.1
|
||||
pip3 install requests==2.20.0
|
||||
pip3 install flask-caching==1.10.1
|
||||
pip3 install flask-session==0.3.2
|
||||
pip3 install pymongo
|
||||
pip3 install psutil
|
||||
pip3 install flask-socketio==5.2.0
|
||||
pip3 install mysqlclient
|
||||
# pip3 install mysqlclient
|
||||
|
||||
|
||||
if [ ! -f /www/server/mdserver-web/bin/activate ];then
|
||||
@@ -149,11 +141,8 @@ pip3 install --upgrade setuptools
|
||||
pip3 install -r /www/server/mdserver-web/requirements.txt
|
||||
|
||||
pip3 install gevent-websocket==0.10.1
|
||||
pip3 install requests==2.20.0
|
||||
pip3 install flask-caching==1.10.1
|
||||
pip3 install flask-session==0.3.2
|
||||
pip3 install pymongo
|
||||
pip3 install psutil
|
||||
pip3 install flask-socketio==5.2.0
|
||||
pip3 install mysqlclient
|
||||
# pip3 install mysqlclient
|
||||
|
||||
|
||||
@@ -11,8 +11,6 @@ fi
|
||||
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config
|
||||
|
||||
|
||||
yum install -y curl-devel libmcrypt libmcrypt-devel python36-devel
|
||||
|
||||
cd /www/server/mdserver-web/scripts && bash lib.sh
|
||||
chmod 755 /www/server/mdserver-web/data
|
||||
|
||||
|
||||
@@ -392,7 +392,7 @@ def startPHPVersion(version):
|
||||
try:
|
||||
|
||||
# system
|
||||
phpService = '/lib/systemd/system/php' + version + '.service'
|
||||
phpService = mw.systemdCfgDir() + '/php' + version + '.service'
|
||||
if os.path.exists(phpService):
|
||||
mw.execShell("systemctl restart php" + version)
|
||||
if checkPHPVersion(version):
|
||||
@@ -439,17 +439,40 @@ def startPHPVersion(version):
|
||||
return True
|
||||
|
||||
|
||||
# 检查指定PHP版本
|
||||
def checkPHPVersion(version):
|
||||
def getFpmConfFile(version):
|
||||
return mw.getServerDir() + '/php/' + version + '/etc/php-fpm.d/www.conf'
|
||||
|
||||
|
||||
def getFpmAddress(version):
|
||||
fpm_address = '/tmp/php-cgi-{}.sock'.format(version)
|
||||
php_fpm_file = getFpmConfFile(version)
|
||||
try:
|
||||
url = 'http://127.0.0.1/phpfpm_status_' + version
|
||||
result = mw.httpGet(url, 1)
|
||||
if result.find('timed out'):
|
||||
raise
|
||||
content = readFile(php_fpm_file)
|
||||
tmp = re.findall(r"listen\s*=\s*(.+)", content)
|
||||
if not tmp:
|
||||
return fpm_address
|
||||
if tmp[0].find('sock') != -1:
|
||||
return fpm_address
|
||||
if tmp[0].find(':') != -1:
|
||||
listen_tmp = tmp[0].split(':')
|
||||
if bind:
|
||||
fpm_address = (listen_tmp[0], int(listen_tmp[1]))
|
||||
else:
|
||||
fpm_address = ('127.0.0.1', int(listen_tmp[1]))
|
||||
else:
|
||||
fpm_address = ('127.0.0.1', int(tmp[0]))
|
||||
return fpm_address
|
||||
except:
|
||||
return fpm_address
|
||||
|
||||
|
||||
def checkPHPVersion(version):
|
||||
# 检查指定PHP版本
|
||||
try:
|
||||
sock = getFpmAddress(version)
|
||||
data = mw.requestFcgiPHP(sock, '/phpfpm_status_' + version + '?json')
|
||||
result = str(data, encoding='utf-8')
|
||||
except Exception as e:
|
||||
url = 'http://' + mw.getLocalIp() + '/phpfpm_status_' + version
|
||||
result = mw.httpGet(url, 1)
|
||||
else:
|
||||
result = 'Bad Gateway'
|
||||
|
||||
# print(version,result)
|
||||
@@ -468,7 +491,7 @@ def checkPHPVersion(version):
|
||||
return True
|
||||
|
||||
# systemd
|
||||
systemd = '/lib/systemd/system/openresty.service'
|
||||
systemd = mw.systemdCfgDir() + '/openresty.service'
|
||||
if os.path.exists(systemd):
|
||||
execShell('systemctl reload openresty')
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user