From 5dc6b1ec30c3c4c60c2f2642eac792b634e3618c Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Mon, 14 Nov 2022 15:15:04 +0100 Subject: [PATCH 01/12] Prompt user before WordOps update --- wo/cli/plugins/update.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/wo/cli/plugins/update.py b/wo/cli/plugins/update.py index 7991e7b..e8acd8e 100644 --- a/wo/cli/plugins/update.py +++ b/wo/cli/plugins/update.py @@ -59,6 +59,7 @@ class WOUpdateController(CementBaseController): install_args = install_args + "--travis " wo_branch = "updating-configuration" + # check if WordOps already up-to-date if ((not pargs.force) and (not pargs.travis) and (not pargs.mainline) and (not pargs.beta) and (not pargs.branch)): @@ -70,6 +71,17 @@ class WOUpdateController(CementBaseController): .format(wo_latest)) self.app.close(0) + # prompt user before starting upgrade + if not pargs.force: + Log.info( + self, "WordOps changelog available on " + "https://github.com/WordOps/WordOps/releases/tag/{0}" + .format(wo_latest)) + start_upgrade = input("Do you want to continue:[y/N]") + if start_upgrade not in ("Y", "y"): + Log.error(self, "Not starting WordOps update") + + # download the install/update script if not os.path.isdir('/var/lib/wo/tmp'): os.makedirs('/var/lib/wo/tmp') WODownload.download(self, [["https://raw.githubusercontent.com/" @@ -78,6 +90,7 @@ class WOUpdateController(CementBaseController): "/var/lib/wo/tmp/{0}".format(filename), "update script"]]) + # launch install script if os.path.isfile('install'): Log.info(self, "updating WordOps from local install\n") try: From 346d571f3ca836225b29dcbfdeb2347bcdce8d95 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Mon, 14 Nov 2022 15:58:43 +0100 Subject: [PATCH 02/12] Bump wo_version for testing --- install | 2 +- setup.py | 2 +- wo/core/variables.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/install b/install index 7ffec74..ea25b83 100755 --- a/install +++ b/install @@ -9,7 +9,7 @@ # ------------------------------------------------------------------------- # wget -qO wo wops.cc && sudo -E bash wo # ------------------------------------------------------------------------- -# Version 3.15.4 - 2022-10-25 +# Version 3.16.0 - 2022-11-14 # ------------------------------------------------------------------------- # CONTENTS diff --git a/setup.py b/setup.py index 6a84e55..82a1921 100644 --- a/setup.py +++ b/setup.py @@ -27,7 +27,7 @@ if os.geteuid() == 0: os.makedirs('/var/lib/wo/tmp/') setup(name='wordops', - version='3.15.4', + version='3.16.0', description='An essential toolset that eases server administration', long_description=LONG, long_description_content_type='text/markdown', diff --git a/wo/core/variables.py b/wo/core/variables.py index 4b426ec..0d1cb07 100644 --- a/wo/core/variables.py +++ b/wo/core/variables.py @@ -15,7 +15,7 @@ class WOVar(): """Intialization of core variables""" # WordOps version - wo_version = "3.15.4" + wo_version = "3.16.0" # WordOps packages versions wo_wp_cli = "2.7.1" wo_adminer = "4.8.1" From 9053395423739c4ebf25dc0103d965dc026017bc Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Mon, 14 Nov 2022 16:02:06 +0100 Subject: [PATCH 03/12] Bump requests and psutil version --- requirements.txt | 4 ++-- setup.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/requirements.txt b/requirements.txt index 8ddf642..bb8c872 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,10 +1,10 @@ cement==2.10.12 pynginxconfig>=0.3.4 PyMySQL>=0.10.1 -psutil>=5.7.3 +psutil>=5.9.4 sh>=1.14.1 SQLAlchemy>=1.3.20 -requests>=2.24.0 +requests>=2.28.1 distro>=1.7.0 argcomplete>=1.12.0 colorlog>=4.6.2 diff --git a/setup.py b/setup.py index 82a1921..1f22705 100644 --- a/setup.py +++ b/setup.py @@ -65,10 +65,10 @@ setup(name='wordops', 'pystache >= 0.5.4', 'pynginxconfig >= 0.3.4', 'PyMySQL >= 0.10.1', - 'psutil >= 5.7.3', + 'psutil >= 5.9.4', 'sh >= 1.14.1', 'SQLAlchemy >= 1.3.20', - 'requests >= 2.24.0', + 'requests >= 2.28.1', 'distro >= 1.7.0', 'argcomplete >= 1.12.0', 'colorlog >= 4.6.2', From 920cc18f277e6d1a81e5a8ab54efcdd616fe4633 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Tue, 22 Nov 2022 21:22:09 +0100 Subject: [PATCH 04/12] Fix psutil upgrade --- install | 1 + requirements.txt | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/install b/install index ea25b83..8b8db81 100755 --- a/install +++ b/install @@ -445,6 +445,7 @@ wo_install() { python3 -m pip uninstall setuptools -y python3 -m pip install -I setuptools==57.5.0 python3 -m pip install -U pip wheel + python3 -m pip uninstall psutil else rm -rf /opt/wo python3 -m venv /opt/wo diff --git a/requirements.txt b/requirements.txt index bb8c872..4bed5cd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,7 @@ cement==2.10.12 pynginxconfig>=0.3.4 PyMySQL>=0.10.1 psutil>=5.9.4 -sh>=1.14.1 +sh>=1.14.3 SQLAlchemy>=1.3.20 requests>=2.28.1 distro>=1.7.0 diff --git a/setup.py b/setup.py index 1f22705..7b9d3c3 100644 --- a/setup.py +++ b/setup.py @@ -66,7 +66,7 @@ setup(name='wordops', 'pynginxconfig >= 0.3.4', 'PyMySQL >= 0.10.1', 'psutil >= 5.9.4', - 'sh >= 1.14.1', + 'sh >= 1.14.3', 'SQLAlchemy >= 1.3.20', 'requests >= 2.28.1', 'distro >= 1.7.0', From a76d76ce5f366c238e5dea453c66cffb6b3a69d9 Mon Sep 17 00:00:00 2001 From: Janio Sarmento Date: Sat, 10 Dec 2022 10:37:20 -0300 Subject: [PATCH 05/12] #482: Add PHP 8.2 to WO --- README.md | 10 +- config/bash_completion.d/wo_auto.rc | 30 ++--- tests/travis.sh | 31 ++++- wo/cli/plugins/info.py | 100 +++++++++++++++- wo/cli/plugins/site_functions.py | 74 +++++++++--- wo/cli/plugins/stack.py | 93 ++++++++++++--- wo/cli/plugins/stack_pref.py | 179 +++++++++++++++++++++++++++- wo/cli/plugins/stack_services.py | 64 ++++++++-- wo/cli/plugins/stack_upgrade.py | 14 ++- wo/cli/templates/upstream.mustache | 23 +++- wo/core/services.py | 4 +- wo/core/variables.py | 3 + 12 files changed, 556 insertions(+), 69 deletions(-) diff --git a/README.md b/README.md index a837665..15aa1d6 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ - **Easy to install** : One step automated installer with migration from EasyEngine v3 support - **Fast deployment** : Fast and automated WordPress, Nginx, PHP, MySQL & Redis installation - **Custom Nginx build** : Nginx 1.22.1 - TLS v1.3 Cloudflare HTTP/2 HPACK & Brotli support -- **Up-to-date** : PHP 7.2, 7.3, 7.4, 8.0 & 8.1 - MariaDB 10.6 & Redis 7.0 +- **Up-to-date** : PHP 7.2, 7.3, 7.4, 8.0, 8.1 & 8.2 - MariaDB 10.6 & Redis 7.0 - **Secured** : Hardened WordPress security with strict Nginx location directives - **Powerful** : Optimized Nginx configurations with multiple cache backends support - **SSL** : Domain, Subdomain & Wildcard Let's Encrypt SSL certificates with DNS API support @@ -87,8 +87,8 @@ Detailed Getting Started guide with additional installation methods can be found ### Standard WordPress sites ```bash -wo site create example.com --wp # install wordpress with PHP 8.0 without any page caching -wo site create example.com --wp --php81 # install wordpress with PHP 8.1 without any page caching +wo site create example.com --wp # install wordpress with PHP 8.1 without any page caching +wo site create example.com --wp --php82 # install wordpress with PHP 8.2 without any page caching wo site create example.com --wpfc # install wordpress + nginx fastcgi_cache wo site create example.com --wpredis # install wordpress + nginx redis_cache wo site create example.com --wprocket # install wordpress with WP-Rocket plugin @@ -125,7 +125,8 @@ wo site create example.com --html # create example.com for static/html sites wo site create example.com --php # create example.com with php 8.0 support wo site create example.com --php80 # create example.com with php 8.0 support wo site create example.com --php81 # create example.com with php 8.1 support -wo site create example.com --mysql # create example.com with php 8.0 & mysql support +wo site create example.com --php82 # create example.com with php 8.1 support +wo site create example.com --mysql # create example.com with php 8.1 & mysql support wo site create example.com --mysql --php81 # create example.com with php 8.1 & mysql support wo site create example.com --proxy=127.0.0.1:3000 # create example.com with nginx as reverse-proxy ``` @@ -138,6 +139,7 @@ wo site update example.com --php73 # switch to PHP 7.3 wo site update example.com --php74 # switch to PHP 7.4 wo site update example.com --php80 # switch to PHP 8.0 wo site update example.com --php81 # switch to PHP 8.1 +wo site update example.com --php82 # switch to PHP 8.2 ``` ### Sites secured with Let's Encrypt diff --git a/config/bash_completion.d/wo_auto.rc b/config/bash_completion.d/wo_auto.rc index 4f71ed4..eef9c14 100644 --- a/config/bash_completion.d/wo_auto.rc +++ b/config/bash_completion.d/wo_auto.rc @@ -74,12 +74,12 @@ _wo_complete() # HANDLE EVERYTHING AFTER THE THIRD LEVEL NAMESPACE "install" | "purge" | "remove" ) COMPREPLY=( $(compgen \ - -W "--web --admin --security --nginx --php72 --php73 --php74 --php80 --php81 --mysql --wpcli --phpmyadmin --adminer --utils --redis --phpredisadmin --composer --netdata --fail2ban --ufw --dashboard --proftpd --clamav --sendmail --ngxblocker --mysqlclient --mysqltuner --extplorer --nanorc --cheat --all --force" \ + -W "--web --admin --security --nginx --php72 --php73 --php74 --php80 --php81 --php82 --mysql --wpcli --phpmyadmin --adminer --utils --redis --phpredisadmin --composer --netdata --fail2ban --ufw --dashboard --proftpd --clamav --sendmail --ngxblocker --mysqlclient --mysqltuner --extplorer --nanorc --cheat --all --force" \ -- $cur) ) ;; "upgrade" ) COMPREPLY=( $(compgen \ - -W "--web --admin --utils --nginx --php72 --php73 --php74 --php80 --php81 --mysql --all --netdata --composer --phpmyadmin --adminer --dashboard --mysqltuner --wpcli --force" \ + -W "--web --admin --utils --nginx --php72 --php73 --php74 --php80 --php81 --php82 --mysql --all --netdata --composer --phpmyadmin --adminer --dashboard --mysqltuner --wpcli --force" \ -- $cur) ) ;; "migrate") @@ -89,7 +89,7 @@ _wo_complete() ;; "start" | "stop" | "reload" | "restart" | "status") COMPREPLY=( $(compgen \ - -W "--nginx --php --php72 --php73 --php74 --php80 --php81 --mysql --redis --fail2ban --ufw --netdata -proftpd" \ + -W "--nginx --php --php72 --php73 --php74 --php80 --php81 --php82 --mysql --redis --fail2ban --ufw --netdata -proftpd" \ -- $cur) ) ;; "list") @@ -159,13 +159,13 @@ _wo_complete() "create") COMPREPLY=( $(compgen \ - -W "--user --pass --email --html --php --php72 --php73 --php74 --php80 --php81 --mysql --wp --wpsubdir --wpsubdomain --wpfc --wpsc --proxy= --wpredis --wprocket --wpce -le --letsencrypt --letsencrypt=wildcard -le=wildcard --dns --dns=dns_cf --dns=dns_dgon" \ + -W "--user --pass --email --html --php --php72 --php73 --php74 --php80 --php81 --php82 --mysql --wp --wpsubdir --wpsubdomain --wpfc --wpsc --proxy= --wpredis --wprocket --wpce -le --letsencrypt --letsencrypt=wildcard -le=wildcard --dns --dns=dns_cf --dns=dns_dgon" \ -- $cur) ) ;; "update") COMPREPLY=( $(compgen \ - -W "--password --php --php72 --php73 --php74 --php80 --php81 --mysql --wp --wpsubdir --wpsubdomain --wpfc --wpsc --wpredis --wprocket --wpce -le -le=off --letsencrypt --letsencrypt=off --letsencrypt=clean -le=wildcard -le=clean --dns --dns=dns_cf --dns=dns_dgon --ngxblocker --ngxblocker=off" \ + -W "--password --php --php72 --php73 --php74 --php80 --php81 --php82 --mysql --wp --wpsubdir --wpsubdomain --wpfc --wpsc --wpredis --wprocket --wpce -le -le=off --letsencrypt --letsencrypt=off --letsencrypt=clean -le=wildcard -le=clean --dns --dns=dns_cf --dns=dns_dgon --ngxblocker --ngxblocker=off" \ -- $cur) ) ;; "delete") @@ -211,9 +211,9 @@ _wo_complete() "--wp") if [ "${COMP_WORDS[1]}" != "debug" ]; then if [ "${COMP_WORDS[2]}" == "create" ]; then - retlist="--wp --wpsc --wpfc --user --email --pass --wpredis --wprocket --wpce --letsencrypt -le --letsencrypt=wildcard --dns --dns=dns_cf --dns=dns_dgon --php72 --php73 --php74 --php80 --php81" + retlist="--wp --wpsc --wpfc --user --email --pass --wpredis --wprocket --wpce --letsencrypt -le --letsencrypt=wildcard --dns --dns=dns_cf --dns=dns_dgon --php72 --php73 --php74 --php80 --php81 --php82" elif [ "${COMP_WORDS[2]}" == "update" ]; then - retlist="--wp --wpfc --wpsc --php72 --php73 --php74 --php80 --php81 --wpredis --wprocket --wpce -le --letsencrypt --letsencrypt=wildcard -le=wildcard --dns --dns=dns_cf --dns=dns_dgon" + retlist="--wp --wpfc --wpsc --php72 --php73 --php74 --php80 --php81 --php82 --wpredis --wprocket --wpce -le --letsencrypt --letsencrypt=wildcard -le=wildcard --dns --dns=dns_cf --dns=dns_dgon" else retlist="" fi @@ -230,9 +230,9 @@ _wo_complete() "--wpsubdir" | "--wpsubdomain") if [ "${COMP_WORDS[1]}" != "debug" ]; then if [ "${COMP_WORDS[2]}" == "create" ]; then - retlist="--wpsc --wpfc --user --email --pass --wpredis --wprocket --wpce -le -le=wildcard --letsencrypt --letsencrypt=wildcard --php72 --php73 --php74 --php80 --php81 --dns --dns=dns_cf --dns=dns_dgon" + retlist="--wpsc --wpfc --user --email --pass --wpredis --wprocket --wpce -le -le=wildcard --letsencrypt --letsencrypt=wildcard --php72 --php73 --php74 --php80 --php81 --php82 --dns --dns=dns_cf --dns=dns_dgon" elif [ "${COMP_WORDS[2]}" == "update" ]; then - retlist="--wpfc --wpsc --php72 --php73 --php74 --php80 --php81 --wpredis --wprocket --wpce -le -le=wildcard --letsencrypt --letsencrypt=wildcard --dns --dns=dns_cf --dns=dns_dgon" + retlist="--wpfc --wpsc --php72 --php73 --php74 --php80 --php81 --php82 --wpredis --wprocket --wpce -le -le=wildcard --letsencrypt --letsencrypt=wildcard --dns --dns=dns_cf --dns=dns_dgon" else retlist="" fi @@ -248,7 +248,7 @@ _wo_complete() "--wpredis" | "--wprocket" | "--wpce" | "--wpfc" | "--wpsc" | "--wpsubdir" | "--wpsubdomain" | "--user" | "--pass" | "--email" | "--wp") if [ "${COMP_WORDS[2]}" == "create" ]; then - retlist="--user --pass --email --wp --wpsubdir --wpsubdomain --wpfc --wpsc --wpredis --wprocket --wpce --php72 --php73 --php74 --php80 --php81 -le -le=wildcard --letsencrypt --letsencrypt=wildcard --dns --dns=dns_cf --dns=dns_dgon" + retlist="--user --pass --email --wp --wpsubdir --wpsubdomain --wpfc --wpsc --wpredis --wprocket --wpce --php72 --php73 --php74 --php80 --php81 --php82 -le -le=wildcard --letsencrypt --letsencrypt=wildcard --dns --dns=dns_cf --dns=dns_dgon" else retlist="" fi @@ -261,7 +261,7 @@ _wo_complete() "--wpredis" | "--wprocket" | "--wpce" | "--wpfc" | "--wpsc") if [ "${COMP_WORDS[2]}" == "update" ]; then - retlist="--password --php72 --php73 --php74 --php80 --php81 --mysql --wp --wpsubdir --wpsubdomain -le --letsencrypt --dns --dns=dns_cf --dns=dns_dgon" + retlist="--password --php72 --php73 --php74 --php80 --php81 --php82 --mysql --wp --wpsubdir --wpsubdomain -le --letsencrypt --dns --dns=dns_cf --dns=dns_dgon" else retlist="" fi @@ -272,11 +272,11 @@ _wo_complete() -- $cur) ) ;; - "--web" | "--admin" | "--nginx" | "--php" | "--php73" | "--php74" | "--php80" | "--php81" | "--mysql" | "--wpcli" | "--phpmyadmin" | "--adminer" | "--utils" | "--fail2ban" | "--ufw" | "--redis" | "--phpredisadmin" | "--netdata" | "--sendmail" | "--composer" | "--proftpd" | "--cheat" | "--nanorc" | "--clamav" | "--dashboard") + "--web" | "--admin" | "--nginx" | "--php" | "--php73" | "--php74" | "--php80" | "--php81" | "--php82" | "--mysql" | "--wpcli" | "--phpmyadmin" | "--adminer" | "--utils" | "--fail2ban" | "--ufw" | "--redis" | "--phpredisadmin" | "--netdata" | "--sendmail" | "--composer" | "--proftpd" | "--cheat" | "--nanorc" | "--clamav" | "--dashboard") if [[ "${COMP_WORDS[2]}" == "install" || "${COMP_WORDS[2]}" == "purge" || "${COMP_WORDS[2]}" == "remove" ]]; then - retlist="--web --admin --security --nginx --php --php73 --php74 --php80 --php81 --mysql --wpcli --phpmyadmin --adminer --utils --redis --fail2ban --ufw --phpredisadmin --netdata --force" + retlist="--web --admin --security --nginx --php --php73 --php74 --php80 --php81 --php82 --mysql --wpcli --phpmyadmin --adminer --utils --redis --fail2ban --ufw --phpredisadmin --netdata --force" elif [[ "${COMP_WORDS[2]}" == "start" || "${COMP_WORDS[2]}" == "reload" || "${COMP_WORDS[2]}" == "restart" || "${COMP_WORDS[2]}" == "stop" ]]; then - retlist="--nginx --php --php73 --php74 --php80 --php81 --mysql --redis --netdata --fail2ban --ufw" + retlist="--nginx --php --php73 --php74 --php80 --php81 --php82 --mysql --redis --netdata --fail2ban --ufw" elif [[ "${COMP_WORDS[1]}" == "debug" ]]; then retlist="--start --nginx --php --php73 --fpm --fpm7 --mysql -i --interactive -stop --import-slow-log --import-slow-log-interval= -" if [[ $prev == '--mysql' ]]; then @@ -363,7 +363,7 @@ _wo_complete() case "$mprev" in "--user" | "--email" | "--pass") if [ "${COMP_WORDS[2]}" == "create" ]; then - retlist="--user --pass --email --html --php --php73 --php74 --php80 --php81 --mysql --wp --wpsubdir --wpsubdomain --wpfc --wpsc --wpredis --wprocket --wpce -le -le=wildcard --letsencrypt --letsencrypt=wildcard --dns --dns=dns_cf --dns=dns_dgon" + retlist="--user --pass --email --html --php --php73 --php74 --php80 --php81 --php82 --mysql --wp --wpsubdir --wpsubdomain --wpfc --wpsc --wpredis --wprocket --wpce -le -le=wildcard --letsencrypt --letsencrypt=wildcard --dns --dns=dns_cf --dns=dns_dgon" fi ret="${retlist[@]/$prev}" COMPREPLY=( $(compgen \ diff --git a/tests/travis.sh b/tests/travis.sh index 62a0afa..45e18c5 100644 --- a/tests/travis.sh +++ b/tests/travis.sh @@ -32,9 +32,9 @@ echo -e "${CGREEN}#############################################${CEND}" echo -e ' stack install ' echo -e "${CGREEN}#############################################${CEND}" if [ "$wo_distro" != "xenial" ]; then -stack_list='nginx php php73 php74 php80 php81 mysql redis fail2ban clamav proftpd netdata phpmyadmin composer dashboard extplorer adminer redis sendmail phpredisadmin mysqltuner utils ufw cheat nanorc' +stack_list='nginx php php73 php74 php80 php81 php82 mysql redis fail2ban clamav proftpd netdata phpmyadmin composer dashboard extplorer adminer redis sendmail phpredisadmin mysqltuner utils ufw cheat nanorc' else -stack_list='nginx php php73 php74 php80 php81 mysql redis fail2ban clamav proftpd netdata phpmyadmin composer dashboard extplorer adminer redis phpredisadmin mysqltuner utils ufw cheat nanorc' +stack_list='nginx php php73 php74 php80 php81 php82 mysql redis fail2ban clamav proftpd netdata phpmyadmin composer dashboard extplorer adminer redis phpredisadmin mysqltuner utils ufw cheat nanorc' fi for stack in $stack_list; do echo -ne " Installing $stack [..]\r" @@ -54,7 +54,7 @@ done echo -e "${CGREEN}#############################################${CEND}" echo -e ' Simple site create ' echo -e "${CGREEN}#############################################${CEND}" -site_types='html php php72 php73 php74 php80 php81 mysql wp wpfc wpsc wpredis wpce wprocket wpsubdomain wpsubdir ngxblocker' +site_types='html php php72 php73 php74 php80 php81 php82 mysql wp wpfc wpsc wpredis wpce wprocket wpsubdomain wpsubdir ngxblocker' for site in $site_types; do echo -ne " Creating $site [..]\r" if { @@ -194,6 +194,27 @@ done echo echo -e "${CGREEN}#############################################${CEND}" echo +echo -e "${CGREEN}#############################################${CEND}" +echo -e ' wo site update --php82 ' +echo -e "${CGREEN}#############################################${CEND}" +other_site_types='mysql php72 php73 wp wpfc wpsc wpredis wpce wprocket wpsubdomain wpsubdir' +for site in $other_site_types; do + echo -ne " Updating site to $site php82 [..]\r" + if { + wo site update ${site}.net --php81 + } >>/var/log/wo/test.log; then + echo -ne " Updating site to $site php82 [${CGREEN}OK${CEND}]\\r" + echo -ne '\n' + else + echo -e " Updating site to $site php82 [${CRED}FAIL${CEND}]" + echo -ne '\n' + exit_script + + fi +done +echo +echo -e "${CGREEN}#############################################${CEND}" +echo wo site info wp.net echo echo -e "${CGREEN}#############################################${CEND}" @@ -260,7 +281,7 @@ if [ -z "$1" ]; then echo -e "${CGREEN}#############################################${CEND}" echo -e ' wo stack upgrade ' echo -e "${CGREEN}#############################################${CEND}" - stack_upgrade='nginx php php72 php73 php74 php80 php81 mysql redis netdata dashboard phpmyadmin adminer fail2ban composer ngxblocker mysqltuner' + stack_upgrade='nginx php php72 php73 php74 php80 php81 php82 mysql redis netdata dashboard phpmyadmin adminer fail2ban composer ngxblocker mysqltuner' for stack in $stack_upgrade; do echo -ne " Upgrading $stack [..]\r" if { @@ -407,7 +428,7 @@ wo info echo -e "${CGREEN}#############################################${CEND}" echo -e ' wo stack purge ' echo -e "${CGREEN}#############################################${CEND}" -stack_purge='nginx php php73 php74 php80 php81 mysql redis fail2ban clamav proftpd netdata phpmyadmin composer dashboard extplorer adminer redis ufw ngxblocker cheat nanorc' +stack_purge='nginx php php73 php74 php80 php81 php82 mysql redis fail2ban clamav proftpd netdata phpmyadmin composer dashboard extplorer adminer redis ufw ngxblocker cheat nanorc' for stack in $stack_purge; do echo -ne " purging $stack [..]\r" if { diff --git a/wo/cli/plugins/info.py b/wo/cli/plugins/info.py index a463f0d..85fb5b8 100644 --- a/wo/cli/plugins/info.py +++ b/wo/cli/plugins/info.py @@ -41,6 +41,9 @@ class WOInfoController(CementBaseController): (['--php81'], dict(help='Get PHP 8.1 configuration information', action='store_true')), + (['--php82'], + dict(help='Get PHP 8.2 configuration information', + action='store_true')), (['--nginx'], dict(help='Get Nginx configuration information', action='store_true')), @@ -508,6 +511,93 @@ class WOInfoController(CementBaseController): debug_xdebug_profiler_enable_trigger=debug_xdebug) self.app.render((data), 'info_php.mustache') + @expose(hide=True) + def info_php82(self): + """Display PHP information""" + version = os.popen("/usr/bin/php8.2 -v 2>/dev/null | " + "head -n1 | cut -d' ' -f2 |" + " cut -d'+' -f1 | tr -d '\n'").read + config = configparser.ConfigParser() + config.read('/etc/php/8.2/fpm/php.ini') + expose_php = config['PHP']['expose_php'] + memory_limit = config['PHP']['memory_limit'] + post_max_size = config['PHP']['post_max_size'] + upload_max_filesize = config['PHP']['upload_max_filesize'] + max_execution_time = config['PHP']['max_execution_time'] + + if os.path.exists('/etc/php/8.2/fpm/pool.d/www.conf'): + config.read('/etc/php/8.2/fpm/pool.d/www.conf') + else: + Log.error(self, 'php-fpm pool config not found') + if config.has_section('www'): + wconfig = config['www'] + elif config.has_section('www-php82'): + wconfig = config['www-php82'] + else: + Log.error(self, 'Unable to parse configuration') + www_listen = wconfig['listen'] + www_ping_path = wconfig['ping.path'] + www_pm_status_path = wconfig['pm.status_path'] + www_pm = wconfig['pm'] + www_pm_max_requests = wconfig['pm.max_requests'] + www_pm_max_children = wconfig['pm.max_children'] + www_pm_start_servers = wconfig['pm.start_servers'] + www_pm_min_spare_servers = wconfig['pm.min_spare_servers'] + www_pm_max_spare_servers = wconfig['pm.max_spare_servers'] + www_request_terminate_time = (wconfig + ['request_terminate_timeout']) + try: + www_xdebug = (wconfig + ['php_admin_flag[xdebug.profiler_enable' + '_trigger]']) + except Exception as e: + Log.debug(self, "{0}".format(e)) + www_xdebug = 'off' + + config.read('/etc/php/8.2/fpm/pool.d/debug.conf') + debug_listen = config['debug']['listen'] + debug_ping_path = config['debug']['ping.path'] + debug_pm_status_path = config['debug']['pm.status_path'] + debug_pm = config['debug']['pm'] + debug_pm_max_requests = config['debug']['pm.max_requests'] + debug_pm_max_children = config['debug']['pm.max_children'] + debug_pm_start_servers = config['debug']['pm.start_servers'] + debug_pm_min_spare_servers = config['debug']['pm.min_spare_servers'] + debug_pm_max_spare_servers = config['debug']['pm.max_spare_servers'] + debug_request_terminate = (config['debug'] + ['request_terminate_timeout']) + try: + debug_xdebug = (config['debug']['php_admin_flag[xdebug.profiler_' + 'enable_trigger]']) + except Exception as e: + Log.debug(self, "{0}".format(e)) + debug_xdebug = 'off' + + data = dict(version=version, expose_php=expose_php, + memory_limit=memory_limit, post_max_size=post_max_size, + upload_max_filesize=upload_max_filesize, + max_execution_time=max_execution_time, + www_listen=www_listen, www_ping_path=www_ping_path, + www_pm_status_path=www_pm_status_path, www_pm=www_pm, + www_pm_max_requests=www_pm_max_requests, + www_pm_max_children=www_pm_max_children, + www_pm_start_servers=www_pm_start_servers, + www_pm_min_spare_servers=www_pm_min_spare_servers, + www_pm_max_spare_servers=www_pm_max_spare_servers, + www_request_terminate_timeout=www_request_terminate_time, + www_xdebug_profiler_enable_trigger=www_xdebug, + debug_listen=debug_listen, debug_ping_path=debug_ping_path, + debug_pm_status_path=debug_pm_status_path, + debug_pm=debug_pm, + debug_pm_max_requests=debug_pm_max_requests, + debug_pm_max_children=debug_pm_max_children, + debug_pm_start_servers=debug_pm_start_servers, + debug_pm_min_spare_servers=debug_pm_min_spare_servers, + debug_pm_max_spare_servers=debug_pm_max_spare_servers, + debug_request_terminate_timeout=debug_request_terminate, + debug_xdebug_profiler_enable_trigger=debug_xdebug) + self.app.render((data), 'info_php.mustache') + @expose(hide=True) def info_mysql(self): """Display MySQL information""" @@ -549,7 +639,7 @@ class WOInfoController(CementBaseController): if (not pargs.nginx and not pargs.php and not pargs.mysql and not pargs.php73 and not pargs.php74 and not pargs.php80 and - not pargs.php81): + not pargs.php81 and not pargs.php82): pargs.nginx = True pargs.php = True pargs.mysql = True @@ -561,6 +651,8 @@ class WOInfoController(CementBaseController): pargs.php80 = True if WOAptGet.is_installed(self, 'php8.1-fpm'): pargs.php81 = True + if WOAptGet.is_installed(self, 'php8.2-fpm'): + pargs.php82 = True if pargs.nginx: if ((not WOAptGet.is_installed(self, 'nginx-custom')) and @@ -599,6 +691,12 @@ class WOInfoController(CementBaseController): else: Log.info(self, "PHP 8.1 is not installed") + if pargs.php82: + if WOAptGet.is_installed(self, 'php8.2-fpm'): + self.info_php82() + else: + Log.info(self, "PHP 8.2 is not installed") + if pargs.mysql: if WOShellExec.cmd_exec(self, "/usr/bin/mysqladmin ping"): self.info_mysql() diff --git a/wo/cli/plugins/site_functions.py b/wo/cli/plugins/site_functions.py index b10f602..1e712c0 100644 --- a/wo/cli/plugins/site_functions.py +++ b/wo/cli/plugins/site_functions.py @@ -775,7 +775,8 @@ def sitebackup(self, data): .format(data['site_name']), backup_path) if data['currsitetype'] in ['html', 'php', 'php72', 'php74', - 'php73', 'php80', 'php81', 'proxy', 'mysql']: + 'php73', 'php80', 'php81', 'php82', + 'proxy', 'mysql']: if not data['wp']: Log.info(self, "Backing up Webroot \t\t", end='') WOFileUtils.copyfiles(self, wo_site_webroot + @@ -835,7 +836,7 @@ def site_package_check(self, stype): stack.app = self.app pargs = self.app.pargs if stype in ['html', 'proxy', 'php', 'php72', 'mysql', 'wp', 'wpsubdir', - 'wpsubdomain', 'php73', 'php74', 'php80', 'php81']: + 'wpsubdomain', 'php73', 'php74', 'php80', 'php81', 'php82']: Log.debug(self, "Setting apt_packages variable for Nginx") # Check if server has nginx-custom package @@ -873,19 +874,22 @@ def site_package_check(self, stype): if ((pargs.php and pargs.php73) or (pargs.php and pargs.php74) or (pargs.php and pargs.php72) or (pargs.php and pargs.php80) or - (pargs.php and pargs.php81) or - (pargs.php73 and pargs.php74) or (pargs.php72 and pargs.php73) or - (pargs.php72 and pargs.php74) or (pargs.php73 and pargs.php80) or - (pargs.php74 and pargs.php80) or (pargs.php80 and pargs.php81) or + (pargs.php and pargs.php81) or (pargs.php and pargs.php82) or + (pargs.php72 and pargs.php73) or (pargs.php72 and pargs.php74) or (pargs.php72 and pargs.php80) or (pargs.php72 and pargs.php81) or - (pargs.php73 and pargs.php81) or (pargs.php74 and pargs.php81) or - (pargs.php80 and pargs.php81)): + (pargs.php72 and pargs.php82) or + (pargs.php73 and pargs.php74) or (pargs.php73 and pargs.php80) or + (pargs.php73 and pargs.php81) or (pargs.php73 and pargs.php82) or + (pargs.php74 and pargs.php80) or (pargs.php74 and pargs.php81) or + (pargs.php74 and pargs.php82) or + (pargs.php80 and pargs.php81) or (pargs.php80 and pargs.php82) or + (pargs.php81 and pargs.php82)): Log.error( self, "Error: two different PHP versions cannot be " "combined within the same WordOps site") if ((not pargs.php72) and (not pargs.php73) and (not pargs.php74) and - (not pargs.php80) and (not pargs.php81) and + (not pargs.php80) and (not pargs.php81) and (not pargs.php82) and stype in ['php', 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']): Log.debug(self, "Setting apt_packages variable for PHP") @@ -909,12 +913,15 @@ def site_package_check(self, stype): elif config_php_ver == '8.1': php_check = 'php8.1-fpm' php_to_setup = WOVar.wo_php81 + elif config_php_ver == '8.2': + php_check = 'php8.2-fpm' + php_to_setup = WOVar.wo_php82 else: - php_check = 'php8.0-fpm' - php_to_setup = WOVar.wo_php80 + php_check = 'php8.1-fpm' + php_to_setup = WOVar.wo_php81 else: - php_check = 'php8.0-fpm' - php_to_setup = WOVar.wo_php80 + php_check = 'php8.1-fpm' + php_to_setup = WOVar.wo_php81 if not (WOAptGet.is_installed(self, php_check)): apt_packages = apt_packages + php_to_setup + WOVar.wo_php_extra @@ -949,6 +956,12 @@ def site_package_check(self, stype): if not WOAptGet.is_installed(self, 'php8.1-fpm'): apt_packages = apt_packages + WOVar.wo_php81 + WOVar.wo_php_extra + if pargs.php82 and stype in ['php82', 'mysql', 'wp', + 'wpsubdir', 'wpsubdomain']: + Log.debug(self, "Setting apt_packages variable for PHP 8.2") + if not WOAptGet.is_installed(self, 'php8.2-fpm'): + apt_packages = apt_packages + WOVar.wo_php82 + WOVar.wo_php_extra + if stype in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']: Log.debug(self, "Setting apt_packages variable for MySQL") if not WOShellExec.cmd_exec(self, "/usr/bin/mysqladmin ping"): @@ -1130,7 +1143,7 @@ def detSitePar(opts): for key, val in opts.items(): if val and key in ['html', 'php', 'mysql', 'wp', 'wpsubdir', 'wpsubdomain', 'php72', - 'php73', 'php74', 'php80', 'php81']: + 'php73', 'php74', 'php80', 'php81', 'php82', ]: typelist.append(key) elif val and key in ['wpfc', 'wpsc', 'wpredis', 'wprocket', 'wpce']: cachelist.append(key) @@ -1176,6 +1189,12 @@ def detSitePar(opts): cachetype = 'basic' else: cachetype = cachelist[0] + elif False not in [x in ('php82', 'mysql', 'html') for x in typelist]: + sitetype = 'mysql' + if not cachelist: + cachetype = 'basic' + else: + cachetype = cachelist[0] elif False not in [x in ('php', 'mysql') for x in typelist]: sitetype = 'mysql' if not cachelist: @@ -1212,6 +1231,12 @@ def detSitePar(opts): cachetype = 'basic' else: cachetype = cachelist[0] + elif False not in [x in ('php82', 'mysql') for x in typelist]: + sitetype = 'mysql' + if not cachelist: + cachetype = 'basic' + else: + cachetype = cachelist[0] elif False not in [x in ('html', 'mysql') for x in typelist]: sitetype = 'mysql' if not cachelist: @@ -1266,6 +1291,12 @@ def detSitePar(opts): cachetype = 'basic' else: cachetype = cachelist[0] + elif False not in [x in ('wp', 'php82') for x in typelist]: + sitetype = 'wp' + if not cachelist: + cachetype = 'basic' + else: + cachetype = cachelist[0] elif False not in [x in ('wpsubdir', 'php72') for x in typelist]: sitetype = 'wpsubdir' if not cachelist: @@ -1296,6 +1327,12 @@ def detSitePar(opts): cachetype = 'basic' else: cachetype = cachelist[0] + elif False not in [x in ('wpsubdir', 'php82') for x in typelist]: + sitetype = 'wpsubdir' + if not cachelist: + cachetype = 'basic' + else: + cachetype = cachelist[0] elif False not in [x in ('wpsubdomain', 'php72') for x in typelist]: sitetype = 'wpsubdomain' if not cachelist: @@ -1326,6 +1363,12 @@ def detSitePar(opts): cachetype = 'basic' else: cachetype = cachelist[0] + elif False not in [x in ('wpsubdomain', 'php82') for x in typelist]: + sitetype = 'wpsubdomain' + if not cachelist: + cachetype = 'basic' + else: + cachetype = cachelist[0] else: raise RuntimeError("could not determine site and cache type") else: @@ -1347,6 +1390,9 @@ def detSitePar(opts): elif (not typelist or "php81" in typelist) and cachelist: sitetype = 'wp' cachetype = cachelist[0] + elif (not typelist or "php82" in typelist) and cachelist: + sitetype = 'wp' + cachetype = cachelist[0] elif typelist and (not cachelist): sitetype = typelist[0] cachetype = 'basic' diff --git a/wo/cli/plugins/stack.py b/wo/cli/plugins/stack.py index 28a69b0..da2ca24 100644 --- a/wo/cli/plugins/stack.py +++ b/wo/cli/plugins/stack.py @@ -51,6 +51,8 @@ class WOStackController(CementBaseController): dict(help='Install PHP 8.0 stack', action='store_true')), (['--php81'], dict(help='Install PHP 8.1 stack', action='store_true')), + (['--php82'], + dict(help='Install PHP 8.2 stack', action='store_true')), (['--mysql'], dict(help='Install MySQL stack', action='store_true')), (['--mariadb'], @@ -121,7 +123,7 @@ class WOStackController(CementBaseController): # Default action for stack installation if not (pargs.web or pargs.admin or pargs.nginx or pargs.php or pargs.php72 or pargs.php73 or pargs.php74 or - pargs.php80 or pargs.php81 or + pargs.php80 or pargs.php81 or pargs.php82 or pargs.mysql or pargs.wpcli or pargs.phpmyadmin or pargs.composer or pargs.netdata or pargs.composer or pargs.dashboard or pargs.fail2ban or pargs.security or @@ -149,6 +151,7 @@ class WOStackController(CementBaseController): pargs.php74 = True pargs.php80 = True pargs.php81 = True + pargs.php82 = True pargs.redis = True pargs.proftpd = True @@ -166,8 +169,10 @@ class WOStackController(CementBaseController): pargs.php80 = True elif config_php_ver == '8.1': pargs.php81 = True + elif config_php_ver == '8.2': + pargs.php82 = True else: - pargs.php80 = True + pargs.php81 = True pargs.nginx = True pargs.mysql = True pargs.wpcli = True @@ -257,6 +262,16 @@ class WOStackController(CementBaseController): Log.debug(self, "PHP 8.1 already installed") Log.info(self, "PHP 8.1 already installed") + # PHP 8.2 + if pargs.php82: + Log.debug(self, "Setting apt_packages variable for PHP 8.2") + if not WOAptGet.is_installed(self, 'php8.2-fpm'): + apt_packages = (apt_packages + WOVar.wo_php82 + + WOVar.wo_php_extra) + else: + Log.debug(self, "PHP 8.2 already installed") + Log.info(self, "PHP 8.2 already installed") + # MariaDB 10.3 if pargs.mysql: pargs.mysqltuner = True @@ -512,7 +527,8 @@ class WOStackController(CementBaseController): WOAptGet.is_installed(self, 'php7.3-fpm') or WOAptGet.is_installed(self, 'php7.4-fpm') or WOAptGet.is_installed(self, 'php8.0-fpm') or - WOAptGet.is_installed(self, 'php8.1-fpm')): + WOAptGet.is_installed(self, 'php8.1-fpm') or + WOAptGet.is_installed(self, 'php8.2-fpm')): pargs.php80 = True Log.debug(self, "Setting packages variable for utils") packages = packages + [[ @@ -610,7 +626,7 @@ class WOStackController(CementBaseController): (not pargs.phpredisadmin) and (not pargs.sendmail) and (not pargs.php73) and (not pargs.php74) and (not pargs.php72) and (not pargs.php80) and - (not pargs.php81) and (not pargs.all)): + (not pargs.php81) and (not pargs.php82) and (not pargs.all)): self.app.args.print_help() if pargs.php: @@ -666,7 +682,8 @@ class WOStackController(CementBaseController): if not (WOAptGet.is_installed(self, 'php7.3-fpm') or WOAptGet.is_installed(self, 'php7.4-fpm') or WOAptGet.is_installed(self, 'php8.0-fpm') or - WOAptGet.is_installed(self, 'php8.1-fpm')): + WOAptGet.is_installed(self, 'php8.1-fpm') or + WOAptGet.is_installed(self, 'php8.2-fpm')): apt_packages = apt_packages + WOVar.wo_php_extra else: Log.debug(self, "PHP 7.2 is not installed") @@ -680,7 +697,8 @@ class WOStackController(CementBaseController): if not (WOAptGet.is_installed(self, 'php7.2-fpm') or WOAptGet.is_installed(self, 'php7.4-fpm') or WOAptGet.is_installed(self, 'php8.0-fpm') or - WOAptGet.is_installed(self, 'php8.1-fpm')): + WOAptGet.is_installed(self, 'php8.1-fpm') or + WOAptGet.is_installed(self, 'php8.2-fpm')): apt_packages = apt_packages + WOVar.wo_php_extra else: Log.debug(self, "PHP 7.3 is not installed") @@ -694,7 +712,8 @@ class WOStackController(CementBaseController): if not (WOAptGet.is_installed(self, 'php7.3-fpm') or WOAptGet.is_installed(self, 'php7.2-fpm') or WOAptGet.is_installed(self, 'php8.0-fpm') or - WOAptGet.is_installed(self, 'php8.1-fpm')): + WOAptGet.is_installed(self, 'php8.1-fpm') or + WOAptGet.is_installed(self, 'php8.2-fpm')): apt_packages = apt_packages + WOVar.wo_php_extra else: Log.debug(self, "PHP 7.4 is not installed") @@ -708,7 +727,8 @@ class WOStackController(CementBaseController): if not (WOAptGet.is_installed(self, 'php7.3-fpm') or WOAptGet.is_installed(self, 'php7.2-fpm') or WOAptGet.is_installed(self, 'php7.4-fpm') or - WOAptGet.is_installed(self, 'php8.1-fpm')): + WOAptGet.is_installed(self, 'php8.1-fpm') or + WOAptGet.is_installed(self, 'php8.2-fpm')): apt_packages = apt_packages + WOVar.wo_php_extra else: Log.debug(self, "PHP 8.0 is not installed") @@ -722,12 +742,30 @@ class WOStackController(CementBaseController): if not (WOAptGet.is_installed(self, 'php7.3-fpm') or WOAptGet.is_installed(self, 'php7.2-fpm') or WOAptGet.is_installed(self, 'php7.4-fpm') or - WOAptGet.is_installed(self, 'php8.0-fpm')): + WOAptGet.is_installed(self, 'php8.0-fpm') or + WOAptGet.is_installed(self, 'php8.1-fpm') or + WOAptGet.is_installed(self, 'php8.2-fpm')): apt_packages = apt_packages + WOVar.wo_php_extra else: Log.debug(self, "PHP 8.1 is not installed") Log.info(self, "PHP 8.1 is not installed") + # PHP 8.2 + if pargs.php82: + Log.debug(self, "Setting apt_packages variable for PHP 8.2") + if WOAptGet.is_installed(self, 'php8.2-fpm'): + apt_packages = apt_packages + WOVar.wo_php82 + if not (WOAptGet.is_installed(self, 'php7.3-fpm') or + WOAptGet.is_installed(self, 'php7.2-fpm') or + WOAptGet.is_installed(self, 'php7.4-fpm') or + WOAptGet.is_installed(self, 'php8.0-fpm') or + WOAptGet.is_installed(self, 'php8.1-fpm') or + WOAptGet.is_installed(self, 'php8.2-fpm')): + apt_packages = apt_packages + WOVar.wo_php_extra + else: + Log.debug(self, "PHP 8.2 is not installed") + Log.info(self, "PHP 8.2 is not installed") + # REDIS if pargs.redis: if WOAptGet.is_installed(self, 'redis-server'): @@ -961,12 +999,13 @@ class WOStackController(CementBaseController): (not pargs.ufw) and (not pargs.ngxblocker) and (not pargs.phpredisadmin) and (not pargs.sendmail) and (not pargs.php80) and (not pargs.php81) and + (not pargs.php82) and (not pargs.php73) and (not pargs.php74) and (not pargs.php72) and (not pargs.all)): self.app.args.print_help() if pargs.php: - pargs.php72 = True + pargs.php81 = True if pargs.mariadb: pargs.mysql = True @@ -974,10 +1013,12 @@ class WOStackController(CementBaseController): if pargs.all: pargs.web = True pargs.admin = True + pargs.php72 = True pargs.php73 = True pargs.php74 = True pargs.php80 = True pargs.php81 = True + pargs.php82 = True pargs.fail2ban = True pargs.proftpd = True pargs.utils = True @@ -1033,7 +1074,8 @@ class WOStackController(CementBaseController): if not (WOAptGet.is_installed(self, 'php7.2-fpm') or WOAptGet.is_installed(self, 'php7.4-fpm') or WOAptGet.is_installed(self, 'php8.0-fpm') or - WOAptGet.is_installed(self, 'php8.1-fpm')): + WOAptGet.is_installed(self, 'php8.1-fpm') or + WOAptGet.is_installed(self, 'php8.2-fpm')): apt_packages = apt_packages + WOVar.wo_php_extra else: Log.debug(self, "PHP 7.3 is not installed") @@ -1047,7 +1089,8 @@ class WOStackController(CementBaseController): if not (WOAptGet.is_installed(self, 'php7.3-fpm') or WOAptGet.is_installed(self, 'php7.2-fpm') or WOAptGet.is_installed(self, 'php8.0-fpm') or - WOAptGet.is_installed(self, 'php8.1-fpm')): + WOAptGet.is_installed(self, 'php8.1-fpm') or + WOAptGet.is_installed(self, 'php8.2-fpm')): apt_packages = apt_packages + WOVar.wo_php_extra else: Log.debug(self, "PHP 7.4 is not installed") @@ -1061,7 +1104,8 @@ class WOStackController(CementBaseController): if not (WOAptGet.is_installed(self, 'php7.3-fpm') or WOAptGet.is_installed(self, 'php7.2-fpm') or WOAptGet.is_installed(self, 'php7.4-fpm') or - WOAptGet.is_installed(self, 'php8.1-fpm')): + WOAptGet.is_installed(self, 'php8.1-fpm') or + WOAptGet.is_installed(self, 'php8.2-fpm')): apt_packages = apt_packages + WOVar.wo_php_extra else: Log.debug(self, "PHP 8.0 is not installed") @@ -1075,12 +1119,33 @@ class WOStackController(CementBaseController): if not (WOAptGet.is_installed(self, 'php7.3-fpm') or WOAptGet.is_installed(self, 'php7.2-fpm') or WOAptGet.is_installed(self, 'php8.0-fpm') or - WOAptGet.is_installed(self, 'php7.4-fpm')): + WOAptGet.is_installed(self, 'php7.4-fpm') or + WOAptGet.is_installed(self, 'php8.2-fpm')): apt_packages = apt_packages + WOVar.wo_php_extra else: Log.debug(self, "PHP 8.1 is not installed") Log.info(self, "PHP 8.1 is not installed") + Log.info(self, "PHP 8.1 is not installed") + + # PHP 8.2 + if pargs.php82: + Log.debug(self, "Setting apt_packages variable for PHP 8.2") + if WOAptGet.is_installed(self, 'php8.2-fpm'): + apt_packages = apt_packages + WOVar.wo_php74 + if not (WOAptGet.is_installed(self, 'php7.3-fpm') or + WOAptGet.is_installed(self, 'php7.2-fpm') or + WOAptGet.is_installed(self, 'php8.0-fpm') or + WOAptGet.is_installed(self, 'php7.4-fpm') or + WOAptGet.is_installed(self, 'php8.0-fpm') or + WOAptGet.is_installed(self, 'php8.1-fpm')): + apt_packages = apt_packages + WOVar.wo_php_extra + else: + Log.debug(self, "PHP 8.2 is not installed") + Log.info(self, "PHP 8.2 is not installed") + + Log.info(self, "PHP 8.2 is not installed") + # REDIS if pargs.redis: if WOAptGet.is_installed(self, 'redis-server'): diff --git a/wo/cli/plugins/stack_pref.py b/wo/cli/plugins/stack_pref.py index fcb236b..424b869 100644 --- a/wo/cli/plugins/stack_pref.py +++ b/wo/cli/plugins/stack_pref.py @@ -81,8 +81,11 @@ def pre_pref(self, apt_packages): # add php repository if (('php7.3-fpm' in apt_packages) or - ('php7.2-fpm' in apt_packages) or ('php7.4-fpm' in apt_packages) or - ('php8.0-fpm' in apt_packages) or ('php8.1-fpm' in apt_packages)): + ('php7.2-fpm' in apt_packages) or + ('php7.4-fpm' in apt_packages) or + ('php8.0-fpm' in apt_packages) or + ('php8.1-fpm' in apt_packages) or + ('php8.2-fpm' in apt_packages)): if (WOVar.wo_distro == 'ubuntu'): Log.debug(self, 'Adding ppa for PHP') Log.info(self, "Adding repository for PHP, please wait...") @@ -221,7 +224,13 @@ def post_pref(self, apt_packages, packages, upgrade=False): .format(ngxcom), 'wpsubdir.mustache', data) - wo_php_version = ["php72", "php73", "php74", "php80" "php81"] + wo_php_version = ["php72", + "php73", + "php74", + "php80", + "php81", + "php82", + ] for wo_php in wo_php_version: data = dict(upstream="{0}".format(wo_php), release=WOVar.wo_version) @@ -1068,7 +1077,7 @@ def post_pref(self, apt_packages, packages, upgrade=False): if os.path.exists('/etc/nginx/conf.d/upstream.conf'): if not WOFileUtils.grepcheck( - self, '/etc/nginx/conf.d/upstream.conf', 'php81'): + self, '/etc/nginx/conf.d/upstream.conf', 'php80'): data = dict(php="9000", debug="9001", php7="9070", debug7="9170", php8="9080", debug8="9180", @@ -1240,6 +1249,168 @@ def post_pref(self, apt_packages, packages, upgrade=False): 'upstream.mustache', data, True) WOConf.nginxcommon(self) + # php8.2 configuration + if set(WOVar.wo_php82).issubset(set(apt_packages)): + WOGit.add(self, ["/etc/php"], msg="Adding PHP into Git") + Log.info(self, "Configuring php8.2-fpm") + ngxroot = '/var/www/' + # Create log directories + if not os.path.exists('/var/log/php/8.2/'): + Log.debug(self, 'Creating directory /var/log/php/8.2/') + os.makedirs('/var/log/php/8.2/') + + if not os.path.isfile('/etc/php/8.2/fpm/php.ini.orig'): + WOFileUtils.copyfile(self, '/etc/php/8.2/fpm/php.ini', + '/etc/php/8.2/fpm/php.ini.orig') + + # Parse etc/php/8.2/fpm/php.ini + config = configparser.ConfigParser() + Log.debug(self, "configuring php file /etc/php/8.2/" + "fpm/php.ini") + config.read('/etc/php/8.2/fpm/php.ini.orig') + config['PHP']['expose_php'] = 'Off' + config['PHP']['post_max_size'] = '100M' + config['PHP']['upload_max_filesize'] = '100M' + config['PHP']['max_execution_time'] = '300' + config['PHP']['max_input_time'] = '300' + config['PHP']['max_input_vars'] = '20000' + config['Date']['date.timezone'] = WOVar.wo_timezone + config['opcache']['opcache.enable'] = '1' + config['opcache']['opcache.interned_strings_buffer'] = '8' + config['opcache']['opcache.max_accelerated_files'] = '10000' + config['opcache']['opcache.memory_consumption'] = '256' + config['opcache']['opcache.save_comments'] = '1' + config['opcache']['opcache.revalidate_freq'] = '5' + config['opcache']['opcache.consistency_checks'] = '0' + config['opcache']['opcache.validate_timestamps'] = '1' + config['opcache']['opcache.preload_user'] = 'www-data' + with open('/etc/php/8.2/fpm/php.ini', + encoding='utf-8', mode='w') as configfile: + Log.debug(self, "Writting php configuration into " + "/etc/php/8.2/fpm/php.ini") + config.write(configfile) + + # Render php-fpm pool template for php8.2 + data = dict(pid="/run/php/php8.2-fpm.pid", + error_log="/var/log/php8.2-fpm.log", + include="/etc/php/8.2/fpm/pool.d/*.conf") + WOTemplate.deploy( + self, '/etc/php/8.2/fpm/php-fpm.conf', + 'php-fpm.mustache', data) + + data = dict(pool='www-php82', listen='php82-fpm.sock', + user='www-data', + group='www-data', listenuser='root', + listengroup='www-data', openbasedir=True) + WOTemplate.deploy(self, '/etc/php/8.2/fpm/pool.d/www.conf', + 'php-pool.mustache', data) + data = dict(pool='www-two-php82', listen='php82-two-fpm.sock', + user='www-data', + group='www-data', listenuser='root', + listengroup='www-data', openbasedir=True) + WOTemplate.deploy(self, '/etc/php/8.2/fpm/pool.d/www-two.conf', + 'php-pool.mustache', data) + + # Generate /etc/php/8.2/fpm/pool.d/debug.conf + WOFileUtils.copyfile(self, "/etc/php/8.2/fpm/pool.d/www.conf", + "/etc/php/8.2/fpm/pool.d/debug.conf") + WOFileUtils.searchreplace(self, "/etc/php/8.2/fpm/pool.d/" + "debug.conf", "[www-php82]", "[debug]") + config = configparser.ConfigParser() + config.read('/etc/php/8.2/fpm/pool.d/debug.conf') + config['debug']['listen'] = '127.0.0.1:9182' + config['debug']['rlimit_core'] = 'unlimited' + config['debug']['slowlog'] = '/var/log/php/8.2/slow.log' + config['debug']['request_slowlog_timeout'] = '10s' + with open('/etc/php/8.2/fpm/pool.d/debug.conf', + encoding='utf-8', mode='w') as confifile: + Log.debug(self, "writting PHP 8.2 configuration into " + "/etc/php/8.2/fpm/pool.d/debug.conf") + config.write(confifile) + + with open("/etc/php/8.2/fpm/pool.d/debug.conf", + encoding='utf-8', mode='a') as myfile: + myfile.write( + "php_admin_value[xdebug.profiler_output_dir] " + "= /tmp/ \nphp_admin_value[xdebug.profiler_" + "output_name] = cachegrind.out.%p-%H-%R " + "\nphp_admin_flag[xdebug.profiler_enable" + "_trigger] = on \nphp_admin_flag[xdebug." + "profiler_enable] = off\n") + + # Disable xdebug + if not WOShellExec.cmd_exec( + self, "grep -q \';zend_extension\'" + " /etc/php/8.2/mods-available/xdebug.ini"): + WOFileUtils.searchreplace( + self, "/etc/php/8.2/mods-available/" + "xdebug.ini", + "zend_extension", ";zend_extension") + + # PHP and Debug pull configuration + if not os.path.exists('{0}22222/htdocs/fpm/status/' + .format(ngxroot)): + Log.debug(self, 'Creating directory ' + '{0}22222/htdocs/fpm/status/ ' + .format(ngxroot)) + os.makedirs('{0}22222/htdocs/fpm/status/' + .format(ngxroot)) + open('{0}22222/htdocs/fpm/status/debug82' + .format(ngxroot), + encoding='utf-8', mode='a').close() + open('{0}22222/htdocs/fpm/status/php82' + .format(ngxroot), + encoding='utf-8', mode='a').close() + + # Write info.php + if not os.path.exists('{0}22222/htdocs/php/' + .format(ngxroot)): + Log.debug(self, 'Creating directory ' + '{0}22222/htdocs/php/ ' + .format(ngxroot)) + os.makedirs('{0}22222/htdocs/php' + .format(ngxroot)) + + WOFileUtils.textwrite( + self, "{0}22222/htdocs/php/info.php" + .format(ngxroot), "") + + # write opcache clean for php82 + if not os.path.exists('{0}22222/htdocs/cache/opcache' + .format(ngxroot)): + os.makedirs('{0}22222/htdocs/cache/opcache' + .format(ngxroot)) + WOFileUtils.textwrite( + self, '{0}22222/htdocs/cache/opcache/php82.php' + .format(ngxroot), + '') + + WOFileUtils.chown(self, "{0}22222/htdocs" + .format(ngxroot), + 'www-data', + 'www-data', recursive=True) + + # enable imagick php extension + WOShellExec.cmd_exec(self, 'phpenmod -v ALL imagick') + + # check service restart or rollback configuration + if not WOService.restart_service(self, 'php8.2-fpm'): + WOGit.rollback(self, ["/etc/php"], msg="Rollback PHP") + else: + WOGit.add(self, ["/etc/php"], msg="Adding PHP into Git") + + if os.path.exists('/etc/nginx/conf.d/upstream.conf'): + if not WOFileUtils.grepcheck( + self, '/etc/nginx/conf.d/upstream.conf', 'php82'): + data = dict(php="9000", debug="9001", + php7="9070", debug7="9170", + php8="9080", debug8="9180", + release=WOVar.wo_version) + WOTemplate.deploy( + self, '/etc/nginx/conf.d/upstream.conf', + 'upstream.mustache', data, True) + WOConf.nginxcommon(self) + # create mysql config if it doesn't exist if "mariadb-server" in apt_packages: WOGit.add(self, ["/etc/mysql"], msg="Adding MySQL into Git") diff --git a/wo/cli/plugins/stack_services.py b/wo/cli/plugins/stack_services.py index 341eb9e..cc75408 100644 --- a/wo/cli/plugins/stack_services.py +++ b/wo/cli/plugins/stack_services.py @@ -26,6 +26,7 @@ class WOStackStatusController(CementBaseController): pargs.php74 or pargs.php80 or pargs.php81 or + pargs.php82 or pargs.mysql or pargs.redis or pargs.fail2ban or @@ -66,6 +67,10 @@ class WOStackStatusController(CementBaseController): services = services + ['php8.1-fpm'] else: Log.info(self, "PHP8.1-FPM is not installed") + if os.path.exists('{0}'.format(wo_system) + 'php8.2-fpm.service'): + services = services + ['php8.2-fpm'] + else: + Log.info(self, "PHP8.2-FPM is not installed") if pargs.php72: if os.path.exists('{0}'.format(wo_system) + 'php7.2-fpm.service'): @@ -97,6 +102,12 @@ class WOStackStatusController(CementBaseController): else: Log.info(self, "PHP8.1-FPM is not installed") + if pargs.php82: + if os.path.exists('{0}'.format(wo_system) + 'php8.2-fpm.service'): + services = services + ['php8.2-fpm'] + else: + Log.info(self, "PHP8.2-FPM is not installed") + if pargs.mysql: if ((WOVar.wo_mysql_host == "localhost") or (WOVar.wo_mysql_host == "127.0.0.1")): @@ -145,9 +156,9 @@ class WOStackStatusController(CementBaseController): services = [] wo_system = "/lib/systemd/system/" pargs = self.app.pargs - if not (pargs.nginx or pargs.php or - pargs.php72 or pargs.php73 or - pargs.php74 or pargs.php80 or pargs.php81 or + if not (pargs.nginx or + pargs.php or pargs.php72 or pargs.php73 or pargs.php74 or + pargs.php80 or pargs.php81 or pargs.php82 or pargs.mysql or pargs.fail2ban or pargs.netdata or @@ -207,6 +218,12 @@ class WOStackStatusController(CementBaseController): else: Log.info(self, "PHP8.1-FPM is not installed") + if pargs.php82: + if os.path.exists('{0}'.format(wo_system) + 'php8.2-fpm.service'): + services = services + ['php8.2-fpm'] + else: + Log.info(self, "PHP8.2-FPM is not installed") + if pargs.mysql: if ((WOVar.wo_mysql_host == "localhost") or (WOVar.wo_mysql_host == "127.0.0.1")): @@ -255,9 +272,9 @@ class WOStackStatusController(CementBaseController): services = [] wo_system = "/lib/systemd/system/" pargs = self.app.pargs - if not (pargs.nginx or pargs.php or - pargs.php72 or pargs.php73 or - pargs.php74 or pargs.php80 or pargs.php81 or + if not (pargs.nginx or + pargs.php or pargs.php72 or pargs.php73 or pargs.php74 or + pargs.php80 or pargs.php81 or pargs.php82 or pargs.mysql or pargs.netdata or pargs.proftpd or @@ -295,6 +312,10 @@ class WOStackStatusController(CementBaseController): services = services + ['php8.1-fpm'] else: Log.info(self, "PHP8.1-FPM is not installed") + if os.path.exists('{0}'.format(wo_system) + 'php8.2-fpm.service'): + services = services + ['php8.2-fpm'] + else: + Log.info(self, "PHP8.2-FPM is not installed") if pargs.php72: if os.path.exists('{0}'.format(wo_system) + 'php7.2-fpm.service'): @@ -326,6 +347,12 @@ class WOStackStatusController(CementBaseController): else: Log.info(self, "PHP8.1-FPM is not installed") + if pargs.php82: + if os.path.exists('{0}'.format(wo_system) + 'php8.2-fpm.service'): + services = services + ['php8.2-fpm'] + else: + Log.info(self, "PHP8.2-FPM is not installed") + if pargs.mysql: if ((WOVar.wo_mysql_host == "localhost") or (WOVar.wo_mysql_host == "127.0.0.1")): @@ -380,6 +407,7 @@ class WOStackStatusController(CementBaseController): pargs.php74 or pargs.php80 or pargs.php81 or + pargs.php82 or pargs.mysql or pargs.netdata or pargs.proftpd or @@ -419,6 +447,10 @@ class WOStackStatusController(CementBaseController): services = services + ['php8.1-fpm'] else: Log.info(self, "PHP8.1-FPM is not installed") + if os.path.exists('{0}'.format(wo_system) + 'php8.2-fpm.service'): + services = services + ['php8.2-fpm'] + else: + Log.info(self, "PHP8.2-FPM is not installed") if pargs.php72: if os.path.exists('{0}'.format(wo_system) + 'php7.2-fpm.service'): @@ -450,6 +482,12 @@ class WOStackStatusController(CementBaseController): else: Log.info(self, "PHP8.1-FPM is not installed") + if pargs.php82: + if os.path.exists('{0}'.format(wo_system) + 'php8.2-fpm.service'): + services = services + ['php8.2-fpm'] + else: + Log.info(self, "PHP8.2-FPM is not installed") + if pargs.mysql: if ((WOVar.wo_mysql_host == "localhost") or (WOVar.wo_mysql_host == "127.0.0.1")): @@ -510,8 +548,8 @@ class WOStackStatusController(CementBaseController): wo_system = "/lib/systemd/system/" pargs = self.app.pargs if not (pargs.nginx or pargs.php or - pargs.php72 or pargs.php73 or - pargs.php74 or pargs.php80 or pargs.php81 or + pargs.php72 or pargs.php73 or pargs.php74 or + pargs.php80 or pargs.php81 or pargs.php82 or pargs.mysql or pargs.netdata or pargs.proftpd or @@ -549,6 +587,10 @@ class WOStackStatusController(CementBaseController): services = services + ['php8.1-fpm'] else: Log.info(self, "PHP8.1-FPM is not installed") + if os.path.exists('{0}'.format(wo_system) + 'php8.2-fpm.service'): + services = services + ['php8.2-fpm'] + else: + Log.info(self, "PHP8.2-FPM is not installed") if pargs.php72: if os.path.exists('{0}'.format(wo_system) + 'php7.2-fpm.service'): @@ -580,6 +622,12 @@ class WOStackStatusController(CementBaseController): else: Log.info(self, "PHP8.1-FPM is not installed") + if pargs.php82: + if os.path.exists('{0}'.format(wo_system) + 'php8.2-fpm.service'): + services = services + ['php8.2-fpm'] + else: + Log.info(self, "PHP8.2-FPM is not installed") + if pargs.mysql: if ((WOVar.wo_mysql_host == "localhost") or (WOVar.wo_mysql_host == "127.0.0.1")): diff --git a/wo/cli/plugins/stack_upgrade.py b/wo/cli/plugins/stack_upgrade.py index b0333b2..a859d78 100644 --- a/wo/cli/plugins/stack_upgrade.py +++ b/wo/cli/plugins/stack_upgrade.py @@ -43,6 +43,8 @@ class WOStackUpgradeController(CementBaseController): dict(help='Upgrade PHP 8.0 stack', action='store_true')), (['--php81'], dict(help='Upgrade PHP 8.1 stack', action='store_true')), + (['--php82'], + dict(help='Upgrade PHP 8.2 stack', action='store_true')), (['--mysql'], dict(help='Upgrade MySQL stack', action='store_true')), (['--mariadb'], @@ -86,7 +88,7 @@ class WOStackUpgradeController(CementBaseController): wo_phpmyadmin = WODownload.pma_release(self) if not (pargs.web or pargs.nginx or pargs.php or pargs.php72 or pargs.php73 or pargs.php74 or - pargs.php80 or pargs.php81 or pargs.mysql or + pargs.php80 or pargs.php81 or pargs.php82 or pargs.mysql or pargs.mariadb or pargs.ngxblocker or pargs.all or pargs.netdata or pargs.wpcli or pargs.composer or pargs.phpmyadmin or pargs.adminer or pargs.dashboard or @@ -100,7 +102,7 @@ class WOStackUpgradeController(CementBaseController): pargs.mysql = True if pargs.php: - pargs.php72 = True + pargs.php81 = True if pargs.all: pargs.web = True @@ -115,6 +117,7 @@ class WOStackUpgradeController(CementBaseController): pargs.php74 = True pargs.php80 = True pargs.php81 = True + pargs.php82 = True pargs.mysql = True pargs.wpcli = True @@ -172,6 +175,12 @@ class WOStackUpgradeController(CementBaseController): apt_packages = apt_packages + WOVar.wo_php81 + \ WOVar.wo_php_extra + # php 8.2 + if pargs.php82: + if WOAptGet.is_installed(self, 'php8.2-fpm'): + apt_packages = apt_packages + WOVar.wo_php82 + \ + WOVar.wo_php_extra + # mysql if pargs.mysql: if WOShellExec.cmd_exec(self, 'mysqladmin ping'): @@ -301,6 +310,7 @@ class WOStackUpgradeController(CementBaseController): "php7.4-fpm" in apt_packages or "php8.0-fpm" in apt_packages or "php8.1-fpm" in apt_packages or + "php8.2-fpm" in apt_packages or "redis-server" in apt_packages or "nginx-custom" in apt_packages or "mariadb-server" in apt_packages): diff --git a/wo/cli/templates/upstream.mustache b/wo/cli/templates/upstream.mustache index 5b93f7e..715aeb4 100644 --- a/wo/cli/templates/upstream.mustache +++ b/wo/cli/templates/upstream.mustache @@ -125,6 +125,26 @@ upstream debug81 { server 127.0.0.1:9176; } +#------------------------------- +# PHP 8.2 +#------------------------------- + +# PHP 8.2 upstream with load-balancing on two unix sockets +upstream php82 { + least_conn; + + server unix:/var/run/php/php82-fpm.sock; + server unix:/var/run/php/php82-two-fpm.sock; + + keepalive 5; +} + +# PHP 8.2 debug +upstream debug82 { + # Debug Pool + server 127.0.0.1:9177; +} + #------------------------------- # Netdata #------------------------------- @@ -156,4 +176,5 @@ upstream multiphp { server unix:/var/run/php/php72-fpm.sock; server unix:/var/run/php/php80-fpm.sock; server unix:/var/run/php/php81-fpm.sock; -} \ No newline at end of file + server unix:/var/run/php/php82-fpm.sock; +} diff --git a/wo/core/services.py b/wo/core/services.py index 87811ba..9e49cfb 100644 --- a/wo/core/services.py +++ b/wo/core/services.py @@ -168,7 +168,9 @@ class WOService(): 'php7.3-fpm', 'php7.4-fpm', 'php8.0-fpm', - 'php8.1-fpm',]: + 'php8.1-fpm', + 'php8.2-fpm', + ]: retcode = subprocess.getstatusoutput('service {0} status' .format(service_name)) if retcode[0] == 0: diff --git a/wo/core/variables.py b/wo/core/variables.py index 4b426ec..54efe40 100644 --- a/wo/core/variables.py +++ b/wo/core/variables.py @@ -170,6 +170,9 @@ class WOVar(): wo_php81 = [] for module in wo_module: wo_php81 = wo_php81 + ["php8.1-{0}".format(module)] + wo_php82 = [] + for module in wo_module: + wo_php82 = wo_php82 + ["php8.2-{0}".format(module)] wo_php_extra = ["graphviz"] From 887cc1d3f0e0471f8076abdc7aacc5c47b8c82f3 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Sun, 11 Dec 2022 16:13:33 +0100 Subject: [PATCH 06/12] Fix php8.2 --- wo/cli/plugins/site_create.py | 12 ++++++++++ wo/cli/plugins/site_update.py | 44 ++++++++++++++++++++++++++--------- 2 files changed, 45 insertions(+), 11 deletions(-) diff --git a/wo/cli/plugins/site_create.py b/wo/cli/plugins/site_create.py index 21a3300..14343da 100644 --- a/wo/cli/plugins/site_create.py +++ b/wo/cli/plugins/site_create.py @@ -43,6 +43,8 @@ class WOSiteCreateController(CementBaseController): dict(help="create php 8.0 site", action='store_true')), (['--php81'], dict(help="create php 8.1 site", action='store_true')), + (['--php82'], + dict(help="create php 8.2 site", action='store_true')), (['--mysql'], dict(help="create mysql site", action='store_true')), (['--wp'], @@ -221,6 +223,7 @@ class WOSiteCreateController(CementBaseController): data['php72'] = False data['php80'] = False data['php81'] = False + data['php82'] = False if data and pargs.php73: data['php73'] = True @@ -237,6 +240,10 @@ class WOSiteCreateController(CementBaseController): elif data and pargs.php81: data['php81'] = True data['wo_php'] = 'php81' + elif data and pargs.php82: + data['php82'] = True + data['wo_php'] = 'php82' + else: if self.app.config.has_section('php'): config_php_ver = self.app.config.get( @@ -256,6 +263,9 @@ class WOSiteCreateController(CementBaseController): elif config_php_ver == '8.1': data['php81'] = True data['wo_php'] = 'php81' + elif config_php_ver == '8.1': + data['php82'] = True + data['wo_php'] = 'php82' else: data['php73'] = True data['wo_php'] = 'php73' @@ -329,6 +339,8 @@ class WOSiteCreateController(CementBaseController): php_version = "8.0" elif data['php81']: php_version = "8.1" + elif data['php82']: + php_version = "8.2" else: php_version = "7.3" diff --git a/wo/cli/plugins/site_update.py b/wo/cli/plugins/site_update.py index dfa3dfb..4b23c0e 100644 --- a/wo/cli/plugins/site_update.py +++ b/wo/cli/plugins/site_update.py @@ -51,6 +51,8 @@ class WOSiteUpdateController(CementBaseController): dict(help="update to php80 site", action='store_true')), (['--php81'], dict(help="update to php81 site", action='store_true')), + (['--php82'], + dict(help="update to php82 site", action='store_true')), (['--mysql'], dict(help="update to mysql site", action='store_true')), (['--wp'], @@ -115,7 +117,7 @@ class WOSiteUpdateController(CementBaseController): Log.error(self, "No site can be updated to html") if not (pargs.php or pargs.php72 or pargs.php73 or pargs.php74 or - pargs.php80 or pargs.php81 or + pargs.php80 or pargs.php81 or pargs.php82 or pargs.mysql or pargs.wp or pargs.wpsubdir or pargs.wpsubdomain or pargs.wpfc or pargs.wpsc or pargs.wprocket or pargs.wpce or @@ -150,6 +152,7 @@ class WOSiteUpdateController(CementBaseController): php72 = False php80 = False php81 = False + php82 = False data = dict() try: @@ -200,11 +203,12 @@ class WOSiteUpdateController(CementBaseController): old_php74 = bool(check_php_version == "7.4") old_php80 = bool(check_php_version == "8.0") old_php81 = bool(check_php_version == "8.1") + old_php82 = bool(check_php_version == "8.2") if ((pargs.password or pargs.hsts or pargs.ngxblocker or pargs.letsencrypt == 'renew') and not ( pargs.html or pargs.php or pargs.php72 or pargs.php73 or - pargs.php74 or pargs.php80 or pargs.php81 or + pargs.php74 or pargs.php80 or pargs.php81 or pargs.php82 or pargs.mysql or pargs.wp or pargs.wpfc or pargs.wpsc or pargs.wprocket or pargs.wpce or pargs.wpsubdir or pargs.wpsubdomain)): @@ -275,16 +279,16 @@ class WOSiteUpdateController(CementBaseController): 'php73', 'php74', 'php80', 'php81']) or (stype == 'mysql' and oldsitetype not in [ 'html', 'php', 'php72', 'php73', 'php74', 'php80', 'php81', - 'proxy']) or + 'php82', 'proxy']) or (stype == 'wp' and oldsitetype not in [ 'html', 'php', 'php72', 'php73', 'php74', 'php80', 'php81', - 'mysql', 'proxy', 'wp']) or + 'php82', 'mysql', 'proxy', 'wp']) or (stype == 'wpsubdir' and oldsitetype in ['wpsubdomain']) or (stype == 'wpsubdomain' and oldsitetype in ['wpsubdir']) or (stype == oldsitetype and cache == oldcachetype)) and not (pargs.php72 or pargs.php73 or pargs.php74 or pargs.php80 or - pargs.php81)): + pargs.php81 or pargs.php82)): Log.info(self, Log.FAIL + "can not update {0} {1} to {2} {3}". format(oldsitetype, oldcachetype, stype, cache)) return 1 @@ -304,7 +308,7 @@ class WOSiteUpdateController(CementBaseController): site_name=wo_domain, www_domain=wo_www_domain, static=False, basic=True, wp=False, wpfc=False, php72=False, php73=False, php74=False, - php80=False, php81=False, + php80=False, php81=False, php82=False, wpsc=False, wpredis=False, wprocket=False, wpce=False, multisite=False, wpsubdir=False, webroot=wo_site_webroot, currsitetype=oldsitetype, currcachetype=oldcachetype) @@ -328,8 +332,9 @@ class WOSiteUpdateController(CementBaseController): if stype == 'wpsubdir': data['wpsubdir'] = True - if ((pargs.php72 or pargs.php73 or - pargs.php74 or pargs.php80 or pargs.php81) and (not data)): + if ((pargs.php72 or pargs.php73 or pargs.php74 or + pargs.php80 or pargs.php81 or pargs.php82) and + (not data)): Log.debug( self, "pargs php72, or php73, or php74, " "or php80, or php81 enabled") @@ -348,7 +353,8 @@ class WOSiteUpdateController(CementBaseController): data['wpsubdir'] = False elif (oldsitetype == 'php' or oldsitetype == 'mysql' or oldsitetype == 'php73' or oldsitetype == 'php74' or - oldsitetype == 'php80' or oldsitetype == 'php81'): + oldsitetype == 'php80' or oldsitetype == 'php81' or + oldsitetype == 'php82'): data['static'] = False data['wp'] = False data['multisite'] = False @@ -432,6 +438,10 @@ class WOSiteUpdateController(CementBaseController): Log.debug(self, "pargs.php81 detected") data['php81'] = True php81 = True + elif pargs.php82: + Log.debug(self, "pargs.php82 detected") + data['php82'] = True + php81 = True if pargs.php72: if php72 is old_php72: @@ -463,9 +473,15 @@ class WOSiteUpdateController(CementBaseController): "site") pargs.php81 = False + if pargs.php82: + if php82 is old_php82: + Log.info(self, "PHP 8.2 is already enabled for given " + "site") + pargs.php82 = False + if (data and (not pargs.php73) and (not pargs.php74) and (not pargs.php72) and - (not pargs.php80) and (not pargs.php81)): + (not pargs.php80) and (not pargs.php81) and (not pargs.php82)): data['php72'] = bool(old_php72 is True) Log.debug(self, "data php72 = {0}".format(data['php72'])) php72 = bool(old_php72 is True) @@ -481,6 +497,9 @@ class WOSiteUpdateController(CementBaseController): data['php81'] = bool(old_php81 is True) Log.debug(self, "data php81 = {0}".format(data['php81'])) php81 = bool(old_php81 is True) + data['php82'] = bool(old_php82 is True) + Log.debug(self, "data php82 = {0}".format(data['php82'])) + php82 = bool(old_php82 is True) if pargs.letsencrypt: acme_domains = [] @@ -559,7 +578,7 @@ class WOSiteUpdateController(CementBaseController): if ((php73 is old_php73) and (php72 is old_php72) and (php74 is old_php74) and (php80 is old_php80) and - (php81 is old_php81) and + (php81 is old_php81) and (php82 is old_php82) (stype == oldsitetype and cache == oldcachetype)): Log.debug(self, "Nothing to update") @@ -580,6 +599,9 @@ class WOSiteUpdateController(CementBaseController): elif php81 is True: data['wo_php'] = 'php81' check_php_version = '8.1' + elif php82 is True: + data['wo_php'] = 'php82' + check_php_version = '8.2' else: data['wo_php'] = 'php80' check_php_version = '8.0' From 319d1d0afc6c2e1a4ec5c52cb000c31b5d3a349b Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Sun, 11 Dec 2022 16:30:40 +0100 Subject: [PATCH 07/12] Fix php8.2 --- wo/cli/plugins/site_create.py | 4 ++-- wo/cli/plugins/site_functions.py | 8 ++++---- wo/cli/plugins/site_update.py | 5 +++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/wo/cli/plugins/site_create.py b/wo/cli/plugins/site_create.py index 14343da..4be9bd2 100644 --- a/wo/cli/plugins/site_create.py +++ b/wo/cli/plugins/site_create.py @@ -174,7 +174,7 @@ class WOSiteCreateController(CementBaseController): data['basic'] = True if (pargs.php72 or pargs.php73 or pargs.php74 or - pargs.php80 or pargs.php81): + pargs.php80 or pargs.php81 or pargs.php82): data = dict( site_name=wo_domain, www_domain=wo_www_domain, static=False, basic=False, @@ -263,7 +263,7 @@ class WOSiteCreateController(CementBaseController): elif config_php_ver == '8.1': data['php81'] = True data['wo_php'] = 'php81' - elif config_php_ver == '8.1': + elif config_php_ver == '8.2': data['php82'] = True data['wo_php'] = 'php82' else: diff --git a/wo/cli/plugins/site_functions.py b/wo/cli/plugins/site_functions.py index 1e712c0..cea13e8 100644 --- a/wo/cli/plugins/site_functions.py +++ b/wo/cli/plugins/site_functions.py @@ -237,7 +237,7 @@ def setupdatabase(self, data): data['wo_db_pass'] = wo_db_password data['wo_db_host'] = WOVar.wo_mysql_host data['wo_mysql_grant_host'] = wo_mysql_grant_host - return(data) + return (data) def setupwordpress(self, data, vhostonly=False): @@ -628,7 +628,7 @@ def setupwordpress(self, data, vhostonly=False): wp_creds = dict(wp_user=wo_wp_user, wp_pass=wo_wp_pass, wp_email=wo_wp_email) - return(wp_creds) + return (wp_creds) def setupwordpressnetwork(self, data): @@ -990,8 +990,8 @@ def site_package_check(self, stype): "/usr/local/sbin/install-ngxblocker", "ngxblocker"]] - return(stack.install(apt_packages=apt_packages, packages=packages, - disp_msg=False)) + return (stack.install(apt_packages=apt_packages, packages=packages, + disp_msg=False)) def updatewpuserpassword(self, wo_domain, wo_site_webroot): diff --git a/wo/cli/plugins/site_update.py b/wo/cli/plugins/site_update.py index 4b23c0e..2b06e5d 100644 --- a/wo/cli/plugins/site_update.py +++ b/wo/cli/plugins/site_update.py @@ -276,7 +276,8 @@ class WOSiteUpdateController(CementBaseController): if (((stype == 'php' and oldsitetype not in ['html', 'proxy', 'php', 'php72', - 'php73', 'php74', 'php80', 'php81']) or + 'php73', 'php74', 'php80', + 'php81', 'php82']) or (stype == 'mysql' and oldsitetype not in [ 'html', 'php', 'php72', 'php73', 'php74', 'php80', 'php81', 'php82', 'proxy']) or @@ -337,7 +338,7 @@ class WOSiteUpdateController(CementBaseController): (not data)): Log.debug( self, "pargs php72, or php73, or php74, " - "or php80, or php81 enabled") + "or php80, or php81 or php82 enabled") data = dict( site_name=wo_domain, www_domain=wo_www_domain, From 67fdae30832876159469b1c23c4b0046fce07c49 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Sun, 11 Dec 2022 18:36:32 +0100 Subject: [PATCH 08/12] Remove adminer from tests --- tests/travis.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/travis.sh b/tests/travis.sh index 45e18c5..b4cec66 100644 --- a/tests/travis.sh +++ b/tests/travis.sh @@ -32,9 +32,9 @@ echo -e "${CGREEN}#############################################${CEND}" echo -e ' stack install ' echo -e "${CGREEN}#############################################${CEND}" if [ "$wo_distro" != "xenial" ]; then -stack_list='nginx php php73 php74 php80 php81 php82 mysql redis fail2ban clamav proftpd netdata phpmyadmin composer dashboard extplorer adminer redis sendmail phpredisadmin mysqltuner utils ufw cheat nanorc' +stack_list='nginx php php73 php74 php80 php81 php82 mysql redis fail2ban clamav proftpd netdata phpmyadmin composer dashboard extplorer redis sendmail phpredisadmin mysqltuner utils ufw cheat nanorc' else -stack_list='nginx php php73 php74 php80 php81 php82 mysql redis fail2ban clamav proftpd netdata phpmyadmin composer dashboard extplorer adminer redis phpredisadmin mysqltuner utils ufw cheat nanorc' +stack_list='nginx php php73 php74 php80 php81 php82 mysql redis fail2ban clamav proftpd netdata phpmyadmin composer dashboard extplorer redis phpredisadmin mysqltuner utils ufw cheat nanorc' fi for stack in $stack_list; do echo -ne " Installing $stack [..]\r" From 55572c003fdab5a939c3fe3c7b4a62e4b48741e5 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Thu, 22 Dec 2022 22:22:40 +0100 Subject: [PATCH 09/12] Fix php82 --- wo/core/stackconf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wo/core/stackconf.py b/wo/core/stackconf.py index 992ef28..d065bf9 100644 --- a/wo/core/stackconf.py +++ b/wo/core/stackconf.py @@ -12,7 +12,7 @@ class WOConf(): def nginxcommon(self): """nginx common configuration deployment""" - wo_php_version = ["php72", "php73", "php74", "php80", "php81"] + wo_php_version = ["php72", "php73", "php74", "php80", "php81", "php82"] ngxcom = '/etc/nginx/common' if not os.path.exists(ngxcom): os.mkdir(ngxcom) From 7e1a1bbf9c42c29a7d2f5d0bf6d42c0caa225f61 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Thu, 22 Dec 2022 22:37:59 +0100 Subject: [PATCH 10/12] Fix missing and --- wo/cli/plugins/site_update.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wo/cli/plugins/site_update.py b/wo/cli/plugins/site_update.py index 2b06e5d..901616e 100644 --- a/wo/cli/plugins/site_update.py +++ b/wo/cli/plugins/site_update.py @@ -579,7 +579,7 @@ class WOSiteUpdateController(CementBaseController): if ((php73 is old_php73) and (php72 is old_php72) and (php74 is old_php74) and (php80 is old_php80) and - (php81 is old_php81) and (php82 is old_php82) + (php81 is old_php81) and (php82 is old_php82) and (stype == oldsitetype and cache == oldcachetype)): Log.debug(self, "Nothing to update") From 3ea6c862567782a7a11ce37bdbb085add840da3b Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Thu, 22 Dec 2022 23:17:00 +0100 Subject: [PATCH 11/12] Update Changelog and install --- CHANGELOG.md | 19 ++++++++++++++++++- config/wo.conf | 4 ++-- install | 2 +- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 790d504..6ec6981 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,24 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## Releases -### v3.16.0 - [Unreleased] +### v3.17.0 - [Unreleased] + +### v3.16.0 - 2022-12-22 + +#### Added + +- Add PHP 8.2 support ([PR #482](https://github.com/WordOps/WordOps/pull/483)) @janiosarmento +- Prompt user before WordOps update with `wo update` + +#### Changed + +- Default PHP version bumped to 8.1 + +#### Fixed + +- psutil dependency upgrade +- Fix wrong else statements in stack_services.py ([PR #475](https://github.com/WordOps/WordOps/pull/475)) @stodorovic + ### v3.15.4 - 2022-10-25 diff --git a/config/wo.conf b/config/wo.conf index ceb2827..698f601 100644 --- a/config/wo.conf +++ b/config/wo.conf @@ -79,12 +79,12 @@ keylength = "ec-384" [php] ### Default PHP version -version = 8.0 +version = 8.1 [mariadb] ### Default MariaDB release -release = 10.5 +release = 10.6 [update] diff --git a/install b/install index 8b8db81..ea4110b 100755 --- a/install +++ b/install @@ -9,7 +9,7 @@ # ------------------------------------------------------------------------- # wget -qO wo wops.cc && sudo -E bash wo # ------------------------------------------------------------------------- -# Version 3.16.0 - 2022-11-14 +# Version 3.16.0 - 2022-12-22 # ------------------------------------------------------------------------- # CONTENTS From 67ff78e0778f693eae1ea14212542150c1717c05 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Fri, 23 Dec 2022 08:11:44 +0100 Subject: [PATCH 12/12] Update version, fix psutil install --- install | 5 +++-- wo/cli/controllers/base.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/install b/install index ea4110b..00d5581 100755 --- a/install +++ b/install @@ -9,7 +9,7 @@ # ------------------------------------------------------------------------- # wget -qO wo wops.cc && sudo -E bash wo # ------------------------------------------------------------------------- -# Version 3.16.0 - 2022-12-22 +# Version 3.16.0 - 2022-12-23 # ------------------------------------------------------------------------- # CONTENTS @@ -445,7 +445,7 @@ wo_install() { python3 -m pip uninstall setuptools -y python3 -m pip install -I setuptools==57.5.0 python3 -m pip install -U pip wheel - python3 -m pip uninstall psutil + python3 -m pip uninstall psutil -y else rm -rf /opt/wo python3 -m venv /opt/wo @@ -510,6 +510,7 @@ wo_travis_install() { python3 -m pip uninstall setuptools -y python3 -m pip install -I setuptools==57.5.0 python3 -m pip install -U pip wheel + python3 -m pip uninstall psutil -y else rm -rf /opt/wo python3 -m venv /opt/wo diff --git a/wo/cli/controllers/base.py b/wo/cli/controllers/base.py index 4078777..9d56468 100644 --- a/wo/cli/controllers/base.py +++ b/wo/cli/controllers/base.py @@ -8,7 +8,7 @@ VERSION = WOVar.wo_version BANNER = """ WordOps v%s -Copyright (c) 2022 WordOps. +Copyright (c) 2023 WordOps. """ % VERSION