diff --git a/.github/workflows/python-app-mysql8.yml b/.github/workflows/python-app-mysql8.yml
index d33551fdc..ab89330b0 100644
--- a/.github/workflows/python-app-mysql8.yml
+++ b/.github/workflows/python-app-mysql8.yml
@@ -5,9 +5,9 @@ name: MW APP MySQL80
on:
push:
- branches: [ "master","dev" ]
+ branches: [ "master" ]
pull_request:
- branches: [ "master","dev" ]
+ branches: [ "master" ]
permissions:
contents: read
@@ -31,11 +31,6 @@ jobs:
sudo bash scripts/install_dev.sh
- name: Install MySQL80
run: |
- sudo mkdir -p /tmp
- sudo cat /www/server/mdserver-web/plugins/mysql/versions/8.0/install.sh > /tmp/t.log
- sudo echo "export MAKEJN=-j12\n" >> /www/server/mdserver-web/plugins/mysql/versions/8.0/install.sh
- sudo cat /tmp/t.log >> /www/server/mdserver-web/plugins/mysql/versions/8.0/install.sh
-
cd /www/server/mdserver-web/plugins/mysql && sudo bash install.sh install 8.0
- name: Start DEBUG
run: |
diff --git a/.github/workflows/python-app-op.yml b/.github/workflows/python-app-op.yml
index 8b1378917..53ab5f7fc 100644
--- a/.github/workflows/python-app-op.yml
+++ b/.github/workflows/python-app-op.yml
@@ -1 +1,38 @@
+# This workflow will install Python dependencies, run tests and lint with a single version of Python
+# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
+name: MW APP OpenResty
+
+on:
+ push:
+ branches: [ "master", "dev" ]
+ pull_request:
+ branches: [ "master", "dev" ]
+
+permissions:
+ contents: read
+
+jobs:
+ build:
+ strategy:
+ matrix:
+ os: [ubuntu-latest]
+ runs-on: ${{ matrix.os }}
+ #runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v3
+ - name: Set up Python 3.10
+ uses: actions/setup-python@v3
+ with:
+ python-version: "3.10"
+ - name: Install MW
+ run: |
+ sudo bash scripts/install_dev.sh
+ - name: Install OpenResty
+ run: |
+ cd /www/server/mdserver-web/plugins/openresty && sudo bash install.sh install 1.21.4.1
+ - name: Start DEBUG
+ run: |
+ gunicorn -c setting.py app:app
+ python3 task.py &
diff --git a/.github/workflows/python-app-php.yml b/.github/workflows/python-app-php.yml
new file mode 100644
index 000000000..e92edc482
--- /dev/null
+++ b/.github/workflows/python-app-php.yml
@@ -0,0 +1,68 @@
+# This workflow will install Python dependencies, run tests and lint with a single version of Python
+# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
+
+name: MW APP PHP
+
+on:
+ push:
+ branches: [ "master" ]
+ pull_request:
+ branches: [ "master" ]
+
+permissions:
+ contents: read
+
+jobs:
+ build:
+ strategy:
+ matrix:
+ os: [ubuntu-latest]
+ runs-on: ${{ matrix.os }}
+ #runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v3
+ - name: Set up Python 3.10
+ uses: actions/setup-python@v3
+ with:
+ python-version: "3.10"
+ - name: Install MW
+ run: |
+ sudo bash scripts/install_dev.sh
+ - name: Install PHP53
+ run: |
+ cd /www/server/mdserver-web/plugins/php && sudo bash install.sh install 53
+ - name: Install PHP54
+ run: |
+ cd /www/server/mdserver-web/plugins/php && sudo bash install.sh install 54
+ - name: Install PHP55
+ run: |
+ cd /www/server/mdserver-web/plugins/php && sudo bash install.sh install 55
+ - name: Install PHP56
+ run: |
+ cd /www/server/mdserver-web/plugins/php && sudo bash install.sh install 56
+ - name: Install PHP70
+ run: |
+ cd /www/server/mdserver-web/plugins/php && sudo bash install.sh install 70
+ - name: Install PHP71
+ run: |
+ cd /www/server/mdserver-web/plugins/php && sudo bash install.sh install 71
+ - name: Install PHP72
+ run: |
+ cd /www/server/mdserver-web/plugins/php && sudo bash install.sh install 72
+ - name: Install PHP73
+ run: |
+ cd /www/server/mdserver-web/plugins/php && sudo bash install.sh install 73
+ - name: Install PHP74
+ run: |
+ cd /www/server/mdserver-web/plugins/php && sudo bash install.sh install 74
+ - name: Install PHP80
+ run: |
+ cd /www/server/mdserver-web/plugins/php && sudo bash install.sh install 80
+ - name: Install PHP81
+ run: |
+ cd /www/server/mdserver-web/plugins/php && sudo bash install.sh install 81
+ - name: Start DEBUG
+ run: |
+ gunicorn -c setting.py app:app
+ python3 task.py &
diff --git a/.gitignore b/.gitignore
index 3dec936b0..7c97e80b2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -135,4 +135,6 @@ plugins/openlitespeed
plugins/gdrive/
data/ipv6.pl
data/restart.pl
-pip-selfcheck.json
\ No newline at end of file
+pip-selfcheck.json
+data/ssl.pl
+
diff --git a/README.md b/README.md
index ca2c26962..fb3397085 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,5 @@
### mdserver-web 0.8.6
+
简单的Linux面板,感谢BT.CN写出如此好的web管理软件。我一看到,就知道这是我一直想要的页面化管理方式。
复制了后台管理界面,按照自己想要的方式写了一版。
@@ -18,6 +19,8 @@
基本上可以使用,后续会继续优化!欢迎提供意见!
+- 吹水组 - https://t.me/mdserver_web
+
### 主要插件介绍
* OpenResty - 轻量级,占有内存少,并发能力强。
@@ -38,11 +41,6 @@
* swap插件[虚拟内存]。
-### 问题
-- OP防火墙,暂不要开启。
-
-
-
### GW使用
- 自动安装
diff --git a/class/core/files_api.py b/class/core/files_api.py
index d64dc8aca..8f7974d8f 100755
--- a/class/core/files_api.py
+++ b/class/core/files_api.py
@@ -191,34 +191,40 @@ class files_api:
# self.setFileAccept(path + '/' + filename)
return mw.returnJson(True, '已将下载任务添加到队列!')
+ # 删除进程下的所有进程
+ def removeTaskRecursion(self, pid):
+ cmd = "ps -ef|grep " + pid + \
+ " | grep -v grep |sed -n '2,1p' | awk '{print $2}'"
+ sub_pid = mw.execShell(cmd)
+
+ if sub_pid[0].strip() == '':
+ return 'ok'
+
+ self.removeTaskRecursion(sub_pid[0].strip())
+ mw.execShell('kill -9 ' + sub_pid[0].strip())
+ return sub_pid[0].strip()
+
def removeTaskApi(self):
+ import system_api
mid = request.form.get('id', '')
try:
name = mw.M('tasks').where('id=?', (mid,)).getField('name')
status = mw.M('tasks').where('id=?', (mid,)).getField('status')
+ # print(name, status)
mw.M('tasks').delete(mid)
if status == '-1':
- os.system(
- "kill `ps -ef |grep 'python panelSafe.pyc'|grep -v grep|grep -v panelExec|awk '{print $2}'`")
- os.system(
- "kill `ps aux | grep 'python task.pyc$'|awk '{print $2}'`")
- os.system('''
-pids=`ps aux | grep 'sh'|grep -v grep|grep install|awk '{print $2}'`
-arr=($pids)
-
-for p in ${arr[@]}
-do
- kill -9 $p
-done
- ''')
-
- os.system(
- 'rm -f ' + name.replace('扫描目录[', '').replace(']', '') + '/scan.pl')
+ task_pid = mw.execShell(
+ "ps aux | grep 'task.py' | grep -v grep |awk '{print $2}'")
+
+ task_list = task_pid[0].strip().split("\n")
+ for i in range(len(task_list)):
+ self.removeTaskRecursion(task_list[i])
+
isTask = mw.getRootDir() + '/tmp/panelTask.pl'
mw.writeFile(isTask, 'True')
- os.system('/etc/init.d/mw start')
+ system_api.system_api().restartTask()
except:
- os.system('/etc/init.d/mw start')
+ system_api.system_api().restartTask()
return mw.returnJson(True, '任务已删除!')
# 上传文件
diff --git a/class/core/site_api.py b/class/core/site_api.py
index 6c38d8fed..2b9c10278 100755
--- a/class/core/site_api.py
+++ b/class/core/site_api.py
@@ -86,9 +86,9 @@ class site_api:
name = request.form.get('name', '')
import time
# 清理旧的
- defaultSite = mw.readFile('data/defaultSite.pl')
- if defaultSite:
- path = self.getHostConf(defaultSite)
+ default_site = mw.readFile('data/default_site.pl')
+ if default_site:
+ path = self.getHostConf(default_site)
if os.path.exists(path):
conf = mw.readFile(path)
rep = "listen\s+80.+;"
@@ -106,7 +106,7 @@ class site_api:
conf = re.sub(rep, 'listen 443 ssl default_server;', conf, 1)
mw.writeFile(path, conf)
- mw.writeFile('data/defaultSite.pl', name)
+ mw.writeFile('data/default_site.pl', name)
mw.restartWeb()
return mw.returnJson(True, '设置成功!')
@@ -114,7 +114,7 @@ class site_api:
data = {}
data['sites'] = mw.M('sites').field(
'name').order('id desc').select()
- data['defaultSite'] = mw.readFile('data/defaultSite.pl')
+ data['default_site'] = mw.readFile('data/default_site.pl')
return mw.getJson(data)
def setPsApi(self):
@@ -1653,6 +1653,7 @@ include enable-php-''' % (fix.strip().replace(',', '|'), domains.strip().replace
os.makedirs(path)
if not mw.isAppleSystem():
mw.execShell('chown -R www:www ' + path)
+ mw.writeFile(path + '/index.html', 'Work has started!!!')
mw.execShell('chmod -R 755 ' + path)
def nginxAddDomain(self, webname, domain, port):
@@ -1688,6 +1689,7 @@ include enable-php-''' % (fix.strip().replace(',', '|'), domains.strip().replace
content = content.replace('{$PORT}', self.sitePort)
content = content.replace('{$SERVER_NAME}', self.siteName)
content = content.replace('{$ROOT_DIR}', self.sitePath)
+ content = content.replace('{$PHP_DIR}', self.setupPath + '/php')
content = content.replace('{$PHPVER}', self.phpVersion)
content = content.replace('{$OR_REWRITE}', self.rewritePath)
diff --git a/class/core/system_api.py b/class/core/system_api.py
index 87fb6222f..f16705521 100755
--- a/class/core/system_api.py
+++ b/class/core/system_api.py
@@ -102,6 +102,12 @@ class system_api:
return mw.returnJson(True, '正在重启服务器!')
##### ----- end ----- ###
+ def restartTask(self):
+ initd = mw.getRunDir() + '/scripts/init.d/mw'
+ if os.path.exists(initd):
+ os.system(initd + ' ' + 'restart_task')
+ return True
+
def restartMw(self):
mw.writeFile('data/restart.pl', 'True')
return True
diff --git a/data/defaultSite.pl b/data/defaultSite.pl
deleted file mode 100644
index bec7f1669..000000000
--- a/data/defaultSite.pl
+++ /dev/null
@@ -1 +0,0 @@
-t.vvv
\ No newline at end of file
diff --git a/data/tpl/nginx.conf b/data/tpl/nginx.conf
index 32c63f291..d37f5662d 100755
--- a/data/tpl/nginx.conf
+++ b/data/tpl/nginx.conf
@@ -15,7 +15,7 @@ server
#ERROR-PAGE-END
#PHP-INFO-START
- include enable-php-{$PHPVER}.conf;
+ include {$PHP_DIR}/conf/enable-php-{$PHPVER}.conf;
#PHP-INFO-END
#REWRITE-START
diff --git a/plugins/gogs/install.sh b/plugins/gogs/install.sh
index a00d2641e..f06e8f857 100755
--- a/plugins/gogs/install.sh
+++ b/plugins/gogs/install.sh
@@ -61,6 +61,9 @@ Install_gogs()
if [ -d $serverPath/gogs ];then
echo $version > $serverPath/gogs/version.pl
+
+ cd ${rootPath} && python3 ${rootPath}/plugins/gogs/index.py start
+ cd ${rootPath} && python3 ${rootPath}/plugins/gogs/index.py initd_install
fi
# if id -u gogs > /dev/null 2>&1; then
# echo "gogs user exists"
@@ -75,11 +78,19 @@ Install_gogs()
Uninstall_gogs()
{
- rm -rf $serverPath/gogs
- if [ -f /usr/lib/systemd/system/gogs.service ];then
+
+ if [ -f /lib/systemd/system/gogs.service ];then
systemctl stop gogs
- rm -rf /usr/lib/systemd/system/gogs.service
+ systemctl disable gogs
+ rm -rf /lib/systemd/system/gogs.service
+ systemctl daemon-reload
fi
+
+ if [ -f $serverPath/gogs/initd/gogs ];then
+ $serverPath/gogs/initd/gogs stop
+ fi
+
+ rm -rf $serverPath/gogs
echo 'uninstall success' > $install_tmp
}
diff --git a/plugins/memcached/install.sh b/plugins/memcached/install.sh
index b0afdcae8..fad5f22cc 100755
--- a/plugins/memcached/install.sh
+++ b/plugins/memcached/install.sh
@@ -26,13 +26,28 @@ Install_mem(){
echo "./configure --prefix=${serverPath}/memcached && make && make install"
cd $serverPath/source/memcached-${VERSION} && ./configure --prefix=$serverPath/memcached && make && make install
- echo '1.6' > $serverPath/memcached/version.pl
- echo 'install ok' > $install_tmp
+ if [ -d $serverPath/memcached ];then
+ echo '1.6' > $serverPath/memcached/version.pl
+ echo 'install ok' > $install_tmp
+
+ cd ${rootPath} && python3 ${rootPath}/plugins/memcached/index.py start
+ cd ${rootPath} && python3 ${rootPath}/plugins/memcached/index.py initd_install
+ fi
}
Uninstall_mem()
{
- ${serverPath}/memcached/init.d/memcached stop
+
+ if [ -f /lib/systemd/system/memcached.service ];then
+ systemctl stop memcached
+ systemctl disable memcached
+ rm -rf /lib/systemd/system/memcached.service
+ systemctl daemon-reload
+ fi
+
+ if [ -f $serverPath/memcached/initd/memcached ];then
+ $serverPath/memcached/initd/memcached stop
+ fi
rm -rf $serverPath/memcached
}
diff --git a/plugins/mysql/versions/8.0/install.sh b/plugins/mysql/versions/8.0/install.sh
index e15c92f1e..6a29558c0 100755
--- a/plugins/mysql/versions/8.0/install.sh
+++ b/plugins/mysql/versions/8.0/install.sh
@@ -39,7 +39,7 @@ Install_mysql()
fi
if [ ! -f ${mysqlDir}/mysql-boost-8.0.25.tar.gz ];then
- wget -O ${mysqlDir}/mysql-boost-8.0.25.tar.gz https://cdn.mysql.com/archives/mysql-8.0/mysql-boost-8.0.25.tar.gz
+ wget -O ${mysqlDir}/mysql-boost-8.0.25.tar.gz --tries=3 https://cdn.mysql.com/archives/mysql-8.0/mysql-boost-8.0.25.tar.gz
fi
#检测文件是否损坏.
@@ -51,7 +51,7 @@ Install_mysql()
else
# 重新下载
rm -rf ${mysqlDir}/mysql-8.0.25
- wget -O ${mysqlDir}/mysql-boost-8.0.25.tar.gz https://cdn.mysql.com/archives/mysql-8.0/mysql-boost-8.0.25.tar.gz
+ wget -O ${mysqlDir}/mysql-boost-8.0.25.tar.gz --tries=3 https://cdn.mysql.com/archives/mysql-8.0/mysql-boost-8.0.25.tar.gz
fi
fi
diff --git a/plugins/openresty/conf/nginx.conf b/plugins/openresty/conf/nginx.conf
index 8ed83ed10..c5f539921 100644
--- a/plugins/openresty/conf/nginx.conf
+++ b/plugins/openresty/conf/nginx.conf
@@ -70,7 +70,7 @@ http
stub_status on;
access_log off;
}
- include {$SERVER_PATH}/openresty/nginx/conf/php_status/*.conf;
+ include {$SERVER_PATH}/web_conf/php/status/*.conf;
}
include {$SERVER_PATH}/web_conf/nginx/vhost/*.conf;
}
diff --git a/plugins/openresty/index.py b/plugins/openresty/index.py
index 80bc3e3ea..5958f2c47 100755
--- a/plugins/openresty/index.py
+++ b/plugins/openresty/index.py
@@ -86,15 +86,6 @@ def getInitDTpl():
return path
-def makeConf():
- vhost = getServerDir() + '/nginx/conf/vhost'
- if not os.path.exists(vhost):
- os.mkdir(vhost)
- php_status = getServerDir() + '/nginx/conf/php_status'
- if not os.path.exists(php_status):
- os.mkdir(php_status)
-
-
def getFileOwner(filename):
import pwd
stat = os.lstat(filename)
@@ -136,7 +127,10 @@ def confReplace():
mw.writeFile(nconf, content)
# 静态配置
- static_conf = getServerDir() + '/nginx/conf/enable-php-00.conf'
+ php_conf = mw.getServerDir() + '/web_conf/php/conf'
+ if not os.path.exists(php_conf):
+ mw.execShell('mkdir -p ' + php_conf)
+ static_conf = mw.getServerDir() + '/web_conf/php/conf/enable-php-00.conf'
if not os.path.exists(static_conf):
mw.writeFile(static_conf, '')
@@ -189,9 +183,6 @@ def initDreplace():
mw.writeFile(systemService, se_content)
mw.execShell('systemctl daemon-reload')
- # make nginx vhost or other
- makeConf()
-
return file_bin
@@ -206,6 +197,12 @@ def status():
def restyOp(method):
file = initDreplace()
+ # 启动时,先检查一下配置文件
+ check = getServerDir() + "/bin/openresty -t"
+ check_data = mw.execShell(check)
+ if not check_data[1].find('test is successful'):
+ return check_data[1]
+
if not mw.isAppleSystem():
data = mw.execShell('systemctl ' + method + ' openresty')
if data[1] == '':
diff --git a/plugins/openresty/install.sh b/plugins/openresty/install.sh
index 627e70cfb..5b597593d 100755
--- a/plugins/openresty/install.sh
+++ b/plugins/openresty/install.sh
@@ -49,18 +49,29 @@ Install_openresty()
if [ -d $serverPath/openresty ];then
echo "${VERSION}" > $serverPath/openresty/version.pl
- echo "" > $serverPath/openresty/nginx/conf/enable-php-00.conf
+ echo "" > $serverPath/web_conf/php/conf/enable-php-00.conf
+
+ #初始化
+ cd ${rootPath} && python3 ${rootPath}/plugins/openresty/index.py start
+ cd ${rootPath} && python3 ${rootPath}/plugins/openresty/index.py initd_install
fi
echo '安装完成' > $install_tmp
}
Uninstall_openresty()
{
- rm -rf $serverPath/openresty
-
+
if [ -f /lib/systemd/system/openresty.service ];then
+ systemctl stop openresty
rm -rf /lib/systemd/system/openresty.service
+ systemctl daemon-reload
fi
+
+ if [ -f $serverPath/openresty/init.d/openresty ];then
+ $serverPath/openresty/init.d/openresty stop
+ fi
+
+ rm -rf $serverPath/openresty
echo '卸载完成' > $install_tmp
}
diff --git a/plugins/openresty/js/openresty.js b/plugins/openresty/js/openresty.js
index 535e91e9e..051e35963 100755
--- a/plugins/openresty/js/openresty.js
+++ b/plugins/openresty/js/openresty.js
@@ -97,12 +97,12 @@ function orPluginOpServiceOp(a,b,c,d,a,v){
}
if( g.status && g.data != 'ok' ) {
- layer.msg(g.data, {icon: 2,time: 3000,shade: 0.3,shadeClose: true});
+ layer.msg(g.data, {icon: 2,time: 10000,shade: 0.3});
}
- setTimeout(function(){
- location.reload();
- },2000);
+ // setTimeout(function(){
+ // location.reload();
+ // },2000);
},'json').error(function() {
layer.close(e);
layer.msg('操作异常!', {icon: 2});
diff --git a/plugins/php/conf/enable-php.conf b/plugins/php/conf/enable-php.conf
index 9f22fb939..d9712e0e3 100644
--- a/plugins/php/conf/enable-php.conf
+++ b/plugins/php/conf/enable-php.conf
@@ -4,5 +4,5 @@ location ~ [^/]\.php(/|$)
fastcgi_pass unix:/tmp/php-cgi-{$PHP_VERSION}.sock;
fastcgi_index index.php;
include fastcgi.conf;
- include pathinfo.conf;
+ include {$SERVER_PATH}/web_conf/php/pathinfo.conf;
}
\ No newline at end of file
diff --git a/plugins/php/index.py b/plugins/php/index.py
index fe6be8eca..10ab15330 100755
--- a/plugins/php/index.py
+++ b/plugins/php/index.py
@@ -122,37 +122,49 @@ def contentReplace(content, version):
def makeOpenrestyConf():
phpversions = ['00', '52', '53', '54', '55', '56',
'70', '71', '72', '73', '74', '80', '81']
- if mw.isInstalledWeb():
- sdir = mw.getServerDir()
- d_pathinfo = sdir + '/openresty/nginx/conf/pathinfo.conf'
- if not os.path.exists(d_pathinfo):
- s_pathinfo = getPluginDir() + '/conf/pathinfo.conf'
- shutil.copyfile(s_pathinfo, d_pathinfo)
-
- info = getPluginDir() + '/info.json'
- content = mw.readFile(info)
- content = json.loads(content)
- versions = content['versions']
- tpl = getPluginDir() + '/conf/enable-php.conf'
- tpl_content = mw.readFile(tpl)
- for x in phpversions:
- dfile = sdir + '/openresty/nginx/conf/enable-php-' + x + '.conf'
- if not os.path.exists(dfile):
- if x == '00':
- mw.writeFile(dfile, '')
- else:
- w_content = contentReplace(tpl_content, x)
- mw.writeFile(dfile, w_content)
-
- # php-fpm status
- for version in phpversions:
- dfile = sdir + '/openresty/nginx/conf/php_status/phpfpm_status_' + version + '.conf'
- tpl = getPluginDir() + '/conf/phpfpm_status.conf'
- if not os.path.exists(dfile):
- content = mw.readFile(tpl)
- content = contentReplace(content, version)
- mw.writeFile(dfile, content)
- mw.restartWeb()
+
+ sdir = mw.getServerDir()
+
+ dst_dir = sdir + '/web_conf/php'
+ dst_dir_conf = sdir + '/web_conf/php/conf'
+ dst_dir_status = sdir + '/web_conf/php/status'
+ if not os.path.exists(dst_dir):
+ mw.execShell('mkdir -p ' + dst_dir)
+
+ if not os.path.exists(dst_dir_conf):
+ mw.execShell('mkdir -p ' + dst_dir_conf)
+
+ if not os.path.exists(dst_dir_status):
+ mw.execShell('mkdir -p ' + dst_dir_status)
+
+ d_pathinfo = sdir + '/web_conf/php/pathinfo.conf'
+ if not os.path.exists(d_pathinfo):
+ s_pathinfo = getPluginDir() + '/conf/pathinfo.conf'
+ shutil.copyfile(s_pathinfo, d_pathinfo)
+
+ info = getPluginDir() + '/info.json'
+ content = mw.readFile(info)
+ content = json.loads(content)
+ versions = content['versions']
+ tpl = getPluginDir() + '/conf/enable-php.conf'
+ tpl_content = mw.readFile(tpl)
+ for x in phpversions:
+ dfile = sdir + '/web_conf/php/conf/enable-php-' + x + '.conf'
+ if not os.path.exists(dfile):
+ if x == '00':
+ mw.writeFile(dfile, '')
+ else:
+ w_content = contentReplace(tpl_content, x)
+ mw.writeFile(dfile, w_content)
+
+ # php-fpm status
+ for version in phpversions:
+ dfile = sdir + '/web_conf/php/status/phpfpm_status_' + version + '.conf'
+ tpl = getPluginDir() + '/conf/phpfpm_status.conf'
+ if not os.path.exists(dfile):
+ content = mw.readFile(tpl)
+ content = contentReplace(content, version)
+ mw.writeFile(dfile, content)
def phpPrependFile(version):
@@ -537,6 +549,10 @@ def checkFpmStatusFile(version):
def getFpmStatus(version):
checkFpmStatusFile(version)
+ stat = status(version)
+ if stat == 'stop':
+ return mw.returnJson(False, 'PHP[' + version + ']未启动!!!')
+
try:
url = 'http://' + mw.getHostAddr() + '/phpfpm_status_' + version + '?json'
result = mw.httpGet(url)
@@ -552,7 +568,7 @@ def getFpmStatus(version):
except Exception as e:
data = {}
- return mw.getJson(data)
+ return mw.returnJson(True, "OK", data)
def getDisableFunc(version):
diff --git a/plugins/php/install.sh b/plugins/php/install.sh
index 421755f23..b3a6f2f95 100755
--- a/plugins/php/install.sh
+++ b/plugins/php/install.sh
@@ -31,4 +31,22 @@ if [ ! -d $curPath/versions/$2 ];then
exit 0
fi
-sh -x $curPath/versions/$2/install.sh $1
+if [ "${action}" == "uninstall" ];then
+
+ if [ -f /lib/systemd/system/php${type}.service ];then
+ systemctl stop php${type}
+ systemctl disable php${type}
+ rm -rf /lib/systemd/system/php${type}.service
+ systemctl daemon-reload
+ fi
+fi
+
+cd ${curPath} && sh -x $curPath/versions/$2/install.sh $1
+
+if [ "${action}" == "install" ];then
+ #初始化
+ cd ${rootPath} && python3 ${rootPath}/plugins/php/index.py start ${type}
+ cd ${rootPath} && python3 ${rootPath}/plugins/php/index.py initd_install ${type}
+fi
+
+
diff --git a/plugins/php/js/php.js b/plugins/php/js/php.js
index 6b556ec53..692cbdabe 100755
--- a/plugins/php/js/php.js
+++ b/plugins/php/js/php.js
@@ -312,7 +312,13 @@ function setFpmConfig(version){
function getFpmStatus(version){
phpPost('get_fpm_status', version, '', function(ret_data){
- var rdata = $.parseJSON(ret_data.data);
+ var tmp_data = $.parseJSON(ret_data.data);
+ if(!tmp_data.status){
+ layer.msg(tmp_data.msg, { icon: tmp_data.status ? 1 : 2 });
+ return;
+ }
+
+ var rdata = tmp_data.data;
var con = "
\
应用池(pool) | " + rdata.pool + " |
\
进程管理方式(process manager) | " + ((rdata['process manager'] == 'dynamic') ? '动态' : '静态') + " |
\
diff --git a/plugins/php/versions/52/gd.sh b/plugins/php/versions/52/gd.sh
new file mode 100755
index 000000000..4a05b6046
--- /dev/null
+++ b/plugins/php/versions/52/gd.sh
@@ -0,0 +1,107 @@
+#!/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
+
+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
+
+Install_lib()
+{
+
+ isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
+ if [ "${isInstall}" != "" ];then
+ echo "php-$version 已安装${LIBNAME},请选择其它版本!"
+ return
+ fi
+
+ 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/
+
+
+ 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
+ ./configure --with-php-config=$serverPath/php/$version/bin/php-config \
+ --with-gd \
+ --with-jpeg-dir=/usr/lib \
+ --with-freetype-dir=${serverPath}/lib/freetype_old \
+ --enable-gd-native-ttf \
+ --enable-gd-jis-conv
+
+ 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
+ $serverPath/php/init.d/php$version reload
+ echo '==============================================='
+ echo 'successful!'
+}
+
+
+
+if [ "$actionType" == 'install' ];then
+ Install_lib
+elif [ "$actionType" == 'uninstall' ];then
+ Uninstall_lib
+fi
\ No newline at end of file
diff --git a/plugins/php/versions/52/install.sh b/plugins/php/versions/52/install.sh
index 5b5032c6d..c130e43e9 100755
--- a/plugins/php/versions/52/install.sh
+++ b/plugins/php/versions/52/install.sh
@@ -36,19 +36,19 @@ else
fi
-if [ "$OSNAME" == 'ubuntu' ] || [ "$OSNAME" == 'debian' ] ;then
- apt install bison=2.4.1
- if [ "$?" != "0" ]; then
- echo 'The system version is too high to install'
- exit 1
- fi
+# if [ "$OSNAME" == 'ubuntu' ] || [ "$OSNAME" == 'debian' ] ;then
+# apt install bison=2.4.1
+# if [ "$?" != "0" ]; then
+# echo 'The system version is too high to install'
+# exit 1
+# fi
- apt install flex=2.5.4
- if [ "$?" != "0" ]; then
- echo 'The system version is too high to install'
- exit 1
- fi
-fi
+# apt install flex=2.5.4
+# if [ "$?" != "0" ]; then
+# echo 'The system version is too high to install'
+# exit 1
+# fi
+# fi
version=5.2.17
@@ -116,32 +116,26 @@ 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-curl"
fi
if [ ! -d $serverPath/php/${PHP_VER} ];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/
- export MYSQL_LIB_DIR=/usr/lib64/mysql
+ export MYSQL_LIB_DIR=/usr/lib64/mysql
+
cd $sourcePath/php/php${PHP_VER} && ./configure \
--prefix=$serverPath/php/${PHP_VER} \
--exec-prefix=$serverPath/php/${PHP_VER} \
--with-config-file-path=$serverPath/php/${PHP_VER}/etc \
--with-zlib-dir=$serverPath/lib/zlib \
--enable-xml \
- --enable-mysqlnd \
--enable-shared \
--with-mysql=mysqlnd \
--enable-embedded-mysqli=shared \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
- --disable-fileinfo \
$OPTIONS \
--enable-fastcgi \
--enable-fpm
diff --git a/plugins/php/versions/53/install.sh b/plugins/php/versions/53/install.sh
index a948a1ffa..c67009431 100755
--- a/plugins/php/versions/53/install.sh
+++ b/plugins/php/versions/53/install.sh
@@ -48,6 +48,7 @@ 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
@@ -85,7 +86,7 @@ if [ ! -d $serverPath/php/53 ];then
--disable-fileinfo \
$OPTIONS \
--enable-fpm
- make clean && make ${MAKEJN:--j2} && make install && make clean
+ make clean && make && make install && make clean
fi
diff --git a/plugins/php/versions/54/install.sh b/plugins/php/versions/54/install.sh
index c1213fd64..5cff9c5c6 100755
--- a/plugins/php/versions/54/install.sh
+++ b/plugins/php/versions/54/install.sh
@@ -42,6 +42,7 @@ 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
@@ -70,7 +71,7 @@ if [ ! -d $serverPath/php/${PHP_VER} ];then
$OPTIONS \
--enable-fpm
- make clean && make ${MAKEJN:--j2}
+ make clean && make
#debian11,没有生成php54 man
if [ ! -f sapi/cli/php.1 ];then
diff --git a/plugins/php/versions/55/install.sh b/plugins/php/versions/55/install.sh
index b03848920..2025cf53c 100755
--- a/plugins/php/versions/55/install.sh
+++ b/plugins/php/versions/55/install.sh
@@ -41,6 +41,7 @@ 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
@@ -68,7 +69,7 @@ if [ ! -d $serverPath/php/55 ];then
--disable-fileinfo \
$OPTIONS \
--enable-fpm
- make clean && make ${MAKEJN:--j2} && make install && make clean
+ make clean && make && make install && make clean
fi
#------------------------ install end ------------------------------------#
diff --git a/plugins/php/versions/56/install.sh b/plugins/php/versions/56/install.sh
index 046015744..0a86dd34f 100755
--- a/plugins/php/versions/56/install.sh
+++ b/plugins/php/versions/56/install.sh
@@ -41,6 +41,7 @@ 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
@@ -71,7 +72,7 @@ if [ ! -d $serverPath/php/56 ];then
--disable-fileinfo \
$OPTIONS \
--enable-fpm
- make clean && make ${MAKEJN:--j2} && make install && make clean
+ make clean && make && make install && make clean
fi
#------------------------ install end ------------------------------------#
diff --git a/plugins/php/versions/70/install.sh b/plugins/php/versions/70/install.sh
index 75203d880..21a772193 100755
--- a/plugins/php/versions/70/install.sh
+++ b/plugins/php/versions/70/install.sh
@@ -41,6 +41,7 @@ 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
@@ -67,7 +68,7 @@ if [ ! -d $serverPath/php/70 ];then
--disable-fileinfo \
$OPTIONS \
--enable-fpm
- make clean && make ${MAKEJN:--j2} && make install && make clean
+ make clean && make && make install && make clean
fi
#------------------------ install end ------------------------------------#
diff --git a/plugins/php/versions/71/install.sh b/plugins/php/versions/71/install.sh
index 60f315b7d..d1d690fa8 100755
--- a/plugins/php/versions/71/install.sh
+++ b/plugins/php/versions/71/install.sh
@@ -40,6 +40,7 @@ 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
@@ -67,7 +68,7 @@ if [ ! -d $serverPath/php/71 ];then
--disable-fileinfo \
$OPTIONS \
--enable-fpm
- make clean && make ${MAKEJN:--j2} && make install && make clean
+ make clean && make && make install && make clean
fi
#------------------------ install end ------------------------------------#
diff --git a/plugins/php/versions/72/install.sh b/plugins/php/versions/72/install.sh
index ccde35e98..796eb83a4 100755
--- a/plugins/php/versions/72/install.sh
+++ b/plugins/php/versions/72/install.sh
@@ -41,6 +41,7 @@ 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
@@ -68,7 +69,7 @@ if [ ! -d $serverPath/php/72 ];then
--disable-fileinfo \
$OPTIONS \
--enable-fpm
- make clean && make ${MAKEJN:--j2} && make install && make clean
+ make clean && make && make install && make clean
fi
#------------------------ install end ------------------------------------#
diff --git a/plugins/php/versions/73/install.sh b/plugins/php/versions/73/install.sh
index 80a2bf98f..ee80cff87 100755
--- a/plugins/php/versions/73/install.sh
+++ b/plugins/php/versions/73/install.sh
@@ -44,7 +44,8 @@ if [ $sysName == 'Darwin' ]; then
else
OPTIONS="--with-iconv=${serverPath}/lib/libiconv"
OPTIONS="${OPTIONS} --with-freetype-dir=${serverPath}/lib/freetype_old"
- OPTIONS="${OPTIONS} --with-gd"
+ 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
@@ -72,7 +73,7 @@ if [ ! -d $serverPath/php/73 ];then
--disable-fileinfo \
$OPTIONS \
--enable-fpm
- make clean && make ${MAKEJN:--j2} && make install && make clean
+ make clean && make && make install && make clean
fi
#------------------------ install end ------------------------------------#
diff --git a/plugins/php/versions/74/gd.sh b/plugins/php/versions/74/gd.sh
new file mode 100755
index 000000000..b20f69ba2
--- /dev/null
+++ b/plugins/php/versions/74/gd.sh
@@ -0,0 +1,103 @@
+#!/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
+
+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
+
+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
+ ./configure --with-php-config=$serverPath/php/$version/bin/php-config \
+ --enable-gd \
+ --with-webp \
+ --with-xpm \
+ --with-jpeg \
+ --with-freetype \
+ --enable-gd-jis-conv
+
+ 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
+ $serverPath/php/init.d/php$version reload
+ echo '==============================================='
+ echo 'successful!'
+}
+
+
+
+if [ "$actionType" == 'install' ];then
+ Install_lib
+elif [ "$actionType" == 'uninstall' ];then
+ Uninstall_lib
+fi
\ No newline at end of file
diff --git a/plugins/php/versions/74/install.sh b/plugins/php/versions/74/install.sh
index 1163b2816..7629e4f74 100755
--- a/plugins/php/versions/74/install.sh
+++ b/plugins/php/versions/74/install.sh
@@ -80,7 +80,7 @@ if [ ! -d $serverPath/php/${PHP_VER} ];then
--disable-fileinfo \
$OPTIONS \
--enable-fpm
- make ${MAKEJN:--j2} && make install && make clean
+ make && make install && make clean
fi
#------------------------ install end ------------------------------------#
}
diff --git a/plugins/php/versions/80/gd.sh b/plugins/php/versions/80/gd.sh
new file mode 100755
index 000000000..b20f69ba2
--- /dev/null
+++ b/plugins/php/versions/80/gd.sh
@@ -0,0 +1,103 @@
+#!/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
+
+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
+
+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
+ ./configure --with-php-config=$serverPath/php/$version/bin/php-config \
+ --enable-gd \
+ --with-webp \
+ --with-xpm \
+ --with-jpeg \
+ --with-freetype \
+ --enable-gd-jis-conv
+
+ 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
+ $serverPath/php/init.d/php$version reload
+ echo '==============================================='
+ echo 'successful!'
+}
+
+
+
+if [ "$actionType" == 'install' ];then
+ Install_lib
+elif [ "$actionType" == 'uninstall' ];then
+ Uninstall_lib
+fi
\ No newline at end of file
diff --git a/plugins/php/versions/80/install.sh b/plugins/php/versions/80/install.sh
index cae7224d9..5e7b859ed 100755
--- a/plugins/php/versions/80/install.sh
+++ b/plugins/php/versions/80/install.sh
@@ -78,7 +78,7 @@ if [ ! -d $serverPath/php/${PHP_VER} ];then
--disable-fileinfo \
$OPTIONS \
--enable-fpm
- make clean && make ${MAKEJN:--j2} && make install && make clean
+ make clean && make && make install && make clean
fi
#------------------------ install end ------------------------------------#
}
diff --git a/plugins/php/versions/81/gd.sh b/plugins/php/versions/81/gd.sh
new file mode 100755
index 000000000..b20f69ba2
--- /dev/null
+++ b/plugins/php/versions/81/gd.sh
@@ -0,0 +1,103 @@
+#!/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
+
+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
+
+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
+ ./configure --with-php-config=$serverPath/php/$version/bin/php-config \
+ --enable-gd \
+ --with-webp \
+ --with-xpm \
+ --with-jpeg \
+ --with-freetype \
+ --enable-gd-jis-conv
+
+ 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
+ $serverPath/php/init.d/php$version reload
+ echo '==============================================='
+ echo 'successful!'
+}
+
+
+
+if [ "$actionType" == 'install' ];then
+ Install_lib
+elif [ "$actionType" == 'uninstall' ];then
+ Uninstall_lib
+fi
\ No newline at end of file
diff --git a/plugins/php/versions/81/install.sh b/plugins/php/versions/81/install.sh
index 5da41f15d..177ae1d1f 100755
--- a/plugins/php/versions/81/install.sh
+++ b/plugins/php/versions/81/install.sh
@@ -51,7 +51,6 @@ if [ $sysName == 'Darwin' ]; then
else
OPTIONS="--with-iconv=${serverPath}/lib/libiconv"
OPTIONS="${OPTIONS} --with-freetype-dir=${serverPath}/lib/freetype"
- OPTIONS="${OPTIONS} --with-gd"
OPTIONS="${OPTIONS} --with-curl"
OPTIONS="${OPTIONS} --with-libzip=${serverPath}/lib/libzip"
fi
@@ -83,7 +82,7 @@ if [ ! -d $serverPath/php/${PHP_VER} ];then
--disable-fileinfo \
$OPTIONS \
--enable-fpm
- make clean && make ${MAKEJN:--j2} && make install && make clean
+ make clean && make && make install && make clean
fi
#------------------------ install end ------------------------------------#
}
diff --git a/plugins/php/versions/phplib.conf b/plugins/php/versions/phplib.conf
index d8544effc..55fb68527 100755
--- a/plugins/php/versions/phplib.conf
+++ b/plugins/php/versions/phplib.conf
@@ -140,6 +140,19 @@
"shell": "exif.sh",
"check": "exif.so"
},
+ {
+ "name": "gd",
+ "versions": [
+ "52",
+ "74",
+ "80",
+ "81"
+ ],
+ "type": "通用扩展",
+ "msg": "通用GD库!",
+ "shell": "gd.sh",
+ "check": "gd.so"
+ },
{
"name": "intl",
"versions": [
diff --git a/plugins/phpmyadmin/conf/phpmyadmin.conf b/plugins/phpmyadmin/conf/phpmyadmin.conf
index b1e968337..4f32e6c28 100755
--- a/plugins/phpmyadmin/conf/phpmyadmin.conf
+++ b/plugins/phpmyadmin/conf/phpmyadmin.conf
@@ -6,7 +6,7 @@ server
root {$SERVER_PATH}/phpmyadmin;
#error_page 404 /404.html;
- include enable-php-{$PHP_VER}.conf;
+ include {$PHP_CONF_PATH}/enable-php-{$PHP_VER}.conf;
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
diff --git a/plugins/phpmyadmin/index.py b/plugins/phpmyadmin/index.py
index 9483645f4..43e037b0f 100755
--- a/plugins/phpmyadmin/index.py
+++ b/plugins/phpmyadmin/index.py
@@ -98,8 +98,10 @@ def contentReplace(content):
service_path = mw.getServerDir()
php_ver = getCachePhpVer()
# print php_ver
+ php_conf_dir = mw.getServerDir() + '/web_conf/php/conf'
content = content.replace('{$ROOT_PATH}', mw.getRootDir())
content = content.replace('{$SERVER_PATH}', service_path)
+ content = content.replace('{$PHP_CONF_PATH}', php_conf_dir)
content = content.replace('{$PHP_VER}', php_ver)
return content
diff --git a/plugins/redis/install.sh b/plugins/redis/install.sh
index 8404c0e5b..d19ffd750 100755
--- a/plugins/redis/install.sh
+++ b/plugins/redis/install.sh
@@ -28,18 +28,30 @@ Install_redis()
cd redis-${VERSION} && make PREFIX=$serverPath/redis install
sed '/^ *#/d' redis.conf > $serverPath/redis/redis.conf
- echo "${VERSION}" > $serverPath/redis/version.pl
+ if [ -d $serverPath/redis ];then
+ echo "${VERSION}" > $serverPath/redis/version.pl
+ echo '安装完成' > $install_tmp
- echo '安装完成' > $install_tmp
+
+ cd ${rootPath} && python3 ${rootPath}/plugins/redis/index.py start
+ cd ${rootPath} && python3 ${rootPath}/plugins/redis/index.py initd_install
+ fi
}
Uninstall_redis()
{
- rm -rf $serverPath/redis
-
if [ -f /lib/systemd/system/redis.service ];then
+ systemctl stop redis
+ systemctl disable redis
rm -rf /lib/systemd/system/redis.service
+ systemctl daemon-reload
fi
+
+ if [ -f $serverPath/redis/initd/redis ];then
+ $serverPath/redis/initd/redis stop
+ fi
+
+ rm -rf $serverPath/redis
echo "Uninstall_redis" > $install_tmp
}
diff --git a/plugins/rsyncd/install.sh b/plugins/rsyncd/install.sh
index dd09e74a1..a686ab695 100755
--- a/plugins/rsyncd/install.sh
+++ b/plugins/rsyncd/install.sh
@@ -14,13 +14,26 @@ Install_rsyncd()
{
echo '正在安装脚本文件...' > $install_tmp
mkdir -p $serverPath/rsyncd
+
+
echo '1.0' > $serverPath/rsyncd/version.pl
echo '安装完成' > $install_tmp
-
+ cd ${rootPath} && python3 ${rootPath}/plugins/rsyncd/index.py start
+ cd ${rootPath} && python3 ${rootPath}/plugins/rsyncd/index.py initd_install
}
Uninstall_rsyncd()
{
+ if [ -f /lib/systemd/system/rsyncd.service ];then
+ systemctl stop rsyncd
+ systemctl disable rsyncd
+ rm -rf /lib/systemd/system/rsyncd.service
+ systemctl daemon-reload
+ fi
+
+ if [ -f $serverPath/rsyncd/initd/rsyncd ];then
+ $serverPath/rsyncd/initd/rsyncd stop
+ fi
rm -rf $serverPath/rsyncd
echo "卸载完成" > $install_tmp
}
diff --git a/plugins/sphinx/install.sh b/plugins/sphinx/install.sh
index 5dd01b2f0..faa104dc3 100755
--- a/plugins/sphinx/install.sh
+++ b/plugins/sphinx/install.sh
@@ -54,15 +54,29 @@ Install_sphinx()
fi
cd ${SPHINX_DIR} && tar -zxvf sphinx-3.1.1.tar.gz
-
cp -rf ${SPHINX_DIR}/sphinx-3.1.1/ $serverPath/sphinx/bin
- echo '3.1.1' > $serverPath/sphinx/version.pl
- echo '安装完成' > $install_tmp
+ if [ -d $serverPath/sphinx ];then
+ echo '3.1.1' > $serverPath/sphinx/version.pl
+ echo '安装完成' > $install_tmp
+ cd ${rootPath} && python3 ${rootPath}/plugins/sphinx/index.py start
+ cd ${rootPath} && python3 ${rootPath}/plugins/sphinx/index.py initd_install
+ fi
}
Uninstall_sphinx()
{
+ if [ -f /lib/systemd/system/sphinx.service ];then
+ systemctl stop sphinx
+ systemctl disable sphinx
+ rm -rf /lib/systemd/system/sphinx.service
+ systemctl daemon-reload
+ fi
+
+ if [ -f $serverPath/sphinx/initd/sphinx ];then
+ $serverPath/sphinx/initd/sphinx stop
+ fi
+
rm -rf $serverPath/sphinx
echo "Uninstall_sphinx" > $install_tmp
}
diff --git a/plugins/swap/install.sh b/plugins/swap/install.sh
index 0c2215818..bdc5f06d6 100755
--- a/plugins/swap/install.sh
+++ b/plugins/swap/install.sh
@@ -29,16 +29,31 @@ Install_swap()
fi
echo '安装完成' > $install_tmp
+
+ cd ${rootPath} && python3 ${rootPath}/plugins/swap/index.py start
+ cd ${rootPath} && python3 ${rootPath}/plugins/swap/index.py initd_install
}
Uninstall_swap()
{
swapoff $serverPath/swap/swapfile
- rm -rf $serverPath/swap
if [ -f /lib/systemd/system/swap.service ];then
rm -rf /lib/systemd/system/swap.service
fi
+
+ if [ -f /lib/systemd/system/swap.service ];then
+ systemctl stop swap
+ systemctl disable swap
+ rm -rf /lib/systemd/system/swap.service
+ systemctl daemon-reload
+ fi
+
+ if [ -f $serverPath/swap/initd/swap ];then
+ $serverPath/swap/initd/swap stop
+ fi
+
+ rm -rf $serverPath/swap
echo "Uninstall_swap" > $install_tmp
}
diff --git a/route/static/app/site.js b/route/static/app/site.js
index 3e64c0055..c8f62d7b5 100755
--- a/route/static/app/site.js
+++ b/route/static/app/site.js
@@ -922,7 +922,7 @@ function setIndex(id){
//设置默认站点
function setDefaultSite(){
- var name = $("#defaultSite").val();
+ var name = $("#default_site").val();
var loadT = layer.msg('正在处理,请稍候...',{icon:16,time:0,shade: [0.3, '#000']});
$.post('/site/set_default_site','name='+name,function(rdata){
layer.closeAll();
@@ -938,7 +938,7 @@ function getDefaultSite(){
var selected = '';
for(var i=0;i' + rdata.sites[i].name + '';
}
@@ -952,7 +952,7 @@ function getDefaultSite(){
content:'