Add php8.3 support

This commit is contained in:
VirtuBox
2023-11-23 21:33:09 +01:00
parent c10e3b52c5
commit f699012b9b
8 changed files with 101 additions and 73 deletions

View File

@@ -629,7 +629,7 @@ class WOInfoController(CementBaseController):
if (not pargs.nginx and not pargs.php and if (not pargs.nginx and not pargs.php and
not pargs.mysql and not pargs.php73 and not pargs.mysql and not pargs.php73 and
not pargs.php74 and not pargs.php80 and not pargs.php74 and not pargs.php80 and
not pargs.php81 and not pargs.php82): not pargs.php81 and not pargs.php82) and not (pargs.php83):
pargs.nginx = True pargs.nginx = True
pargs.php = True pargs.php = True
pargs.mysql = True pargs.mysql = True
@@ -643,6 +643,8 @@ class WOInfoController(CementBaseController):
pargs.php81 = True pargs.php81 = True
if WOAptGet.is_installed(self, 'php8.2-fpm'): if WOAptGet.is_installed(self, 'php8.2-fpm'):
pargs.php82 = True pargs.php82 = True
if WOAptGet.is_installed(self, 'php8.3-fpm'):
pargs.php83 = True
if pargs.nginx: if pargs.nginx:
if ((not WOAptGet.is_installed(self, 'nginx-custom')) and if ((not WOAptGet.is_installed(self, 'nginx-custom')) and

View File

@@ -186,7 +186,7 @@ class WOSiteCreateController(CementBaseController):
data['basic'] = True data['basic'] = True
if (pargs.php72 or pargs.php73 or pargs.php74 or if (pargs.php72 or pargs.php73 or pargs.php74 or
pargs.php80 or pargs.php81 or pargs.php82): pargs.php80 or pargs.php81 or pargs.php82 or pargs.php83):
data = dict( data = dict(
site_name=wo_domain, www_domain=wo_www_domain, site_name=wo_domain, www_domain=wo_www_domain,
static=False, basic=False, static=False, basic=False,

View File

@@ -775,7 +775,7 @@ def sitebackup(self, data):
.format(data['site_name']), backup_path) .format(data['site_name']), backup_path)
if data['currsitetype'] in ['html', 'php', 'php72', 'php74', if data['currsitetype'] in ['html', 'php', 'php72', 'php74',
'php73', 'php80', 'php81', 'php82', 'php73', 'php80', 'php81', 'php82', 'php83'
'proxy', 'mysql']: 'proxy', 'mysql']:
if not data['wp']: if not data['wp']:
Log.info(self, "Backing up Webroot \t\t", end='') Log.info(self, "Backing up Webroot \t\t", end='')
@@ -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', 'alias']: 'wpsubdomain', 'php73', 'php74', 'php80', 'php81', 'php82', 'php83', '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
@@ -872,7 +872,7 @@ def site_package_check(self, stype):
wo_nginx.write('fastcgi_param \tSCRIPT_FILENAME ' wo_nginx.write('fastcgi_param \tSCRIPT_FILENAME '
'\t$request_filename;\n') '\t$request_filename;\n')
php_versions = ['php72', 'php73', 'php74', 'php80', 'php81', 'php82'] php_versions = ['php72', 'php73', 'php74', 'php80', 'php81', 'php82', 'php83']
selected_versions = [version for version in php_versions if getattr(pargs, version)] selected_versions = [version for version in php_versions if getattr(pargs, version)]
if len(selected_versions) > 1: if len(selected_versions) > 1:
@@ -881,6 +881,7 @@ def site_package_check(self, stype):
if ((not pargs.php72) and (not pargs.php73) and (not pargs.php74) and if ((not pargs.php72) and (not pargs.php73) and (not pargs.php74) and
(not pargs.php80) and (not pargs.php81) and (not pargs.php82) and (not pargs.php80) and (not pargs.php81) and (not pargs.php82) and
(not pargs.php83) and
stype in ['php', 'mysql', 'wp', 'wpsubdir', stype in ['php', 'mysql', 'wp', 'wpsubdir',
'wpsubdomain']): 'wpsubdomain']):
Log.debug(self, "Setting apt_packages variable for PHP") Log.debug(self, "Setting apt_packages variable for PHP")
@@ -1082,7 +1083,7 @@ def detSitePar(opts):
for key, val in opts.items(): for key, val in opts.items():
if val and key in ['html', 'php', 'mysql', 'wp', if val and key in ['html', 'php', 'mysql', 'wp',
'wpsubdir', 'wpsubdomain', 'php72', 'wpsubdir', 'wpsubdomain', 'php72',
'php73', 'php74', 'php80', 'php81', 'php82', ]: 'php73', 'php74', 'php80', 'php81', 'php82', 'php83']:
typelist.append(key) typelist.append(key)
elif val and key in ['wpfc', 'wpsc', 'wpredis', 'wprocket', 'wpce']: elif val and key in ['wpfc', 'wpsc', 'wpredis', 'wprocket', 'wpce']:
cachelist.append(key) cachelist.append(key)
@@ -1134,6 +1135,12 @@ def detSitePar(opts):
cachetype = 'basic' cachetype = 'basic'
else: else:
cachetype = cachelist[0] cachetype = cachelist[0]
elif False not in [x in ('php83', '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]: elif False not in [x in ('php', 'mysql') for x in typelist]:
sitetype = 'mysql' sitetype = 'mysql'
if not cachelist: if not cachelist:
@@ -1176,6 +1183,12 @@ def detSitePar(opts):
cachetype = 'basic' cachetype = 'basic'
else: else:
cachetype = cachelist[0] cachetype = cachelist[0]
elif False not in [x in ('php83', '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]: elif False not in [x in ('html', 'mysql') for x in typelist]:
sitetype = 'mysql' sitetype = 'mysql'
if not cachelist: if not cachelist:
@@ -1236,6 +1249,12 @@ def detSitePar(opts):
cachetype = 'basic' cachetype = 'basic'
else: else:
cachetype = cachelist[0] cachetype = cachelist[0]
elif False not in [x in ('wp', 'php83') 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]: elif False not in [x in ('wpsubdir', 'php72') for x in typelist]:
sitetype = 'wpsubdir' sitetype = 'wpsubdir'
if not cachelist: if not cachelist:
@@ -1272,6 +1291,12 @@ def detSitePar(opts):
cachetype = 'basic' cachetype = 'basic'
else: else:
cachetype = cachelist[0] cachetype = cachelist[0]
elif False not in [x in ('wpsubdir', 'php83') 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]: elif False not in [x in ('wpsubdomain', 'php72') for x in typelist]:
sitetype = 'wpsubdomain' sitetype = 'wpsubdomain'
if not cachelist: if not cachelist:
@@ -1308,6 +1333,12 @@ def detSitePar(opts):
cachetype = 'basic' cachetype = 'basic'
else: else:
cachetype = cachelist[0] cachetype = cachelist[0]
elif False not in [x in ('wpsubdomain', 'php83') for x in typelist]:
sitetype = 'wpsubdomain'
if not cachelist:
cachetype = 'basic'
else:
cachetype = cachelist[0]
else: else:
raise RuntimeError("could not determine site and cache type") raise RuntimeError("could not determine site and cache type")
else: else:
@@ -1332,6 +1363,9 @@ def detSitePar(opts):
elif (not typelist or "php82" in typelist) and cachelist: elif (not typelist or "php82" in typelist) and cachelist:
sitetype = 'wp' sitetype = 'wp'
cachetype = cachelist[0] cachetype = cachelist[0]
elif (not typelist or "php83" in typelist) and cachelist:
sitetype = 'wp'
cachetype = cachelist[0]
elif typelist and (not cachelist): elif typelist and (not cachelist):
sitetype = typelist[0] sitetype = typelist[0]
cachetype = 'basic' cachetype = 'basic'

View File

@@ -188,7 +188,7 @@ class WOSiteUpdateController(CementBaseController):
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
pargs.php74 or pargs.php80 or pargs.php81 or pargs.php82 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.php83 or pargs.mysql or pargs.wp or pargs.wpfc or pargs.wpsc or
pargs.wprocket or pargs.wpce or pargs.wprocket or pargs.wpce or
pargs.wpsubdir or pargs.wpsubdomain)): pargs.wpsubdir or pargs.wpsubdomain)):
@@ -256,20 +256,20 @@ class WOSiteUpdateController(CementBaseController):
if (((stype == 'php' and if (((stype == 'php' and
oldsitetype not in ['html', 'proxy', 'php', 'php72', oldsitetype not in ['html', 'proxy', 'php', 'php72',
'php73', 'php74', 'php80', 'php73', 'php74', 'php80',
'php81', 'php82']) or 'php81', 'php82', 'php83']) or
(stype == 'mysql' and oldsitetype not in [ (stype == 'mysql' and oldsitetype not in [
'html', 'php', 'php72', 'php73', 'php74', 'php80', 'php81', 'html', 'php', 'php72', 'php73', 'php74', 'php80', 'php81',
'php82', 'proxy']) or 'php82', 'php83', 'proxy']) or
(stype == 'wp' and oldsitetype not in [ (stype == 'wp' and oldsitetype not in [
'html', 'php', 'php72', 'php73', 'php74', 'php80', 'php81', 'html', 'php', 'php72', 'php73', 'php74', 'php80', 'php81',
'php82', 'mysql', 'proxy', 'wp']) or 'php82', 'php83', 'mysql', 'proxy', 'wp']) or
(stype == 'wpsubdir' and oldsitetype in ['wpsubdomain']) or (stype == 'wpsubdir' and oldsitetype in ['wpsubdomain']) or
(stype == 'wpsubdomain' and oldsitetype in ['wpsubdir']) or (stype == 'wpsubdomain' and oldsitetype in ['wpsubdir']) or
(stype == oldsitetype and cache == oldcachetype)) and (stype == oldsitetype and cache == oldcachetype)) and
not (pargs.php72 or pargs.php73 or not (pargs.php72 or pargs.php73 or
pargs.php74 or pargs.php80 or pargs.php74 or pargs.php80 or
pargs.php81 or pargs.php82 or pargs.php81 or pargs.php82 or
pargs.alias)): pargs.php83 or pargs.alias)):
Log.info(self, Log.FAIL + "can not update {0} {1} to {2} {3}". Log.info(self, Log.FAIL + "can not update {0} {1} to {2} {3}".
format(oldsitetype, oldcachetype, stype, cache)) format(oldsitetype, oldcachetype, stype, cache))
return 1 return 1
@@ -298,7 +298,7 @@ class WOSiteUpdateController(CementBaseController):
site_name=wo_domain, www_domain=wo_www_domain, site_name=wo_domain, www_domain=wo_www_domain,
static=False, basic=True, wp=False, wpfc=False, static=False, basic=True, wp=False, wpfc=False,
php72=False, php73=False, php74=False, php72=False, php73=False, php74=False,
php80=False, php81=False, php82=False, php80=False, php81=False, php82=False, php83=False,
wpsc=False, wpredis=False, wprocket=False, wpce=False, wpsc=False, wpredis=False, wprocket=False, wpce=False,
multisite=False, wpsubdir=False, webroot=wo_site_webroot, multisite=False, wpsubdir=False, webroot=wo_site_webroot,
currsitetype=oldsitetype, currcachetype=oldcachetype) currsitetype=oldsitetype, currcachetype=oldcachetype)
@@ -323,11 +323,11 @@ class WOSiteUpdateController(CementBaseController):
data['wpsubdir'] = True data['wpsubdir'] = True
if ((pargs.php72 or pargs.php73 or pargs.php74 or if ((pargs.php72 or pargs.php73 or pargs.php74 or
pargs.php80 or pargs.php81 or pargs.php82) and pargs.php80 or pargs.php81 or pargs.php82 or pargs.php83) and
(not data)): (not data)):
Log.debug( Log.debug(
self, "pargs php72, or php73, or php74, " self, "pargs php72, or php73, or php74, "
"or php80, or php81 or php82 enabled") "or php80, or php81 or php82 or php83 enabled")
data = dict( data = dict(
site_name=wo_domain, site_name=wo_domain,
www_domain=wo_www_domain, www_domain=wo_www_domain,
@@ -344,7 +344,7 @@ class WOSiteUpdateController(CementBaseController):
elif (oldsitetype == 'php' or oldsitetype == 'mysql' or elif (oldsitetype == 'php' or oldsitetype == 'mysql' or
oldsitetype == 'php73' or oldsitetype == 'php74' or oldsitetype == 'php73' or oldsitetype == 'php74' or
oldsitetype == 'php80' or oldsitetype == 'php81' or oldsitetype == 'php80' or oldsitetype == 'php81' or
oldsitetype == 'php82'): oldsitetype == 'php82' or oldsitetype == 'php83'):
data['static'] = False data['static'] = False
data['wp'] = False data['wp'] = False
data['multisite'] = False data['multisite'] = False
@@ -396,7 +396,8 @@ class WOSiteUpdateController(CementBaseController):
if (data and (not pargs.php73) and if (data and (not pargs.php73) and
(not pargs.php74) and (not pargs.php72) and (not pargs.php74) and (not pargs.php72) and
(not pargs.php80) and (not pargs.php81) and (not pargs.php82)): (not pargs.php80) and (not pargs.php81) and (not pargs.php82)
and (not pargs.php83)):
data[pargs_version] = bool(old_version_var is True) data[pargs_version] = bool(old_version_var is True)
Log.debug( Log.debug(
self, f"data {pargs_version} = {data[pargs_version]}") self, f"data {pargs_version} = {data[pargs_version]}")
@@ -798,7 +799,7 @@ class WOSiteUpdateController(CementBaseController):
# Setup WordPress if old sites are html/php/mysql sites # Setup WordPress if old sites are html/php/mysql sites
if data['wp'] and oldsitetype in ['html', 'proxy', 'php', 'php72', if data['wp'] and oldsitetype in ['html', 'proxy', 'php', 'php72',
'mysql', 'php73', 'php74', 'php80', 'mysql', 'php73', 'php74', 'php80',
'php81', 'php82']: 'php81', 'php82', 'php83']:
try: try:
wo_wp_creds = setupwordpress(self, data) wo_wp_creds = setupwordpress(self, data)
except SiteError as e: except SiteError as e:

View File

@@ -130,6 +130,7 @@ class WOStackController(CementBaseController):
pargs.php80 = True pargs.php80 = True
pargs.php81 = True pargs.php81 = True
pargs.php82 = True pargs.php82 = True
pargs.php83 = True
pargs.redis = True pargs.redis = True
pargs.proftpd = True pargs.proftpd = True
@@ -188,6 +189,7 @@ class WOStackController(CementBaseController):
'php80': WOVar.wo_php80, 'php80': WOVar.wo_php80,
'php81': WOVar.wo_php81, 'php81': WOVar.wo_php81,
'php82': WOVar.wo_php82, 'php82': WOVar.wo_php82,
'php83': WOVar.wo_php83,
} }
for parg_version, version in WOVar.wo_php_versions.items(): for parg_version, version in WOVar.wo_php_versions.items():
@@ -554,6 +556,7 @@ class WOStackController(CementBaseController):
pargs.php80 = True pargs.php80 = True
pargs.php81 = True pargs.php81 = True
pargs.php82 = True pargs.php82 = True
pargs.php83 = True
pargs.fail2ban = True pargs.fail2ban = True
pargs.proftpd = True pargs.proftpd = True
pargs.utils = True pargs.utils = True
@@ -596,6 +599,7 @@ class WOStackController(CementBaseController):
'php80': WOVar.wo_php80, 'php80': WOVar.wo_php80,
'php81': WOVar.wo_php81, 'php81': WOVar.wo_php81,
'php82': WOVar.wo_php82, 'php82': WOVar.wo_php82,
'php83': WOVar.wo_php83,
} }
# Loop through all versions. # Loop through all versions.
@@ -856,6 +860,7 @@ class WOStackController(CementBaseController):
pargs.php80 = True pargs.php80 = True
pargs.php81 = True pargs.php81 = True
pargs.php82 = True pargs.php82 = True
pargs.php83 = True
pargs.fail2ban = True pargs.fail2ban = True
pargs.proftpd = True pargs.proftpd = True
pargs.utils = True pargs.utils = True
@@ -891,63 +896,24 @@ class WOStackController(CementBaseController):
else: else:
Log.info(self, "Nginx is not installed") Log.info(self, "Nginx is not installed")
# PHP 7.2 wo_vars = {
if pargs.php72: 'php72': WOVar.wo_php72,
Log.debug(self, "Setting apt_packages variable for PHP 7.2") 'php73': WOVar.wo_php73,
if (WOAptGet.is_installed(self, 'php7.2-fpm')): 'php74': WOVar.wo_php74,
apt_packages = apt_packages + WOVar.wo_php72 'php80': WOVar.wo_php80,
else: 'php81': WOVar.wo_php81,
Log.debug(self, "PHP 7.2 is not installed") 'php82': WOVar.wo_php82,
Log.info(self, "PHP 7.2 is not installed") 'php83': WOVar.wo_php83,
}
# PHP 7.3 for parg_version, version in WOVar.wo_php_versions.items():
if pargs.php73: if getattr(pargs, parg_version, False):
Log.debug(self, "Setting apt_packages variable for PHP 7.3") Log.debug(self, f"Setting apt_packages variable for PHP {version}")
if WOAptGet.is_installed(self, 'php7.3-fpm'): if not WOAptGet.is_installed(self, f'php{version}-fpm'):
apt_packages = apt_packages + WOVar.wo_php73 apt_packages = apt_packages + wo_vars[parg_version]
else: else:
Log.debug(self, "PHP 7.3 is not installed") Log.debug(self, f"PHP {version} already purged")
Log.info(self, "PHP 7.3 is not installed") Log.info(self, f"PHP {version} already purged")
# PHP 7.4
if pargs.php74:
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
else:
Log.debug(self, "PHP 7.4 is not installed")
Log.info(self, "PHP 7.4 is not installed")
# PHP 8.0
if pargs.php80:
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
else:
Log.debug(self, "PHP 8.0 is not installed")
Log.info(self, "PHP 8.0 is not installed")
# PHP 8.1
if pargs.php81:
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
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_php82
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 # REDIS
if pargs.redis: if pargs.redis:

