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/') os.makedirs('/var/lib/wo/tmp/')
setup(name='wordops', setup(name='wordops',
version='3.17.0', version='3.18.0',
description='An essential toolset that eases server administration', description='An essential toolset that eases server administration',
long_description=LONG, long_description=LONG,
long_description_content_type='text/markdown', long_description_content_type='text/markdown',

View File

@@ -836,7 +836,7 @@ def site_package_check(self, stype):
stack.app = self.app stack.app = self.app
pargs = self.app.pargs pargs = self.app.pargs
if stype in ['html', 'proxy', 'php', 'php72', 'mysql', 'wp', 'wpsubdir', 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") Log.debug(self, "Setting apt_packages variable for Nginx")
# Check if server has nginx-custom package # Check if server has nginx-custom package

View File

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

View File

@@ -114,19 +114,7 @@ class WOStackController(CementBaseController):
try: try:
# Default action for stack installation # Default action for stack installation
if not (pargs.web or pargs.admin or pargs.nginx or if all(value is None or value is False for value in vars(pargs).values()):
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):
pargs.web = True pargs.web = True
pargs.admin = True pargs.admin = True
pargs.fail2ban = True pargs.fail2ban = True
@@ -549,23 +537,7 @@ class WOStackController(CementBaseController):
apt_packages = [] apt_packages = []
packages = [] packages = []
pargs = self.app.pargs pargs = self.app.pargs
if ((not pargs.web) and (not pargs.admin) and if all(value is None or value is False for value in vars(pargs).values()):
(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)):
self.app.args.print_help() self.app.args.print_help()
if pargs.php: if pargs.php:
@@ -866,24 +838,7 @@ class WOStackController(CementBaseController):
packages = [] packages = []
pargs = self.app.pargs pargs = self.app.pargs
# Default action for stack purge # Default action for stack purge
if ((not pargs.web) and (not pargs.admin) and if all(value is None or value is False for value in vars(pargs).values()):
(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)):
self.app.args.print_help() self.app.args.print_help()
if pargs.php: if pargs.php:
@@ -945,9 +900,6 @@ class WOStackController(CementBaseController):
Log.debug(self, "Setting apt_packages variable for PHP 7.2") Log.debug(self, "Setting apt_packages variable for PHP 7.2")
if (WOAptGet.is_installed(self, 'php7.2-fpm')): if (WOAptGet.is_installed(self, 'php7.2-fpm')):
apt_packages = apt_packages + WOVar.wo_php72 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: else:
Log.debug(self, "PHP 7.2 is not installed") Log.debug(self, "PHP 7.2 is not installed")
Log.info(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") Log.debug(self, "Setting apt_packages variable for PHP 7.3")
if WOAptGet.is_installed(self, 'php7.3-fpm'): if WOAptGet.is_installed(self, 'php7.3-fpm'):
apt_packages = apt_packages + WOVar.wo_php73 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: else:
Log.debug(self, "PHP 7.3 is not installed") Log.debug(self, "PHP 7.3 is not installed")
Log.info(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") Log.debug(self, "Setting apt_packages variable for PHP 7.4")
if WOAptGet.is_installed(self, 'php7.4-fpm'): if WOAptGet.is_installed(self, 'php7.4-fpm'):
apt_packages = apt_packages + WOVar.wo_php74 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: else:
Log.debug(self, "PHP 7.4 is not installed") Log.debug(self, "PHP 7.4 is not installed")
Log.info(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") Log.debug(self, "Setting apt_packages variable for PHP 8.0")
if WOAptGet.is_installed(self, 'php8.0-fpm'): if WOAptGet.is_installed(self, 'php8.0-fpm'):
apt_packages = apt_packages + WOVar.wo_php80 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: else:
Log.debug(self, "PHP 8.0 is not installed") Log.debug(self, "PHP 8.0 is not installed")
Log.info(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") Log.debug(self, "Setting apt_packages variable for PHP 8.1")
if WOAptGet.is_installed(self, 'php8.1-fpm'): if WOAptGet.is_installed(self, 'php8.1-fpm'):
apt_packages = apt_packages + WOVar.wo_php81 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: else:
Log.debug(self, "PHP 8.1 is not installed") 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")
@@ -1019,13 +947,6 @@ class WOStackController(CementBaseController):
Log.debug(self, "Setting apt_packages variable for PHP 8.2") Log.debug(self, "Setting apt_packages variable for PHP 8.2")
if WOAptGet.is_installed(self, 'php8.2-fpm'): if WOAptGet.is_installed(self, 'php8.2-fpm'):
apt_packages = apt_packages + WOVar.wo_php82 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: else:
Log.debug(self, "PHP 8.2 is not installed") 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")

View File

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

View File

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

View File

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