Fix php8.2

This commit is contained in:
VirtuBox
2022-12-11 16:13:33 +01:00
parent ec746c87cc
commit 887cc1d3f0
2 changed files with 45 additions and 11 deletions

View File

@@ -43,6 +43,8 @@ class WOSiteCreateController(CementBaseController):
dict(help="create php 8.0 site", action='store_true')), dict(help="create php 8.0 site", action='store_true')),
(['--php81'], (['--php81'],
dict(help="create php 8.1 site", action='store_true')), dict(help="create php 8.1 site", action='store_true')),
(['--php82'],
dict(help="create php 8.2 site", action='store_true')),
(['--mysql'], (['--mysql'],
dict(help="create mysql site", action='store_true')), dict(help="create mysql site", action='store_true')),
(['--wp'], (['--wp'],
@@ -221,6 +223,7 @@ class WOSiteCreateController(CementBaseController):
data['php72'] = False data['php72'] = False
data['php80'] = False data['php80'] = False
data['php81'] = False data['php81'] = False
data['php82'] = False
if data and pargs.php73: if data and pargs.php73:
data['php73'] = True data['php73'] = True
@@ -237,6 +240,10 @@ class WOSiteCreateController(CementBaseController):
elif data and pargs.php81: elif data and pargs.php81:
data['php81'] = True data['php81'] = True
data['wo_php'] = 'php81' data['wo_php'] = 'php81'
elif data and pargs.php82:
data['php82'] = True
data['wo_php'] = 'php82'
else: else:
if self.app.config.has_section('php'): if self.app.config.has_section('php'):
config_php_ver = self.app.config.get( config_php_ver = self.app.config.get(
@@ -256,6 +263,9 @@ class WOSiteCreateController(CementBaseController):
elif config_php_ver == '8.1': elif config_php_ver == '8.1':
data['php81'] = True data['php81'] = True
data['wo_php'] = 'php81' data['wo_php'] = 'php81'
elif config_php_ver == '8.1':
data['php82'] = True
data['wo_php'] = 'php82'
else: else:
data['php73'] = True data['php73'] = True
data['wo_php'] = 'php73' data['wo_php'] = 'php73'
@@ -329,6 +339,8 @@ class WOSiteCreateController(CementBaseController):
php_version = "8.0" php_version = "8.0"
elif data['php81']: elif data['php81']:
php_version = "8.1" php_version = "8.1"
elif data['php82']:
php_version = "8.2"
else: else:
php_version = "7.3" php_version = "7.3"

View File

@@ -51,6 +51,8 @@ class WOSiteUpdateController(CementBaseController):
dict(help="update to php80 site", action='store_true')), dict(help="update to php80 site", action='store_true')),
(['--php81'], (['--php81'],
dict(help="update to php81 site", action='store_true')), dict(help="update to php81 site", action='store_true')),
(['--php82'],
dict(help="update to php82 site", action='store_true')),
(['--mysql'], (['--mysql'],
dict(help="update to mysql site", action='store_true')), dict(help="update to mysql site", action='store_true')),
(['--wp'], (['--wp'],
@@ -115,7 +117,7 @@ class WOSiteUpdateController(CementBaseController):
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 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.mysql or pargs.wp or pargs.wpsubdir or
pargs.wpsubdomain or pargs.wpfc or pargs.wpsc or pargs.wpsubdomain or pargs.wpfc or pargs.wpsc or
pargs.wprocket or pargs.wpce or pargs.wprocket or pargs.wpce or
@@ -150,6 +152,7 @@ class WOSiteUpdateController(CementBaseController):
php72 = False php72 = False
php80 = False php80 = False
php81 = False php81 = False
php82 = False
data = dict() data = dict()
try: try:
@@ -200,11 +203,12 @@ class WOSiteUpdateController(CementBaseController):
old_php74 = bool(check_php_version == "7.4") old_php74 = bool(check_php_version == "7.4")
old_php80 = bool(check_php_version == "8.0") old_php80 = bool(check_php_version == "8.0")
old_php81 = bool(check_php_version == "8.1") 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
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.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)):
@@ -275,16 +279,16 @@ class WOSiteUpdateController(CementBaseController):
'php73', 'php74', 'php80', 'php81']) or 'php73', 'php74', 'php80', 'php81']) 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',
'proxy']) or 'php82', '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',
'mysql', 'proxy', 'wp']) or 'php82', '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)): pargs.php81 or pargs.php82)):
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
@@ -304,7 +308,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, php80=False, php81=False, php82=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)
@@ -328,8 +332,9 @@ class WOSiteUpdateController(CementBaseController):
if stype == 'wpsubdir': if stype == 'wpsubdir':
data['wpsubdir'] = True data['wpsubdir'] = True
if ((pargs.php72 or pargs.php73 or if ((pargs.php72 or pargs.php73 or pargs.php74 or
pargs.php74 or pargs.php80 or pargs.php81) and (not data)): pargs.php80 or pargs.php81 or pargs.php82) and
(not data)):
Log.debug( Log.debug(
self, "pargs php72, or php73, or php74, " self, "pargs php72, or php73, or php74, "
"or php80, or php81 enabled") "or php80, or php81 enabled")
@@ -348,7 +353,8 @@ class WOSiteUpdateController(CementBaseController):
data['wpsubdir'] = False data['wpsubdir'] = False
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'): oldsitetype == 'php80' or oldsitetype == 'php81' or
oldsitetype == 'php82'):
data['static'] = False data['static'] = False
data['wp'] = False data['wp'] = False
data['multisite'] = False data['multisite'] = False
@@ -432,6 +438,10 @@ class WOSiteUpdateController(CementBaseController):
Log.debug(self, "pargs.php81 detected") Log.debug(self, "pargs.php81 detected")
data['php81'] = True data['php81'] = True
php81 = True php81 = True
elif pargs.php82:
Log.debug(self, "pargs.php82 detected")
data['php82'] = True
php81 = True
if pargs.php72: if pargs.php72:
if php72 is old_php72: if php72 is old_php72:
@@ -463,9 +473,15 @@ class WOSiteUpdateController(CementBaseController):
"site") "site")
pargs.php81 = False 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 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)): (not pargs.php80) and (not pargs.php81) and (not pargs.php82)):
data['php72'] = bool(old_php72 is True) data['php72'] = bool(old_php72 is True)
Log.debug(self, "data php72 = {0}".format(data['php72'])) Log.debug(self, "data php72 = {0}".format(data['php72']))
php72 = bool(old_php72 is True) php72 = bool(old_php72 is True)
@@ -481,6 +497,9 @@ class WOSiteUpdateController(CementBaseController):
data['php81'] = bool(old_php81 is True) data['php81'] = bool(old_php81 is True)
Log.debug(self, "data php81 = {0}".format(data['php81'])) Log.debug(self, "data php81 = {0}".format(data['php81']))
php81 = bool(old_php81 is True) 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 = []
@@ -559,7 +578,7 @@ class WOSiteUpdateController(CementBaseController):
if ((php73 is old_php73) and (php72 is old_php72) and if ((php73 is old_php73) and (php72 is old_php72) and
(php74 is old_php74) and (php80 is old_php80) 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 (stype == oldsitetype and
cache == oldcachetype)): cache == oldcachetype)):
Log.debug(self, "Nothing to update") Log.debug(self, "Nothing to update")
@@ -580,6 +599,9 @@ class WOSiteUpdateController(CementBaseController):
elif php81 is True: elif php81 is True:
data['wo_php'] = 'php81' data['wo_php'] = 'php81'
check_php_version = '8.1' check_php_version = '8.1'
elif php82 is True:
data['wo_php'] = 'php82'
check_php_version = '8.2'
else: else:
data['wo_php'] = 'php80' data['wo_php'] = 'php80'
check_php_version = '8.0' check_php_version = '8.0'