From fc981cd6b3c4e7beab258425629111e1fd7bd1cc Mon Sep 17 00:00:00 2001 From: midoks Date: Tue, 28 Jun 2022 16:37:06 +0800 Subject: [PATCH 01/26] =?UTF-8?q?=E4=B8=BB=E8=A6=81=E6=B5=8B=E8=AF=95OK?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/python-app-mysql8.yml | 4 +- .github/workflows/python-app-op.yml | 38 ++++++++++++ .github/workflows/python-app-php.yml | 79 +++++++++++++++++++++++++ README.md | 3 +- 4 files changed, 121 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/python-app-op.yml create mode 100644 .github/workflows/python-app-php.yml diff --git a/.github/workflows/python-app-mysql8.yml b/.github/workflows/python-app-mysql8.yml index eae53b1c4..b59884853 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 diff --git a/.github/workflows/python-app-op.yml b/.github/workflows/python-app-op.yml new file mode 100644 index 000000000..c7fbcc3e0 --- /dev/null +++ b/.github/workflows/python-app-op.yml @@ -0,0 +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" ] + 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 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..8892e7fc9 --- /dev/null +++ b/.github/workflows/python-app-php.yml @@ -0,0 +1,79 @@ +# 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: | + export MAKEJN=-j8 + cd /www/server/mdserver-web/plugins/php && sudo bash install.sh install 53 + - name: Install PHP54 + run: | + export MAKEJN=-j8 + cd /www/server/mdserver-web/plugins/php && sudo bash install.sh install 54 + - name: Install PHP55 + run: | + export MAKEJN=-j8 + cd /www/server/mdserver-web/plugins/php && sudo bash install.sh install 55 + - name: Install PHP56 + run: | + export MAKEJN=-j8 + cd /www/server/mdserver-web/plugins/php && sudo bash install.sh install 56 + - name: Install PHP70 + run: | + export MAKEJN=-j8 + cd /www/server/mdserver-web/plugins/php && sudo bash install.sh install 70 + - name: Install PHP71 + run: | + export MAKEJN=-j8 + cd /www/server/mdserver-web/plugins/php && sudo bash install.sh install 71 + - name: Install PHP72 + run: | + export MAKEJN=-j8 + cd /www/server/mdserver-web/plugins/php && sudo bash install.sh install 72 + - name: Install PHP73 + run: | + export MAKEJN=-j8 + cd /www/server/mdserver-web/plugins/php && sudo bash install.sh install 73 + - name: Install PHP74 + run: | + export MAKEJN=-j8 + cd /www/server/mdserver-web/plugins/php && sudo bash install.sh install 74 + - name: Install PHP80 + run: | + export MAKEJN=-j8 + cd /www/server/mdserver-web/plugins/php && sudo bash install.sh install 80 + - name: Install PHP81 + run: | + export MAKEJN=-j8 + 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/README.md b/README.md index 7d742f7f4..fb3397085 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ ### mdserver-web 0.8.6 + 简单的Linux面板,感谢BT.CN写出如此好的web管理软件。我一看到,就知道这是我一直想要的页面化管理方式。 复制了后台管理界面,按照自己想要的方式写了一版。 @@ -18,7 +19,7 @@ 基本上可以使用,后续会继续优化!欢迎提供意见! -- https://t.me/mdserver_web +- 吹水组 - https://t.me/mdserver_web ### 主要插件介绍 From 87ac68563e685cf9b66f0c7db38c157cb0b516aa Mon Sep 17 00:00:00 2001 From: midoks Date: Tue, 28 Jun 2022 16:41:04 +0800 Subject: [PATCH 02/26] Update install.sh --- plugins/mysql/versions/8.0/install.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/plugins/mysql/versions/8.0/install.sh b/plugins/mysql/versions/8.0/install.sh index 5bb23a902..6a29558c0 100755 --- a/plugins/mysql/versions/8.0/install.sh +++ b/plugins/mysql/versions/8.0/install.sh @@ -1,5 +1,3 @@ -export MAKEJN=-j12 - # -*- coding: utf-8 -*- #!/bin/bash From 9d414a21c38d38ed654044cf8d05c36b3ed79821 Mon Sep 17 00:00:00 2001 From: midoks Date: Tue, 28 Jun 2022 16:58:07 +0800 Subject: [PATCH 03/26] up --- .github/workflows/python-app-mysql8.yml | 7 ------- .github/workflows/python-app-php.yml | 11 ----------- 2 files changed, 18 deletions(-) diff --git a/.github/workflows/python-app-mysql8.yml b/.github/workflows/python-app-mysql8.yml index b59884853..ab89330b0 100644 --- a/.github/workflows/python-app-mysql8.yml +++ b/.github/workflows/python-app-mysql8.yml @@ -31,13 +31,6 @@ jobs: sudo bash scripts/install_dev.sh - name: Install MySQL80 run: | - sudo mkdir -p /tmp - sudo echo '' > /tmp/t.log - sudo chmod 777 /www/server/mdserver-web/plugins/mysql/versions/8.0/install.sh - 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-php.yml b/.github/workflows/python-app-php.yml index 8892e7fc9..e92edc482 100644 --- a/.github/workflows/python-app-php.yml +++ b/.github/workflows/python-app-php.yml @@ -31,47 +31,36 @@ jobs: sudo bash scripts/install_dev.sh - name: Install PHP53 run: | - export MAKEJN=-j8 cd /www/server/mdserver-web/plugins/php && sudo bash install.sh install 53 - name: Install PHP54 run: | - export MAKEJN=-j8 cd /www/server/mdserver-web/plugins/php && sudo bash install.sh install 54 - name: Install PHP55 run: | - export MAKEJN=-j8 cd /www/server/mdserver-web/plugins/php && sudo bash install.sh install 55 - name: Install PHP56 run: | - export MAKEJN=-j8 cd /www/server/mdserver-web/plugins/php && sudo bash install.sh install 56 - name: Install PHP70 run: | - export MAKEJN=-j8 cd /www/server/mdserver-web/plugins/php && sudo bash install.sh install 70 - name: Install PHP71 run: | - export MAKEJN=-j8 cd /www/server/mdserver-web/plugins/php && sudo bash install.sh install 71 - name: Install PHP72 run: | - export MAKEJN=-j8 cd /www/server/mdserver-web/plugins/php && sudo bash install.sh install 72 - name: Install PHP73 run: | - export MAKEJN=-j8 cd /www/server/mdserver-web/plugins/php && sudo bash install.sh install 73 - name: Install PHP74 run: | - export MAKEJN=-j8 cd /www/server/mdserver-web/plugins/php && sudo bash install.sh install 74 - name: Install PHP80 run: | - export MAKEJN=-j8 cd /www/server/mdserver-web/plugins/php && sudo bash install.sh install 80 - name: Install PHP81 run: | - export MAKEJN=-j8 cd /www/server/mdserver-web/plugins/php && sudo bash install.sh install 81 - name: Start DEBUG run: | From 905a3a90fb8bff3034a0e329155986379966130d Mon Sep 17 00:00:00 2001 From: midoks Date: Tue, 28 Jun 2022 17:38:49 +0800 Subject: [PATCH 04/26] Update python-app-op.yml --- .github/workflows/python-app-op.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-app-op.yml b/.github/workflows/python-app-op.yml index c7fbcc3e0..53ab5f7fc 100644 --- a/.github/workflows/python-app-op.yml +++ b/.github/workflows/python-app-op.yml @@ -5,9 +5,9 @@ name: MW APP OpenResty on: push: - branches: [ "master" ] + branches: [ "master", "dev" ] pull_request: - branches: [ "master" ] + branches: [ "master", "dev" ] permissions: contents: read From adacc075ca68fea28bda5d28d4175d1ebd343e87 Mon Sep 17 00:00:00 2001 From: midoks Date: Tue, 28 Jun 2022 18:24:59 +0800 Subject: [PATCH 05/26] =?UTF-8?q?php=E7=8A=B6=E6=80=81=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E6=9D=A5=E8=8E=B7=E5=8F=96=E8=BF=90=E8=A1=8C=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/php/index.py | 6 +++++- plugins/php/js/php.js | 8 +++++++- scripts/init.d/mw.tpl | 3 +++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/plugins/php/index.py b/plugins/php/index.py index fe6be8eca..5a0758c00 100755 --- a/plugins/php/index.py +++ b/plugins/php/index.py @@ -537,6 +537,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 +556,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/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 = "
\ \ \ diff --git a/scripts/init.d/mw.tpl b/scripts/init.d/mw.tpl index 016f7af6a..0517c505f 100755 --- a/scripts/init.d/mw.tpl +++ b/scripts/init.d/mw.tpl @@ -184,6 +184,9 @@ case "$1" in 'restart_panel') mw_stop_panel mw_start_panel;; + 'restart_task') + mw_stop_task + mw_start_task;; 'status') mw_status;; 'logs') error_logs;; 'default') From f6f6f55e6ebc932f3d47ba76be00458e999ee240 Mon Sep 17 00:00:00 2001 From: midoks Date: Tue, 28 Jun 2022 20:05:45 +0800 Subject: [PATCH 06/26] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- class/core/files_api.py | 38 ++++++++++++++++++++++---------------- class/core/system_api.py | 6 ++++++ 2 files changed, 28 insertions(+), 16 deletions(-) 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) + task_pid = mw.execShell( + "ps aux | grep 'task.py' | grep -v grep |awk '{print $2}'") -for p in ${arr[@]} -do - kill -9 $p -done - ''') + task_list = task_pid[0].strip().split("\n") + for i in range(len(task_list)): + self.removeTaskRecursion(task_list[i]) - os.system( - 'rm -f ' + name.replace('扫描目录[', '').replace(']', '') + '/scan.pl') 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/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 From fab01ff207d21e7636ac2c83de7d79c896f78977 Mon Sep 17 00:00:00 2001 From: midoks Date: Tue, 28 Jun 2022 20:30:48 +0800 Subject: [PATCH 07/26] =?UTF-8?q?jpeg=20PHP=20=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/php/versions/53/install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/php/versions/53/install.sh b/plugins/php/versions/53/install.sh index a948a1ffa..6138bd418 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" OPTIONS="${OPTIONS} --with-curl" fi From 7ee85af679cb9f438aa2b8fe4788108335975c25 Mon Sep 17 00:00:00 2001 From: midoks Date: Tue, 28 Jun 2022 21:03:09 +0800 Subject: [PATCH 08/26] =?UTF-8?q?gd=20=E5=BA=93=20jpeg=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/php/versions/52/install.sh | 1 + plugins/php/versions/53/install.sh | 2 +- plugins/php/versions/54/install.sh | 1 + plugins/php/versions/55/install.sh | 1 + plugins/php/versions/56/install.sh | 1 + plugins/php/versions/70/install.sh | 1 + plugins/php/versions/71/install.sh | 1 + plugins/php/versions/72/install.sh | 1 + plugins/php/versions/73/install.sh | 3 ++- plugins/php/versions/74/install.sh | 2 ++ scripts/lib.sh | 27 ++++----------------------- 11 files changed, 16 insertions(+), 25 deletions(-) diff --git a/plugins/php/versions/52/install.sh b/plugins/php/versions/52/install.sh index 5b5032c6d..d784433ed 100755 --- a/plugins/php/versions/52/install.sh +++ b/plugins/php/versions/52/install.sh @@ -118,6 +118,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 diff --git a/plugins/php/versions/53/install.sh b/plugins/php/versions/53/install.sh index 6138bd418..48c02a304 100755 --- a/plugins/php/versions/53/install.sh +++ b/plugins/php/versions/53/install.sh @@ -48,7 +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" + OPTIONS="${OPTIONS} --with-jpeg --with-jpeg-dir=/usr/lib" OPTIONS="${OPTIONS} --with-curl" fi diff --git a/plugins/php/versions/54/install.sh b/plugins/php/versions/54/install.sh index c1213fd64..045e74777 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 diff --git a/plugins/php/versions/55/install.sh b/plugins/php/versions/55/install.sh index b03848920..dcbd168be 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 diff --git a/plugins/php/versions/56/install.sh b/plugins/php/versions/56/install.sh index 046015744..36f647dc5 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 diff --git a/plugins/php/versions/70/install.sh b/plugins/php/versions/70/install.sh index 75203d880..e33084488 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 diff --git a/plugins/php/versions/71/install.sh b/plugins/php/versions/71/install.sh index 60f315b7d..8a2e4b22f 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 diff --git a/plugins/php/versions/72/install.sh b/plugins/php/versions/72/install.sh index ccde35e98..45dc63f10 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 diff --git a/plugins/php/versions/73/install.sh b/plugins/php/versions/73/install.sh index 80a2bf98f..d682b7624 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 diff --git a/plugins/php/versions/74/install.sh b/plugins/php/versions/74/install.sh index 1163b2816..6267eca9a 100755 --- a/plugins/php/versions/74/install.sh +++ b/plugins/php/versions/74/install.sh @@ -49,6 +49,8 @@ if [ $sysName == 'Darwin' ]; then export LDFLAGS="-L/usr/local/opt/libxml2/lib" else OPTIONS="--with-iconv=${serverPath}/lib/libiconv" + OPTIONS="${OPTIONS} --with-gd --enable-gd-native-ttf" + OPTIONS="${OPTIONS} --with-jpeg --with-jpeg-dir=/usr/lib" OPTIONS="${OPTIONS} --with-curl" fi diff --git a/scripts/lib.sh b/scripts/lib.sh index 7f4ef69b0..6eb7abfc7 100755 --- a/scripts/lib.sh +++ b/scripts/lib.sh @@ -202,28 +202,6 @@ Install_OpenSSL() echo -e "Install_OpenSSL" >> ${libPath}/lib.pl } -Install_Lib() -{ - if [ -f "/www/server/nginx/sbin/nginx" ] || [ -f "/www/server/apache/bin/httpd" ] || [ -f "/www/server/mysql/bin/mysql" ]; then - return - fi - lockFile='${libPath}/data/mw_lib.lock' - if [ ! -f "${lockFile}" ];then - sed -i "s#SELINUX=enforcing#SELINUX=disabled#" /etc/selinux/config - rpm -e --nodeps mariadb-libs-* - - mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup - rm -f /var/run/yum.pid - 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 openssl openssl-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 pcre pcre-devel vixie-cron crontabs expat-devel readline-devel; - do yum -y install $yumPack;done - - mv /etc/yum.repos.d/epel.repo.backup /etc/yum.repos.d/epel.repo - groupadd www - useradd -s /sbin/nologin -M -g www www - echo 'true' > $lockFile - fi -} - Install_Curl() { @@ -333,11 +311,14 @@ elif [ "$OSNAME" == "ubuntu" ] || [ "$OSNAME" == "debian" ]; then #apt install -y libmariadbclient-dev else + 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 + yum install -y openldap openldap-devel libtirpc libtirpc-devel rpcgen yum install -y bison re2c cmake yum install -y libmemcached libmemcached-devel - yum install -y curl-devel + yum install -y curl curl-devel yum install -y zlib zlib-devel yum install -y libzip libzip-devel yum install -y pcre pcre-devel From aede67baff02b324f2e59cb5f1a1ac08d0b4d1c5 Mon Sep 17 00:00:00 2001 From: midoks Date: Tue, 28 Jun 2022 21:09:52 +0800 Subject: [PATCH 09/26] Update install.sh --- plugins/php/versions/74/install.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/php/versions/74/install.sh b/plugins/php/versions/74/install.sh index 6267eca9a..5718044a5 100755 --- a/plugins/php/versions/74/install.sh +++ b/plugins/php/versions/74/install.sh @@ -49,7 +49,10 @@ if [ $sysName == 'Darwin' ]; then export LDFLAGS="-L/usr/local/opt/libxml2/lib" else OPTIONS="--with-iconv=${serverPath}/lib/libiconv" - OPTIONS="${OPTIONS} --with-gd --enable-gd-native-ttf" + OPTIONS="${OPTIONS} --enable-gd" + OPTIONS="${OPTIONS} --enable-gd-jis-conv" + + OPTIONS="${OPTIONS} --with-webp --with-webp-dir=/usr/lib" OPTIONS="${OPTIONS} --with-jpeg --with-jpeg-dir=/usr/lib" OPTIONS="${OPTIONS} --with-curl" fi From 71abc265e843c69d2d5b9224a1262c2e51f21e80 Mon Sep 17 00:00:00 2001 From: midoks Date: Tue, 28 Jun 2022 21:11:22 +0800 Subject: [PATCH 10/26] =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/python-app-php.yml | 4 ++-- plugins/php/versions/80/install.sh | 4 ++++ plugins/php/versions/81/install.sh | 5 ++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python-app-php.yml b/.github/workflows/python-app-php.yml index e92edc482..fd31a70d1 100644 --- a/.github/workflows/python-app-php.yml +++ b/.github/workflows/python-app-php.yml @@ -5,9 +5,9 @@ name: MW APP PHP on: push: - branches: [ "master" ] + branches: [ "master","dev" ] pull_request: - branches: [ "master" ] + branches: [ "master","dev" ] permissions: contents: read diff --git a/plugins/php/versions/80/install.sh b/plugins/php/versions/80/install.sh index cae7224d9..1579e3372 100755 --- a/plugins/php/versions/80/install.sh +++ b/plugins/php/versions/80/install.sh @@ -49,6 +49,10 @@ if [ $sysName == 'Darwin' ]; then export LDFLAGS="-L/usr/local/opt/libxml2/lib" else OPTIONS="--with-iconv=${serverPath}/lib/libiconv" + OPTIONS="${OPTIONS} --enable-gd" + OPTIONS="${OPTIONS} --enable-gd-jis-conv" + OPTIONS="${OPTIONS} --with-webp --with-webp-dir=/usr/lib" + OPTIONS="${OPTIONS} --with-jpeg --with-jpeg-dir=/usr/lib" OPTIONS="${OPTIONS} --with-curl" fi diff --git a/plugins/php/versions/81/install.sh b/plugins/php/versions/81/install.sh index 5da41f15d..95c4642da 100755 --- a/plugins/php/versions/81/install.sh +++ b/plugins/php/versions/81/install.sh @@ -51,7 +51,10 @@ 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} --enable-gd" + OPTIONS="${OPTIONS} --enable-gd-jis-conv" + OPTIONS="${OPTIONS} --with-webp --with-webp-dir=/usr/lib" + OPTIONS="${OPTIONS} --with-jpeg --with-jpeg-dir=/usr/lib" OPTIONS="${OPTIONS} --with-curl" OPTIONS="${OPTIONS} --with-libzip=${serverPath}/lib/libzip" fi From 67d14f1fdd9eb882d152edc6a29d3c368f40e847 Mon Sep 17 00:00:00 2001 From: midoks Date: Tue, 28 Jun 2022 22:01:56 +0800 Subject: [PATCH 11/26] Update install.sh --- plugins/php/versions/52/install.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/plugins/php/versions/52/install.sh b/plugins/php/versions/52/install.sh index d784433ed..4ad4443b3 100755 --- a/plugins/php/versions/52/install.sh +++ b/plugins/php/versions/52/install.sh @@ -118,7 +118,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-jpeg-dir=/usr/lib" OPTIONS="${OPTIONS} --with-curl" fi @@ -135,14 +135,12 @@ if [ ! -d $serverPath/php/${PHP_VER} ];then --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 From 61ebc249ac3fccc6e698acaa4606cc5688e78c31 Mon Sep 17 00:00:00 2001 From: midoks Date: Tue, 28 Jun 2022 22:07:59 +0800 Subject: [PATCH 12/26] up --- plugins/php/versions/53/install.sh | 2 +- plugins/php/versions/54/install.sh | 2 +- plugins/php/versions/55/install.sh | 2 +- plugins/php/versions/56/install.sh | 2 +- plugins/php/versions/70/install.sh | 2 +- plugins/php/versions/71/install.sh | 2 +- plugins/php/versions/72/install.sh | 2 +- plugins/php/versions/73/install.sh | 2 +- plugins/php/versions/74/install.sh | 2 +- plugins/php/versions/80/install.sh | 2 +- plugins/php/versions/81/install.sh | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/plugins/php/versions/53/install.sh b/plugins/php/versions/53/install.sh index 48c02a304..c67009431 100755 --- a/plugins/php/versions/53/install.sh +++ b/plugins/php/versions/53/install.sh @@ -86,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 045e74777..5cff9c5c6 100755 --- a/plugins/php/versions/54/install.sh +++ b/plugins/php/versions/54/install.sh @@ -71,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 dcbd168be..2025cf53c 100755 --- a/plugins/php/versions/55/install.sh +++ b/plugins/php/versions/55/install.sh @@ -69,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 36f647dc5..0a86dd34f 100755 --- a/plugins/php/versions/56/install.sh +++ b/plugins/php/versions/56/install.sh @@ -72,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 e33084488..21a772193 100755 --- a/plugins/php/versions/70/install.sh +++ b/plugins/php/versions/70/install.sh @@ -68,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 8a2e4b22f..d1d690fa8 100755 --- a/plugins/php/versions/71/install.sh +++ b/plugins/php/versions/71/install.sh @@ -68,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 45dc63f10..796eb83a4 100755 --- a/plugins/php/versions/72/install.sh +++ b/plugins/php/versions/72/install.sh @@ -69,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 d682b7624..ee80cff87 100755 --- a/plugins/php/versions/73/install.sh +++ b/plugins/php/versions/73/install.sh @@ -73,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/install.sh b/plugins/php/versions/74/install.sh index 5718044a5..8fd8fa592 100755 --- a/plugins/php/versions/74/install.sh +++ b/plugins/php/versions/74/install.sh @@ -85,7 +85,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/install.sh b/plugins/php/versions/80/install.sh index 1579e3372..0111883db 100755 --- a/plugins/php/versions/80/install.sh +++ b/plugins/php/versions/80/install.sh @@ -82,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/81/install.sh b/plugins/php/versions/81/install.sh index 95c4642da..83a9dd075 100755 --- a/plugins/php/versions/81/install.sh +++ b/plugins/php/versions/81/install.sh @@ -86,7 +86,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 ------------------------------------# } From 3f4a120170dcaefc501aa78c8388958c19d82d36 Mon Sep 17 00:00:00 2001 From: midoks Date: Tue, 28 Jun 2022 22:20:46 +0800 Subject: [PATCH 13/26] =?UTF-8?q?php74=E4=B9=8B=E5=90=8E=EF=BC=8Cgd?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E7=9B=B4=E6=8E=A5=E5=AE=89=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/php/versions/74/gd.sh | 102 +++++++++++++++++++++++++++++ plugins/php/versions/74/install.sh | 5 -- plugins/php/versions/80/gd.sh | 102 +++++++++++++++++++++++++++++ plugins/php/versions/80/install.sh | 4 -- plugins/php/versions/81/gd.sh | 102 +++++++++++++++++++++++++++++ plugins/php/versions/81/install.sh | 4 -- plugins/php/versions/phplib.conf | 12 ++++ 7 files changed, 318 insertions(+), 13 deletions(-) create mode 100755 plugins/php/versions/74/gd.sh create mode 100755 plugins/php/versions/80/gd.sh create mode 100755 plugins/php/versions/81/gd.sh diff --git a/plugins/php/versions/74/gd.sh b/plugins/php/versions/74/gd.sh new file mode 100755 index 000000000..5b407628e --- /dev/null +++ b/plugins/php/versions/74/gd.sh @@ -0,0 +1,102 @@ +#!/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-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 reload + 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 8fd8fa592..7629e4f74 100755 --- a/plugins/php/versions/74/install.sh +++ b/plugins/php/versions/74/install.sh @@ -49,11 +49,6 @@ if [ $sysName == 'Darwin' ]; then export LDFLAGS="-L/usr/local/opt/libxml2/lib" else OPTIONS="--with-iconv=${serverPath}/lib/libiconv" - OPTIONS="${OPTIONS} --enable-gd" - OPTIONS="${OPTIONS} --enable-gd-jis-conv" - - OPTIONS="${OPTIONS} --with-webp --with-webp-dir=/usr/lib" - OPTIONS="${OPTIONS} --with-jpeg --with-jpeg-dir=/usr/lib" OPTIONS="${OPTIONS} --with-curl" fi diff --git a/plugins/php/versions/80/gd.sh b/plugins/php/versions/80/gd.sh new file mode 100755 index 000000000..5b407628e --- /dev/null +++ b/plugins/php/versions/80/gd.sh @@ -0,0 +1,102 @@ +#!/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-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 reload + 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 0111883db..5e7b859ed 100755 --- a/plugins/php/versions/80/install.sh +++ b/plugins/php/versions/80/install.sh @@ -49,10 +49,6 @@ if [ $sysName == 'Darwin' ]; then export LDFLAGS="-L/usr/local/opt/libxml2/lib" else OPTIONS="--with-iconv=${serverPath}/lib/libiconv" - OPTIONS="${OPTIONS} --enable-gd" - OPTIONS="${OPTIONS} --enable-gd-jis-conv" - OPTIONS="${OPTIONS} --with-webp --with-webp-dir=/usr/lib" - OPTIONS="${OPTIONS} --with-jpeg --with-jpeg-dir=/usr/lib" OPTIONS="${OPTIONS} --with-curl" fi diff --git a/plugins/php/versions/81/gd.sh b/plugins/php/versions/81/gd.sh new file mode 100755 index 000000000..5b407628e --- /dev/null +++ b/plugins/php/versions/81/gd.sh @@ -0,0 +1,102 @@ +#!/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-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 reload + 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 83a9dd075..177ae1d1f 100755 --- a/plugins/php/versions/81/install.sh +++ b/plugins/php/versions/81/install.sh @@ -51,10 +51,6 @@ if [ $sysName == 'Darwin' ]; then else OPTIONS="--with-iconv=${serverPath}/lib/libiconv" OPTIONS="${OPTIONS} --with-freetype-dir=${serverPath}/lib/freetype" - OPTIONS="${OPTIONS} --enable-gd" - OPTIONS="${OPTIONS} --enable-gd-jis-conv" - OPTIONS="${OPTIONS} --with-webp --with-webp-dir=/usr/lib" - OPTIONS="${OPTIONS} --with-jpeg --with-jpeg-dir=/usr/lib" OPTIONS="${OPTIONS} --with-curl" OPTIONS="${OPTIONS} --with-libzip=${serverPath}/lib/libzip" fi diff --git a/plugins/php/versions/phplib.conf b/plugins/php/versions/phplib.conf index d8544effc..2f68212ce 100755 --- a/plugins/php/versions/phplib.conf +++ b/plugins/php/versions/phplib.conf @@ -140,6 +140,18 @@ "shell": "exif.sh", "check": "exif.so" }, + { + "name": "gd", + "versions": [ + "74", + "80", + "81" + ], + "type": "通用扩展", + "msg": "通用GD库!", + "shell": "gd.sh", + "check": "gd.so" + }, { "name": "intl", "versions": [ From 036ebb33efa4387ef23c4c3c8ec4e030e8a9e9c9 Mon Sep 17 00:00:00 2001 From: midoks Date: Tue, 28 Jun 2022 22:48:29 +0800 Subject: [PATCH 14/26] up --- plugins/php/versions/74/gd.sh | 5 +++-- plugins/php/versions/80/gd.sh | 5 +++-- plugins/php/versions/81/gd.sh | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/plugins/php/versions/74/gd.sh b/plugins/php/versions/74/gd.sh index 5b407628e..b20f69ba2 100755 --- a/plugins/php/versions/74/gd.sh +++ b/plugins/php/versions/74/gd.sh @@ -49,9 +49,10 @@ Install_lib() --enable-gd \ --with-webp \ --with-xpm \ + --with-jpeg \ --with-freetype \ --enable-gd-jis-conv - + make clean && make && make install && make clean fi @@ -65,7 +66,7 @@ Install_lib() echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini - $serverPath/php/init.d/php$version reload + $serverPath/php/init.d/php${version} restart echo '===========================================================' echo 'successful!' } diff --git a/plugins/php/versions/80/gd.sh b/plugins/php/versions/80/gd.sh index 5b407628e..b20f69ba2 100755 --- a/plugins/php/versions/80/gd.sh +++ b/plugins/php/versions/80/gd.sh @@ -49,9 +49,10 @@ Install_lib() --enable-gd \ --with-webp \ --with-xpm \ + --with-jpeg \ --with-freetype \ --enable-gd-jis-conv - + make clean && make && make install && make clean fi @@ -65,7 +66,7 @@ Install_lib() echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini - $serverPath/php/init.d/php$version reload + $serverPath/php/init.d/php${version} restart echo '===========================================================' echo 'successful!' } diff --git a/plugins/php/versions/81/gd.sh b/plugins/php/versions/81/gd.sh index 5b407628e..b20f69ba2 100755 --- a/plugins/php/versions/81/gd.sh +++ b/plugins/php/versions/81/gd.sh @@ -49,9 +49,10 @@ Install_lib() --enable-gd \ --with-webp \ --with-xpm \ + --with-jpeg \ --with-freetype \ --enable-gd-jis-conv - + make clean && make && make install && make clean fi @@ -65,7 +66,7 @@ Install_lib() echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini - $serverPath/php/init.d/php$version reload + $serverPath/php/init.d/php${version} restart echo '===========================================================' echo 'successful!' } From 5162362d0a42617aaaa6acf0e9814330c22c48f4 Mon Sep 17 00:00:00 2001 From: midoks Date: Tue, 28 Jun 2022 22:57:34 +0800 Subject: [PATCH 15/26] up --- plugins/php/versions/52/gd.sh | 107 +++++++++++++++++++++++++++++ plugins/php/versions/52/install.sh | 9 +-- plugins/php/versions/phplib.conf | 1 + 3 files changed, 110 insertions(+), 7 deletions(-) create mode 100755 plugins/php/versions/52/gd.sh 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 4ad4443b3..cca6de044 100755 --- a/plugins/php/versions/52/install.sh +++ b/plugins/php/versions/52/install.sh @@ -116,19 +116,14 @@ 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-dir=/usr/lib" 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} \ diff --git a/plugins/php/versions/phplib.conf b/plugins/php/versions/phplib.conf index 2f68212ce..55fb68527 100755 --- a/plugins/php/versions/phplib.conf +++ b/plugins/php/versions/phplib.conf @@ -143,6 +143,7 @@ { "name": "gd", "versions": [ + "52", "74", "80", "81" From f54cba80f6b39e80775365f37e50ab4bf1e98a7c Mon Sep 17 00:00:00 2001 From: midoks Date: Tue, 28 Jun 2022 22:58:10 +0800 Subject: [PATCH 16/26] Update install.sh --- plugins/php/versions/52/install.sh | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/plugins/php/versions/52/install.sh b/plugins/php/versions/52/install.sh index cca6de044..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 From ffd22d384b2e8bfc012102297a4a08dae6597815 Mon Sep 17 00:00:00 2001 From: midoks Date: Wed, 29 Jun 2022 00:39:10 +0800 Subject: [PATCH 17/26] =?UTF-8?q?openresty=E5=92=8Cphp=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=88=86=E7=A6=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- class/core/site_api.py | 1 + data/tpl/nginx.conf | 2 +- plugins/openresty/conf/nginx.conf | 2 +- plugins/php/conf/enable-php.conf | 2 +- plugins/php/index.py | 70 +++++++++++++++---------- plugins/phpmyadmin/conf/phpmyadmin.conf | 2 +- plugins/phpmyadmin/index.py | 2 + 7 files changed, 48 insertions(+), 33 deletions(-) diff --git a/class/core/site_api.py b/class/core/site_api.py index 109e7a5e9..c2a646885 100755 --- a/class/core/site_api.py +++ b/class/core/site_api.py @@ -1660,6 +1660,7 @@ class site_api: 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/data/tpl/nginx.conf b/data/tpl/nginx.conf index ac97996bd..246831f69 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/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/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 5a0758c00..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) + sdir = mw.getServerDir() - # 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() + 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): 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 From c68043a1248e6effb8208f68a39aea0fdd2f508b Mon Sep 17 00:00:00 2001 From: midoks Date: Wed, 29 Jun 2022 00:42:16 +0800 Subject: [PATCH 18/26] up --- plugins/openresty/index.py | 5 ++++- plugins/openresty/install.sh | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/openresty/index.py b/plugins/openresty/index.py index 80bc3e3ea..dfb88ee73 100755 --- a/plugins/openresty/index.py +++ b/plugins/openresty/index.py @@ -136,7 +136,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, '') diff --git a/plugins/openresty/install.sh b/plugins/openresty/install.sh index 627e70cfb..564a40236 100755 --- a/plugins/openresty/install.sh +++ b/plugins/openresty/install.sh @@ -49,7 +49,7 @@ 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 fi echo '安装完成' > $install_tmp } From 854d1de54a879e38e64841b6ca7ff4f838f8693d Mon Sep 17 00:00:00 2001 From: midoks Date: Wed, 29 Jun 2022 01:07:25 +0800 Subject: [PATCH 19/26] Update install.sh --- plugins/openresty/install.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/plugins/openresty/install.sh b/plugins/openresty/install.sh index 564a40236..cf9ed6f59 100755 --- a/plugins/openresty/install.sh +++ b/plugins/openresty/install.sh @@ -50,17 +50,27 @@ Install_openresty() if [ -d $serverPath/openresty ];then echo "${VERSION}" > $serverPath/openresty/version.pl echo "" > $serverPath/web_conf/php/conf/enable-php-00.conf + + #初始化 + cd ${rootPath} && python3 ${rootPath}/plugins/openresty/index.py start ${VERSION} + cd ${rootPath} && python3 ${rootPath}/plugins/openresty/index.py initd_install ${VERSION} fi echo '安装完成' > $install_tmp } Uninstall_openresty() { - rm -rf $serverPath/openresty - + + if [ -f $serverPath/openresty/init.d/openresty ];then + $serverPath/openresty/init.d/openresty stop + fi + if [ -f /lib/systemd/system/openresty.service ];then + systemctl stop openresty rm -rf /lib/systemd/system/openresty.service fi + + rm -rf $serverPath/openresty echo '卸载完成' > $install_tmp } From 3b134ec2c1c0ce55c617ebb4dfc8a7c50a0e9084 Mon Sep 17 00:00:00 2001 From: midoks Date: Wed, 29 Jun 2022 01:13:33 +0800 Subject: [PATCH 20/26] Update install.sh --- plugins/php/install.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/plugins/php/install.sh b/plugins/php/install.sh index 421755f23..2d5b91228 100755 --- a/plugins/php/install.sh +++ b/plugins/php/install.sh @@ -31,4 +31,18 @@ if [ ! -d $curPath/versions/$2 ];then exit 0 fi +if [ "${action}" == "uninstall" ];then + #初始化 + cd ${rootPath} && python3 ${rootPath}/plugins/php/index.py stop ${type} + cd ${rootPath} && python3 ${rootPath}/plugins/php/index.py initd_uninstall ${type} +fi + 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 + + From 22c1de89684db95d7b6541f4147430c6946350de Mon Sep 17 00:00:00 2001 From: midoks Date: Wed, 29 Jun 2022 01:31:34 +0800 Subject: [PATCH 21/26] Update install.sh --- plugins/openresty/install.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/plugins/openresty/install.sh b/plugins/openresty/install.sh index cf9ed6f59..5b597593d 100755 --- a/plugins/openresty/install.sh +++ b/plugins/openresty/install.sh @@ -52,8 +52,8 @@ Install_openresty() echo "" > $serverPath/web_conf/php/conf/enable-php-00.conf #初始化 - cd ${rootPath} && python3 ${rootPath}/plugins/openresty/index.py start ${VERSION} - cd ${rootPath} && python3 ${rootPath}/plugins/openresty/index.py initd_install ${VERSION} + cd ${rootPath} && python3 ${rootPath}/plugins/openresty/index.py start + cd ${rootPath} && python3 ${rootPath}/plugins/openresty/index.py initd_install fi echo '安装完成' > $install_tmp } @@ -61,13 +61,14 @@ Install_openresty() Uninstall_openresty() { - if [ -f $serverPath/openresty/init.d/openresty ];then - $serverPath/openresty/init.d/openresty stop - fi - 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 From 32b5ac504956a28401a77ecb4f75e9a0a72d595c Mon Sep 17 00:00:00 2001 From: midoks Date: Wed, 29 Jun 2022 01:35:32 +0800 Subject: [PATCH 22/26] up --- scripts/install/alma.sh | 3 +++ scripts/install/centos.sh | 6 +++++- scripts/install/fedora.sh | 3 ++- scripts/install/rocky.sh | 2 ++ scripts/lib.sh | 3 --- 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/scripts/install/alma.sh b/scripts/install/alma.sh index 9433fada6..456a3aedd 100755 --- a/scripts/install/alma.sh +++ b/scripts/install/alma.sh @@ -77,6 +77,9 @@ dnf install -y lsof net-tools dnf install -y ncurses-devel cmake dnf --enablerepo=crb install mysql-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 + cd /www/server/mdserver-web/scripts && bash lib.sh chmod 755 /www/server/mdserver-web/data diff --git a/scripts/install/centos.sh b/scripts/install/centos.sh index 8ff332f97..f89e07879 100755 --- a/scripts/install/centos.sh +++ b/scripts/install/centos.sh @@ -83,7 +83,11 @@ yum install -y python-imaging libicu-devel zip bzip2-devel gcc libxml2 libxml2-d yum install -y libjpeg-devel libpng-devel libwebp libwebp-devel yum install -y lsof net-tools yum install -y ncurses-devel cmake -yum install -y MySQL-python +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 cd /www/server/mdserver-web/scripts && bash lib.sh diff --git a/scripts/install/fedora.sh b/scripts/install/fedora.sh index 783138b88..9a17c3479 100644 --- a/scripts/install/fedora.sh +++ b/scripts/install/fedora.sh @@ -78,7 +78,8 @@ yum -y install python-devel yum -y install MySQL-python 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 cd /www/server/mdserver-web/scripts && bash lib.sh chmod 755 /www/server/mdserver-web/data diff --git a/scripts/install/rocky.sh b/scripts/install/rocky.sh index b86d48ea2..8355a4d66 100644 --- a/scripts/install/rocky.sh +++ b/scripts/install/rocky.sh @@ -76,6 +76,8 @@ 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 cd /www/server/mdserver-web/scripts && bash lib.sh chmod 755 /www/server/mdserver-web/data diff --git a/scripts/lib.sh b/scripts/lib.sh index 6eb7abfc7..78e8799f2 100755 --- a/scripts/lib.sh +++ b/scripts/lib.sh @@ -311,9 +311,6 @@ elif [ "$OSNAME" == "ubuntu" ] || [ "$OSNAME" == "debian" ]; then #apt install -y libmariadbclient-dev else - 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 - yum install -y openldap openldap-devel libtirpc libtirpc-devel rpcgen yum install -y bison re2c cmake From fcbecaef0eec585e72d3d8526cf8679f58959df5 Mon Sep 17 00:00:00 2001 From: midoks Date: Wed, 29 Jun 2022 01:39:03 +0800 Subject: [PATCH 23/26] Update install.sh --- plugins/php/install.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/php/install.sh b/plugins/php/install.sh index 2d5b91228..4da953e61 100755 --- a/plugins/php/install.sh +++ b/plugins/php/install.sh @@ -35,6 +35,12 @@ if [ "${action}" == "uninstall" ];then #初始化 cd ${rootPath} && python3 ${rootPath}/plugins/php/index.py stop ${type} cd ${rootPath} && python3 ${rootPath}/plugins/php/index.py initd_uninstall ${type} + + if [ -f /lib/systemd/system/php${type}.service ];then + systemctl stop php${type} + rm -rf /lib/systemd/system/php${type}.service + systemctl daemon-reload + fi fi sh -x $curPath/versions/$2/install.sh $1 From e1f9bcd9e8c9b38bdedfb571a586032b98af884a Mon Sep 17 00:00:00 2001 From: midoks Date: Wed, 29 Jun 2022 01:43:43 +0800 Subject: [PATCH 24/26] Update python-app-php.yml --- .github/workflows/python-app-php.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-app-php.yml b/.github/workflows/python-app-php.yml index fd31a70d1..e92edc482 100644 --- a/.github/workflows/python-app-php.yml +++ b/.github/workflows/python-app-php.yml @@ -5,9 +5,9 @@ name: MW APP PHP on: push: - branches: [ "master","dev" ] + branches: [ "master" ] pull_request: - branches: [ "master","dev" ] + branches: [ "master" ] permissions: contents: read From e8da5af6732308370e7e6e82c7a80a1689b5aa5c Mon Sep 17 00:00:00 2001 From: midoks Date: Wed, 29 Jun 2022 01:57:06 +0800 Subject: [PATCH 25/26] Update install.sh --- plugins/php/install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/php/install.sh b/plugins/php/install.sh index 4da953e61..564da5f0d 100755 --- a/plugins/php/install.sh +++ b/plugins/php/install.sh @@ -43,9 +43,9 @@ if [ "${action}" == "uninstall" ];then fi fi -sh -x $curPath/versions/$2/install.sh $1 +cd ${curPath} && sh -x $curPath/versions/$2/install.sh $1 -if [ "${action}" =="install" ];then +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} From ccc31de2d2b5d545e9352b1f2d0127672621a6c2 Mon Sep 17 00:00:00 2001 From: midoks Date: Wed, 29 Jun 2022 02:22:43 +0800 Subject: [PATCH 26/26] =?UTF-8?q?openresty=E4=B8=B0=E5=AF=8C=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E4=BF=A1=E6=81=AF=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/openresty/index.py | 6 ++++++ plugins/openresty/js/openresty.js | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/plugins/openresty/index.py b/plugins/openresty/index.py index dfb88ee73..67d905fc8 100755 --- a/plugins/openresty/index.py +++ b/plugins/openresty/index.py @@ -209,6 +209,12 @@ def status(): def restyOp(method): file = initDreplace() + # 启动时,先检查一下配置文件 + check = getServerDir() + "/bin/openresty -t" + check_data = mw.execShell(check) + if check_data[1].find('test failed') != -1: + return check_data[1] + if not mw.isAppleSystem(): data = mw.execShell('systemctl ' + method + ' openresty') if data[1] == '': 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});
应用池(pool)" + rdata.pool + "
进程管理方式(process manager)" + ((rdata['process manager'] == 'dynamic') ? '动态' : '静态') + "