Merge pull request #559 from WordOps/updating-configuration

Improve php versions and refactor code
This commit is contained in:
VirtuBox
2023-08-13 09:03:57 +02:00
committed by GitHub
7 changed files with 111 additions and 594 deletions

View File

@@ -27,7 +27,7 @@ if os.geteuid() == 0:
os.makedirs('/var/lib/wo/tmp/')
setup(name='wordops',
version='3.17.0',
version='3.18.0',
description='An essential toolset that eases server administration',
long_description=LONG,
long_description_content_type='text/markdown',

View File

@@ -836,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', 'php82']:
'wpsubdomain', 'php73', 'php74', 'php80', 'php81', 'php82', 'alias']:
Log.debug(self, "Setting apt_packages variable for Nginx")
# Check if server has nginx-custom package

View File

@@ -61,6 +61,9 @@ class WOSiteUpdateController(CementBaseController):
action='store_true')),
(['--wpredis'],
dict(help="update to redis cache", action='store_true')),
(['--alias'],
dict(help="domain name to redirect to",
action='store', nargs='?')),
(['-le', '--letsencrypt'],
dict(help="configure letsencrypt ssl for the site",
action='store' or 'store_const',
@@ -108,20 +111,9 @@ class WOSiteUpdateController(CementBaseController):
if pargs.html:
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.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
pargs.wpredis or pargs.letsencrypt or pargs.hsts or
pargs.dns or pargs.force):
if all(value is None or value is False for value in vars(pargs).values()):
Log.error(self, "Please provide options to update sites.")
if pargs.all:
if pargs.site_name:
Log.error(self, "`--all` option cannot be used with site name"
" provided")
sites = getAllsites(self)
if not sites:
pass
@@ -139,12 +131,8 @@ class WOSiteUpdateController(CementBaseController):
def doupdatesite(self, pargs):
pargs = self.app.pargs
letsencrypt = False
php73 = False
php74 = False
php72 = False
php80 = False
php81 = False
php82 = False
for pargs_version in WOVar.wo_php_versions:
globals()[pargs_version] = False
data = dict()
try:
@@ -162,10 +150,16 @@ class WOSiteUpdateController(CementBaseController):
proxyinfo = proxyinfo.split(':')
host = proxyinfo[0].strip()
port = '80' if len(proxyinfo) < 2 else proxyinfo[1].strip()
elif stype is None and not (pargs.proxy or pargs.letsencrypt):
elif stype is None and pargs.alias:
stype, cache = 'alias', ''
alias_name = pargs.alias.strip()
if not alias_name:
Log.error(self, "Please provide alias name")
elif stype is None and not (pargs.proxy or
pargs.letsencrypt or pargs.alias):
stype, cache = 'html', 'basic'
elif stype and pargs.proxy:
Log.error(self, "--proxy can not be used with other site types")
elif stype and (pargs.proxy or pargs.alias):
Log.error(self, "--proxy/alias can not be used with other site types")
if not pargs.site_name:
try:
@@ -190,13 +184,6 @@ class WOSiteUpdateController(CementBaseController):
check_ssl = check_site.is_ssl
check_php_version = check_site.php_version
old_php72 = bool(check_php_version == "7.2")
old_php73 = bool(check_php_version == "7.3")
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
@@ -296,6 +283,15 @@ class WOSiteUpdateController(CementBaseController):
data['currsitetype'] = oldsitetype
data['currcachetype'] = oldcachetype
if stype == 'alias':
data['site_name'] = wo_domain
data['www_domain'] = wo_www_domain
data['webroot'] = wo_site_webroot
data['currsitetype'] = oldsitetype
data['currcachetype'] = oldcachetype
data['alias'] = True
data['alias_name'] = alias_name
if stype == 'php':
data = dict(
site_name=wo_domain, www_domain=wo_www_domain,
@@ -368,131 +364,37 @@ class WOSiteUpdateController(CementBaseController):
data['multisite'] = True
data['wpsubdir'] = False
if oldcachetype == 'basic':
data['basic'] = True
data['wpfc'] = False
data['wpsc'] = False
data['wpredis'] = False
data['wprocket'] = False
data['wpce'] = False
elif oldcachetype == 'wpfc':
data['basic'] = False
data['wpfc'] = True
data['wpsc'] = False
data['wpredis'] = False
data['wprocket'] = False
data['wpce'] = False
elif oldcachetype == 'wpsc':
data['basic'] = False
data['wpfc'] = False
data['wpsc'] = True
data['wpredis'] = False
data['wprocket'] = False
data['wpce'] = False
elif oldcachetype == 'wpredis':
data['basic'] = False
data['wpfc'] = False
data['wpsc'] = False
data['wpredis'] = True
data['wprocket'] = False
data['wpce'] = False
elif oldcachetype == 'wprocket':
data['basic'] = False
data['wpfc'] = False
data['wpsc'] = False
data['wpredis'] = False
data['wprocket'] = True
data['wpce'] = False
elif oldcachetype == 'wpce':
data['basic'] = False
data['wpfc'] = False
data['wpsc'] = False
data['wpredis'] = False
data['wprocket'] = False
data['wpce'] = True
# Set all variables to false
data['basic'] = False
data['wpfc'] = False
data['wpsc'] = False
data['wpredis'] = False
data['wprocket'] = False
data['wpce'] = False
if pargs.php72:
Log.debug(self, "pargs.php72 detected")
data['php72'] = True
php72 = True
elif pargs.php73:
Log.debug(self, "pargs.php73 detected")
data['php73'] = True
php73 = True
elif pargs.php74:
Log.debug(self, "pargs.php74 detected")
data['php74'] = True
php74 = True
elif pargs.php80:
Log.debug(self, "pargs.php80 detected")
data['php80'] = True
php80 = True
elif pargs.php81:
Log.debug(self, "pargs.php81 detected")
data['php81'] = True
php81 = True
elif pargs.php82:
Log.debug(self, "pargs.php82 detected")
data['php82'] = True
php82 = True
# set the data if oldcachetype is True
if oldcachetype in data:
data[oldcachetype] = True
if pargs.php72:
if php72 is old_php72:
Log.info(self, "PHP 7.2 is already enabled for given "
"site")
pargs.php72 = False
for pargs_version in WOVar.wo_php_versions:
if getattr(pargs, pargs_version):
Log.debug(self, f"pargs.{pargs_version} detected")
data[pargs_version] = True
globals()[pargs_version] = True
break
if pargs.php73:
if php73 is old_php73:
Log.info(self, "PHP 7.3 is already enabled for given "
"site")
pargs.php73 = False
for pargs_version, version in WOVar.wo_php_versions.items():
old_version_var = bool(check_php_version == version)
if pargs.php74:
if php74 is old_php74:
Log.info(self, "PHP 7.4 is already enabled for given "
"site")
pargs.php74 = False
if getattr(pargs, pargs_version):
if globals()[pargs_version] is old_version_var:
Log.info(self, f"PHP {version} is already enabled for given site")
setattr(pargs, pargs_version, False)
if pargs.php80:
if php80 is old_php80:
Log.info(self, "PHP 8.0 is already enabled for given "
"site")
pargs.php80 = False
if pargs.php81:
if php81 is old_php81:
Log.info(self, "PHP 8.1 is already enabled for given "
"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) 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)
data['php73'] = bool(old_php73 is True)
Log.debug(self, "data php73 = {0}".format(data['php73']))
php73 = bool(old_php73 is True)
data['php74'] = bool(old_php74 is True)
Log.debug(self, "data php74 = {0}".format(data['php74']))
php74 = bool(old_php74 is True)
data['php80'] = bool(old_php80 is True)
Log.debug(self, "data php80 = {0}".format(data['php80']))
php80 = bool(old_php80 is True)
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 (data and not getattr(pargs, pargs_version)):
data[pargs_version] = bool(old_version_var is True)
Log.debug(self, f"data {pargs_version} = {data[pargs_version]}")
globals()[pargs_version] = bool(old_version_var is True)
if pargs.letsencrypt:
acme_domains = []
@@ -569,35 +471,18 @@ class WOSiteUpdateController(CementBaseController):
data['basic'] = False
cache = 'wpce'
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) and
(stype == oldsitetype and
cache == oldcachetype)):
# Vérification si rien n'a changé
if all(globals()[version_key] is bool(check_php_version == version) for version_key,
version in WOVar.wo_php_versions.items()) and (stype == oldsitetype and cache == oldcachetype):
Log.debug(self, "Nothing to update")
return 1
if php73 is True:
data['wo_php'] = 'php73'
check_php_version = '7.3'
elif php74 is True:
data['wo_php'] = 'php74'
check_php_version = '7.4'
elif php72 is True:
data['wo_php'] = 'php72'
check_php_version = '7.2'
elif php80 is True:
data['wo_php'] = 'php80'
check_php_version = '8.0'
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'
# Mise à jour de la version PHP
for pargs_version, version in WOVar.wo_php_versions.items():
if globals()[pargs_version] is True:
data['wo_php'] = pargs_version
check_php_version = version
break
if pargs.hsts:
data['hsts'] = bool(pargs.hsts == "on")

View File

@@ -114,19 +114,7 @@ class WOStackController(CementBaseController):
try:
# 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.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
pargs.mysqlclient or pargs.mysqltuner or
pargs.admin or pargs.adminer or
pargs.utils or pargs.redis or pargs.mariadb or
pargs.proftpd or pargs.extplorer or
pargs.clamav or pargs.cheat or pargs.nanorc or
pargs.ufw or pargs.ngxblocker or
pargs.phpredisadmin or pargs.sendmail or pargs.all):
if all(value is None or value is False for value in vars(pargs).values()):
pargs.web = True
pargs.admin = True
pargs.fail2ban = True
@@ -549,23 +537,7 @@ class WOStackController(CementBaseController):
apt_packages = []
packages = []
pargs = self.app.pargs
if ((not pargs.web) and (not pargs.admin) and
(not pargs.nginx) and (not pargs.php) and
(not pargs.mysql) and (not pargs.wpcli) and
(not pargs.mariadb) and
(not pargs.phpmyadmin) and (not pargs.composer) and
(not pargs.netdata) and (not pargs.dashboard) and
(not pargs.fail2ban) and (not pargs.security) and
(not pargs.mysqlclient) and (not pargs.mysqltuner) and
(not pargs.adminer) and (not pargs.utils) and
(not pargs.redis) and (not pargs.proftpd) and
(not pargs.extplorer) and (not pargs.clamav) and
(not pargs.cheat) and (not pargs.nanorc) and
(not pargs.ufw) and (not pargs.ngxblocker) and
(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.php82) and (not pargs.all)):
if all(value is None or value is False for value in vars(pargs).values()):
self.app.args.print_help()
if pargs.php:
@@ -866,24 +838,7 @@ class WOStackController(CementBaseController):
packages = []
pargs = self.app.pargs
# Default action for stack purge
if ((not pargs.web) and (not pargs.admin) and
(not pargs.nginx) and (not pargs.php) and
(not pargs.mysql) and (not pargs.wpcli) and
(not pargs.mariadb) and
(not pargs.phpmyadmin) and (not pargs.composer) and
(not pargs.netdata) and (not pargs.dashboard) and
(not pargs.fail2ban) and (not pargs.security) and
(not pargs.mysqlclient) and (not pargs.mysqltuner) and
(not pargs.adminer) and (not pargs.utils) and
(not pargs.redis) and (not pargs.proftpd) and
(not pargs.extplorer) and (not pargs.clamav) and
(not pargs.cheat) and (not pargs.nanorc) and
(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)):
if all(value is None or value is False for value in vars(pargs).values()):
self.app.args.print_help()
if pargs.php:
@@ -945,9 +900,6 @@ class WOStackController(CementBaseController):
Log.debug(self, "Setting apt_packages variable for PHP 7.2")
if (WOAptGet.is_installed(self, 'php7.2-fpm')):
apt_packages = apt_packages + WOVar.wo_php72
if not (WOAptGet.is_installed(self, 'php7.3-fpm') or
WOAptGet.is_installed(self, 'php7.4-fpm')):
apt_packages = apt_packages + WOVar.wo_php_extra
else:
Log.debug(self, "PHP 7.2 is not installed")
Log.info(self, "PHP 7.2 is not installed")
@@ -957,12 +909,6 @@ class WOStackController(CementBaseController):
Log.debug(self, "Setting apt_packages variable for PHP 7.3")
if WOAptGet.is_installed(self, 'php7.3-fpm'):
apt_packages = apt_packages + WOVar.wo_php73
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') 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")
Log.info(self, "PHP 7.3 is not installed")
@@ -972,12 +918,6 @@ class WOStackController(CementBaseController):
Log.debug(self, "Setting apt_packages variable for PHP 7.4")
if WOAptGet.is_installed(self, 'php7.4-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, '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")
Log.info(self, "PHP 7.4 is not installed")
@@ -987,12 +927,6 @@ class WOStackController(CementBaseController):
Log.debug(self, "Setting apt_packages variable for PHP 8.0")
if WOAptGet.is_installed(self, 'php8.0-fpm'):
apt_packages = apt_packages + WOVar.wo_php80
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') 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")
Log.info(self, "PHP 8.0 is not installed")
@@ -1002,12 +936,6 @@ class WOStackController(CementBaseController):
Log.debug(self, "Setting apt_packages variable for PHP 8.1")
if WOAptGet.is_installed(self, 'php8.1-fpm'):
apt_packages = apt_packages + WOVar.wo_php81
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.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")
@@ -1019,13 +947,6 @@ class WOStackController(CementBaseController):
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, '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")

View File

@@ -20,19 +20,7 @@ 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
pargs.php82 or
pargs.mysql or
pargs.redis or
pargs.fail2ban or
pargs.proftpd or
pargs.netdata or
pargs.ufw):
if all(value is None or value is False for value in vars(pargs).values()):
pargs.nginx = True
pargs.php = True
pargs.mysql = True
@@ -47,66 +35,16 @@ class WOStackStatusController(CementBaseController):
Log.info(self, "Nginx is not installed")
if pargs.php:
if os.path.exists('{0}'.format(wo_system) + 'php7.2-fpm.service'):
services = services + ['php7.2-fpm']
else:
Log.info(self, "PHP7.2-FPM is not installed")
if os.path.exists('{0}'.format(wo_system) + 'php7.3-fpm.service'):
services = services + ['php7.3-fpm']
else:
Log.info(self, "PHP7.3-FPM is not installed")
if os.path.exists('{0}'.format(wo_system) + 'php7.4-fpm.service'):
services = services + ['php7.4-fpm']
else:
Log.info(self, "PHP7.4-FPM is not installed")
if os.path.exists('{0}'.format(wo_system) + 'php8.0-fpm.service'):
services = services + ['php8.0-fpm']
else:
Log.info(self, "PHP8.0-FPM is not installed")
if os.path.exists('{0}'.format(wo_system) + 'php8.1-fpm.service'):
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")
for parg_version, version in WOVar.wo_php_versions.items():
if os.path.exists(f'{wo_system}' + f'php{version}-fpm.service'):
services = services + [f'php{version}-fpm']
if pargs.php72:
if os.path.exists('{0}'.format(wo_system) + 'php7.2-fpm.service'):
services = services + ['php7.2-fpm']
for parg_version, version in WOVar.wo_php_versions.items():
if (getattr(pargs, parg_version, False) and
os.path.exists(f'{wo_system}' + f'php{version}-fpm.service')):
services = services + [f'php{version}-fpm']
else:
Log.info(self, "PHP7.2-FPM is not installed")
if pargs.php73:
if os.path.exists('{0}'.format(wo_system) + 'php7.3-fpm.service'):
services = services + ['php7.3-fpm']
else:
Log.info(self, "PHP7.3-FPM is not installed")
if pargs.php74:
if os.path.exists('{0}'.format(wo_system) + 'php7.4-fpm.service'):
services = services + ['php7.4-fpm']
else:
Log.info(self, "PHP7.4-FPM is not installed")
if pargs.php80:
if os.path.exists('{0}'.format(wo_system) + 'php8.0-fpm.service'):
services = services + ['php8.0-fpm']
else:
Log.info(self, "PHP8.0-FPM is not installed")
if pargs.php81:
if os.path.exists('{0}'.format(wo_system) + 'php8.1-fpm.service'):
services = services + ['php8.1-fpm']
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")
Log.info(self, f"PHP{version}-FPM is not installed")
if pargs.mysql:
if ((WOVar.wo_mysql_host == "localhost") or
@@ -156,14 +94,7 @@ 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 pargs.php82 or
pargs.mysql or
pargs.fail2ban or
pargs.netdata or
pargs.proftpd or
pargs.redis):
if all(value is None or value is False for value in vars(pargs).values()):
pargs.nginx = True
pargs.php = True
pargs.mysql = True
@@ -175,54 +106,16 @@ class WOStackStatusController(CementBaseController):
Log.info(self, "Nginx is not installed")
if pargs.php:
if os.path.exists('{0}'.format(wo_system) + 'php7.2-fpm.service'):
services = services + ['php7.2-fpm']
else:
Log.info(self, "PHP7.2-FPM is not installed")
if os.path.exists('{0}'.format(wo_system) + 'php7.3-fpm.service'):
services = services + ['php7.3-fpm']
else:
Log.info(self, "PHP7.3-FPM is not installed")
if os.path.exists('{0}'.format(wo_system) + 'php7.4-fpm.service'):
services = services + ['php7.4-fpm']
else:
Log.info(self, "PHP7.4-FPM is not installed")
for parg_version, version in WOVar.wo_php_versions.items():
if os.path.exists(f'{wo_system}' + f'php{version}-fpm.service'):
services = services + [f'php{version}-fpm']
if pargs.php72:
if os.path.exists('{0}'.format(wo_system) + 'php7.2-fpm.service'):
services = services + ['php7.2-fpm']
for parg_version, version in WOVar.wo_php_versions.items():
if (getattr(pargs, parg_version, False) and
os.path.exists(f'{wo_system}' + f'php{version}-fpm.service')):
services = services + [f'php{version}-fpm']
else:
Log.info(self, "PHP7.2-FPM is not installed")
if pargs.php73:
if os.path.exists('{0}'.format(wo_system) + 'php7.3-fpm.service'):
services = services + ['php7.3-fpm']
else:
Log.info(self, "PHP7.3-FPM is not installed")
if pargs.php74:
if os.path.exists('{0}'.format(wo_system) + 'php7.4-fpm.service'):
services = services + ['php7.4-fpm']
else:
Log.info(self, "PHP7.4-FPM is not installed")
if pargs.php80:
if os.path.exists('{0}'.format(wo_system) + 'php8.0-fpm.service'):
services = services + ['php8.0-fpm']
else:
Log.info(self, "PHP8.0-FPM is not installed")
if pargs.php81:
if os.path.exists('{0}'.format(wo_system) + 'php8.1-fpm.service'):
services = services + ['php8.1-fpm']
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")
Log.info(self, f"PHP{version}-FPM is not installed")
if pargs.mysql:
if ((WOVar.wo_mysql_host == "localhost") or
@@ -272,14 +165,7 @@ 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 pargs.php82 or
pargs.mysql or
pargs.netdata or
pargs.proftpd or
pargs.redis or
pargs.fail2ban):
if all(value is None or value is False for value in vars(pargs).values()):
pargs.nginx = True
pargs.php = True
pargs.mysql = True
@@ -292,66 +178,16 @@ class WOStackStatusController(CementBaseController):
Log.info(self, "Nginx is not installed")
if pargs.php:
if os.path.exists('{0}'.format(wo_system) + 'php7.2-fpm.service'):
services = services + ['php7.2-fpm']
else:
Log.info(self, "PHP7.2-FPM is not installed")
if os.path.exists('{0}'.format(wo_system) + 'php7.3-fpm.service'):
services = services + ['php7.3-fpm']
else:
Log.info(self, "PHP7.3-FPM is not installed")
if os.path.exists('{0}'.format(wo_system) + 'php7.4-fpm.service'):
services = services + ['php7.4-fpm']
else:
Log.info(self, "PHP7.4-FPM is not installed")
if os.path.exists('{0}'.format(wo_system) + 'php8.0-fpm.service'):
services = services + ['php8.0-fpm']
else:
Log.info(self, "PHP8.0-FPM is not installed")
if os.path.exists('{0}'.format(wo_system) + 'php8.1-fpm.service'):
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")
for parg_version, version in WOVar.wo_php_versions.items():
if os.path.exists(f'{wo_system}' + f'php{version}-fpm.service'):
services = services + [f'php{version}-fpm']
if pargs.php72:
if os.path.exists('{0}'.format(wo_system) + 'php7.2-fpm.service'):
services = services + ['php7.2-fpm']
for parg_version, version in WOVar.wo_php_versions.items():
if (getattr(pargs, parg_version, False) and
os.path.exists(f'{wo_system}' + f'php{version}-fpm.service')):
services = services + [f'php{version}-fpm']
else:
Log.info(self, "PHP7.2-FPM is not installed")
if pargs.php73:
if os.path.exists('{0}'.format(wo_system) + 'php7.3-fpm.service'):
services = services + ['php7.3-fpm']
else:
Log.info(self, "PHP7.3-FPM is not installed")
if pargs.php74:
if os.path.exists('{0}'.format(wo_system) + 'php7.4-fpm.service'):
services = services + ['php7.4-fpm']
else:
Log.info(self, "PHP7.4-FPM is not installed")
if pargs.php80:
if os.path.exists('{0}'.format(wo_system) + 'php8.0-fpm.service'):
services = services + ['php8.0-fpm']
else:
Log.info(self, "PHP8.0-FPM is not installed")
if pargs.php81:
if os.path.exists('{0}'.format(wo_system) + 'php8.1-fpm.service'):
services = services + ['php8.1-fpm']
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")
Log.info(self, f"PHP{version}-FPM is not installed")
if pargs.mysql:
if ((WOVar.wo_mysql_host == "localhost") or
@@ -401,18 +237,7 @@ 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
pargs.php82 or
pargs.mysql or
pargs.netdata or
pargs.proftpd or
pargs.redis or
pargs.fail2ban):
if all(value is None or value is False for value in vars(pargs).values()):
pargs.nginx = True
pargs.php = True
pargs.mysql = True
@@ -427,66 +252,16 @@ class WOStackStatusController(CementBaseController):
Log.info(self, "Nginx is not installed")
if pargs.php:
if os.path.exists('{0}'.format(wo_system) + 'php7.2-fpm.service'):
services = services + ['php7.2-fpm']
else:
Log.info(self, "PHP7.2-FPM is not installed")
if os.path.exists('{0}'.format(wo_system) + 'php7.3-fpm.service'):
services = services + ['php7.3-fpm']
else:
Log.info(self, "PHP7.3-FPM is not installed")
if os.path.exists('{0}'.format(wo_system) + 'php7.4-fpm.service'):
services = services + ['php7.4-fpm']
else:
Log.info(self, "PHP7.4-FPM is not installed")
if os.path.exists('{0}'.format(wo_system) + 'php8.0-fpm.service'):
services = services + ['php8.0-fpm']
else:
Log.info(self, "PHP8.0-FPM is not installed")
if os.path.exists('{0}'.format(wo_system) + 'php8.1-fpm.service'):
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")
for parg_version, version in WOVar.wo_php_versions.items():
if os.path.exists(f'{wo_system}' + f'php{version}-fpm.service'):
services = services + [f'php{version}-fpm']
if pargs.php72:
if os.path.exists('{0}'.format(wo_system) + 'php7.2-fpm.service'):
services = services + ['php7.2-fpm']
for parg_version, version in WOVar.wo_php_versions.items():
if (getattr(pargs, parg_version, False) and
os.path.exists(f'{wo_system}' + f'php{version}-fpm.service')):
services = services + [f'php{version}-fpm']
else:
Log.info(self, "PHP7.2-FPM is not installed")
if pargs.php73:
if os.path.exists('{0}'.format(wo_system) + 'php7.3-fpm.service'):
services = services + ['php7.3-fpm']
else:
Log.info(self, "PHP7.3-FPM is not installed")
if pargs.php74:
if os.path.exists('{0}'.format(wo_system) + 'php7.4-fpm.service'):
services = services + ['php7.4-fpm']
else:
Log.info(self, "PHP7.4-FPM is not installed")
if pargs.php80:
if os.path.exists('{0}'.format(wo_system) + 'php8.0-fpm.service'):
services = services + ['php8.0-fpm']
else:
Log.info(self, "PHP8.0-FPM is not installed")
if pargs.php81:
if os.path.exists('{0}'.format(wo_system) + 'php8.1-fpm.service'):
services = services + ['php8.1-fpm']
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")
Log.info(self, f"PHP{version}-FPM is not installed")
if pargs.mysql:
if ((WOVar.wo_mysql_host == "localhost") or
@@ -547,14 +322,7 @@ 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 pargs.php82 or
pargs.mysql or
pargs.netdata or
pargs.proftpd or
pargs.redis or
pargs.fail2ban):
if all(value is None or value is False for value in vars(pargs).values()):
pargs.nginx = True
pargs.php = True
pargs.mysql = True
@@ -567,66 +335,16 @@ class WOStackStatusController(CementBaseController):
Log.info(self, "Nginx is not installed")
if pargs.php:
if os.path.exists('{0}'.format(wo_system) + 'php7.2-fpm.service'):
services = services + ['php7.2-fpm']
else:
Log.info(self, "PHP7.2-FPM is not installed")
if os.path.exists('{0}'.format(wo_system) + 'php7.3-fpm.service'):
services = services + ['php7.3-fpm']
else:
Log.info(self, "PHP7.3-FPM is not installed")
if os.path.exists('{0}'.format(wo_system) + 'php7.4-fpm.service'):
services = services + ['php7.4-fpm']
else:
Log.info(self, "PHP7.4-FPM is not installed")
if os.path.exists('{0}'.format(wo_system) + 'php8.0-fpm.service'):
services = services + ['php8.0-fpm']
else:
Log.info(self, "PHP8.0-FPM is not installed")
if os.path.exists('{0}'.format(wo_system) + 'php8.1-fpm.service'):
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")
for parg_version, version in WOVar.wo_php_versions.items():
if os.path.exists(f'{wo_system}' + f'php{version}-fpm.service'):
services = services + [f'php{version}-fpm']
if pargs.php72:
if os.path.exists('{0}'.format(wo_system) + 'php7.2-fpm.service'):
services = services + ['php7.2-fpm']
for parg_version, version in WOVar.wo_php_versions.items():
if (getattr(pargs, parg_version, False) and
os.path.exists(f'{wo_system}' + f'php{version}-fpm.service')):
services = services + [f'php{version}-fpm']
else:
Log.info(self, "PHP7.2-FPM is not installed")
if pargs.php73:
if os.path.exists('{0}'.format(wo_system) + 'php7.3-fpm.service'):
services = services + ['php7.3-fpm']
else:
Log.info(self, "PHP7.3-FPM is not installed")
if pargs.php74:
if os.path.exists('{0}'.format(wo_system) + 'php7.4-fpm.service'):
services = services + ['php7.4-fpm']
else:
Log.info(self, "PHP7.4-FPM is not installed")
if pargs.php80:
if os.path.exists('{0}'.format(wo_system) + 'php8.0-fpm.service'):
services = services + ['php8.0-fpm']
else:
Log.info(self, "PHP8.0-FPM is not installed")
if pargs.php81:
if os.path.exists('{0}'.format(wo_system) + 'php8.1-fpm.service'):
services = services + ['php8.1-fpm']
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")
Log.info(self, f"PHP{version}-FPM is not installed")
if pargs.mysql:
if ((WOVar.wo_mysql_host == "localhost") or

View File

@@ -78,14 +78,7 @@ class WOStackUpgradeController(CementBaseController):
self.msg = []
pargs = self.app.pargs
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.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
pargs.mysqltuner or pargs.redis or
pargs.fail2ban or pargs.security):
if all(value is None or value is False for value in vars(pargs).values()):
pargs.web = True
pargs.admin = True
pargs.security = True

View File

@@ -15,7 +15,7 @@ class WOVar():
"""Intialization of core variables"""
# WordOps version
wo_version = "3.17.0"
wo_version = "3.18.0"
# WordOps packages versions
wo_wp_cli = "2.8.1"
wo_adminer = "4.8.1"