This commit is contained in:
Janio Sarmento
2022-01-23 15:14:24 -03:00
parent b4476d3aa7
commit 555269decf
11 changed files with 943 additions and 45 deletions

View File

@@ -780,7 +780,7 @@ def sitebackup(self, data):
.format(data['site_name']), backup_path)
if data['currsitetype'] in ['html', 'php', 'php72', 'php74',
'php73', 'proxy', 'mysql']:
'php73', 'php80', 'php81', 'proxy', 'mysql']:
if not data['wp']:
Log.info(self, "Backing up Webroot \t\t", end='')
WOFileUtils.copyfiles(self, wo_site_webroot +
@@ -840,7 +840,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']:
'wpsubdomain', 'php73', 'php74', 'php80', 'php81']:
Log.debug(self, "Setting apt_packages variable for Nginx")
# Check if server has nginx-custom package
@@ -877,14 +877,20 @@ def site_package_check(self, stype):
'\t$request_filename;\n')
if ((pargs.php and pargs.php73) or (pargs.php and pargs.php74) or
(pargs.php and pargs.php72) or
(pargs.php and pargs.php72) or (pargs.php and pargs.php80) or
(pargs.php and pargs.php81) or
(pargs.php73 and pargs.php74) or (pargs.php72 and pargs.php73) or
(pargs.php72 and pargs.php74)):
(pargs.php72 and pargs.php74) or (pargs.php73 and pargs.php80) or
(pargs.php74 and pargs.php80) or (pargs.php80 and pargs.php81) or
(pargs.php72 and pargs.php80) or (pargs.php72 and pargs.php81) or
(pargs.php73 and pargs.php81) or (pargs.php74 and pargs.php81) or
(pargs.php80 and pargs.php81)):
Log.error(
self, "Error: two different PHP versions cannot be "
"combined within the same WordOps site")
if ((not pargs.php72) and (not pargs.php73) and (not pargs.php74) and
(not pargs.php80) and (not pargs.php81) and
stype in ['php', 'mysql', 'wp', 'wpsubdir',
'wpsubdomain']):
Log.debug(self, "Setting apt_packages variable for PHP")
@@ -902,6 +908,12 @@ def site_package_check(self, stype):
elif config_php_ver == '7.4':
php_check = 'php7.4-fpm'
php_to_setup = WOVar.wo_php74
elif config_php_ver == '8.0':
php_check = 'php8.0-fpm'
php_to_setup = WOVar.wo_php80
elif config_php_ver == '8.1':
php_check = 'php8.1-fpm'
php_to_setup = WOVar.wo_php81
else:
php_check = 'php7.3-fpm'
php_to_setup = WOVar.wo_php73
@@ -930,6 +942,18 @@ def site_package_check(self, stype):
if not WOAptGet.is_installed(self, 'php7.4-fpm'):
apt_packages = apt_packages + WOVar.wo_php74 + WOVar.wo_php_extra
if pargs.php80 and stype in ['php80', 'mysql', 'wp',
'wpsubdir', 'wpsubdomain']:
Log.debug(self, "Setting apt_packages variable for PHP 8.0")
if not WOAptGet.is_installed(self, 'php8.0-fpm'):
apt_packages = apt_packages + WOVar.wo_php80 + WOVar.wo_php_extra
if pargs.php81 and stype in ['php81', 'mysql', 'wp',
'wpsubdir', 'wpsubdomain']:
Log.debug(self, "Setting apt_packages variable for PHP 8.1")
if not WOAptGet.is_installed(self, 'php8.1-fpm'):
apt_packages = apt_packages + WOVar.wo_php81 + WOVar.wo_php_extra
if stype in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']:
Log.debug(self, "Setting apt_packages variable for MySQL")
if not WOShellExec.cmd_exec(self, "/usr/bin/mysqladmin ping"):
@@ -1111,7 +1135,7 @@ def detSitePar(opts):
for key, val in opts.items():
if val and key in ['html', 'php', 'mysql', 'wp',
'wpsubdir', 'wpsubdomain', 'php72',
'php73', 'php74']:
'php73', 'php74', 'php80', 'php81']:
typelist.append(key)
elif val and key in ['wpfc', 'wpsc', 'wpredis', 'wprocket', 'wpce']:
cachelist.append(key)
@@ -1145,6 +1169,18 @@ def detSitePar(opts):
cachetype = 'basic'
else:
cachetype = cachelist[0]
elif False not in [x in ('php80', 'mysql', 'html') for x in typelist]:
sitetype = 'mysql'
if not cachelist:
cachetype = 'basic'
else:
cachetype = cachelist[0]
elif False not in [x in ('php81', 'mysql', 'html') for x in typelist]:
sitetype = 'mysql'
if not cachelist:
cachetype = 'basic'
else:
cachetype = cachelist[0]
elif False not in [x in ('php', 'mysql') for x in typelist]:
sitetype = 'mysql'
if not cachelist:
@@ -1169,6 +1205,18 @@ def detSitePar(opts):
cachetype = 'basic'
else:
cachetype = cachelist[0]
elif False not in [x in ('php80', 'mysql') for x in typelist]:
sitetype = 'mysql'
if not cachelist:
cachetype = 'basic'
else:
cachetype = cachelist[0]
elif False not in [x in ('php81', 'mysql') for x in typelist]:
sitetype = 'mysql'
if not cachelist:
cachetype = 'basic'
else:
cachetype = cachelist[0]
elif False not in [x in ('html', 'mysql') for x in typelist]:
sitetype = 'mysql'
if not cachelist:
@@ -1211,6 +1259,18 @@ def detSitePar(opts):
cachetype = 'basic'
else:
cachetype = cachelist[0]
elif False not in [x in ('wp', 'php80') for x in typelist]:
sitetype = 'wp'
if not cachelist:
cachetype = 'basic'
else:
cachetype = cachelist[0]
elif False not in [x in ('wp', 'php81') for x in typelist]:
sitetype = 'wp'
if not cachelist:
cachetype = 'basic'
else:
cachetype = cachelist[0]
elif False not in [x in ('wpsubdir', 'php72') for x in typelist]:
sitetype = 'wpsubdir'
if not cachelist:
@@ -1229,6 +1289,18 @@ def detSitePar(opts):
cachetype = 'basic'
else:
cachetype = cachelist[0]
elif False not in [x in ('wpsubdir', 'php80') for x in typelist]:
sitetype = 'wpsubdir'
if not cachelist:
cachetype = 'basic'
else:
cachetype = cachelist[0]
elif False not in [x in ('wpsubdir', 'php81') for x in typelist]:
sitetype = 'wpsubdir'
if not cachelist:
cachetype = 'basic'
else:
cachetype = cachelist[0]
elif False not in [x in ('wpsubdomain', 'php72') for x in typelist]:
sitetype = 'wpsubdomain'
if not cachelist:
@@ -1247,6 +1319,18 @@ def detSitePar(opts):
cachetype = 'basic'
else:
cachetype = cachelist[0]
elif False not in [x in ('wpsubdomain', 'php80') for x in typelist]:
sitetype = 'wpsubdomain'
if not cachelist:
cachetype = 'basic'
else:
cachetype = cachelist[0]
elif False not in [x in ('wpsubdomain', 'php81') for x in typelist]:
sitetype = 'wpsubdomain'
if not cachelist:
cachetype = 'basic'
else:
cachetype = cachelist[0]
else:
raise RuntimeError("could not determine site and cache type")
else:
@@ -1262,6 +1346,12 @@ def detSitePar(opts):
elif (not typelist or "php74" in typelist) and cachelist:
sitetype = 'wp'
cachetype = cachelist[0]
elif (not typelist or "php80" in typelist) and cachelist:
sitetype = 'wp'
cachetype = cachelist[0]
elif (not typelist or "php81" in typelist) and cachelist:
sitetype = 'wp'
cachetype = cachelist[0]
elif typelist and (not cachelist):
sitetype = typelist[0]
cachetype = 'basic'