View File

@@ -107,6 +107,7 @@ class WOStackUpgradeController(CementBaseController):
pargs.php80 = True pargs.php80 = True
pargs.php81 = True pargs.php81 = True
pargs.php82 = True pargs.php82 = True
pargs.php83 = True
pargs.mysql = True pargs.mysql = True
pargs.wpcli = True pargs.wpcli = True
@@ -141,6 +142,7 @@ class WOStackUpgradeController(CementBaseController):
'php80': WOVar.wo_php80, 'php80': WOVar.wo_php80,
'php81': WOVar.wo_php81, 'php81': WOVar.wo_php81,
'php82': WOVar.wo_php82, 'php82': WOVar.wo_php82,
'php83': WOVar.wo_php83,
} }
for parg_version, version in WOVar.wo_php_versions.items(): for parg_version, version in WOVar.wo_php_versions.items():

View File

@@ -145,6 +145,26 @@ upstream debug82 {
server 127.0.0.1:9177; server 127.0.0.1:9177;
} }
#-------------------------------
# PHP 8.3
#-------------------------------
# PHP 8.3 upstream with load-balancing on two unix sockets
upstream php83 {
least_conn;
server unix:/var/run/php/php83-fpm.sock;
server unix:/var/run/php/php83-two-fpm.sock;
keepalive 5;
}
# PHP 8.3 debug
upstream debug83 {
# Debug Pool
server 127.0.0.1:9178;
}
#------------------------------- #-------------------------------
# Netdata # Netdata
#------------------------------- #-------------------------------
@@ -177,4 +197,5 @@ upstream multiphp {
server unix:/var/run/php/php80-fpm.sock; server unix:/var/run/php/php80-fpm.sock;
server unix:/var/run/php/php81-fpm.sock; server unix:/var/run/php/php81-fpm.sock;
server unix:/var/run/php/php82-fpm.sock; server unix:/var/run/php/php82-fpm.sock;
server unix:/var/run/php/php83-fpm.sock;
} }

View File

@@ -157,6 +157,7 @@ class WOVar():
'php80': '8.0', 'php80': '8.0',
'php81': '8.1', 'php81': '8.1',
'php82': '8.2', 'php82': '8.2',
'php83': '8.3',
} }
def generate_php_modules(version_prefix, version_number): def generate_php_modules(version_prefix, version_number):
@@ -179,6 +180,7 @@ class WOVar():
wo_php80 = generate_php_modules('php80', '8.0') wo_php80 = generate_php_modules('php80', '8.0')
wo_php81 = generate_php_modules('php81', '8.1') wo_php81 = generate_php_modules('php81', '8.1')
wo_php82 = generate_php_modules('php82', '8.2') wo_php82 = generate_php_modules('php82', '8.2')
wo_php83 = generate_php_modules('php83', '8.3')
wo_php_extra = ["graphviz"] wo_php_extra = ["graphviz"]