#348: PHP8
This commit is contained in:
@@ -607,7 +607,7 @@ class WODebugController(CementBaseController):
|
||||
self.debug_fpm73()
|
||||
if self.app.pargs.mysql:
|
||||
# MySQL debug will not work for remote MySQL
|
||||
if WOVar.wo_mysql_host is "localhost":
|
||||
if WOVar.wo_mysql_host == "localhost":
|
||||
self.app.pargs.mysql = 'off'
|
||||
self.debug_mysql()
|
||||
else:
|
||||
|
||||
@@ -35,6 +35,12 @@ class WOInfoController(CementBaseController):
|
||||
(['--php74'],
|
||||
dict(help='Get PHP 7.4 configuration information',
|
||||
action='store_true')),
|
||||
(['--php80'],
|
||||
dict(help='Get PHP 8.0 configuration information',
|
||||
action='store_true')),
|
||||
(['--php81'],
|
||||
dict(help='Get PHP 8.1 configuration information',
|
||||
action='store_true')),
|
||||
(['--nginx'],
|
||||
dict(help='Get Nginx configuration information',
|
||||
action='store_true')),
|
||||
@@ -328,6 +334,180 @@ class WOInfoController(CementBaseController):
|
||||
debug_xdebug_profiler_enable_trigger=debug_xdebug)
|
||||
self.app.render((data), 'info_php.mustache')
|
||||
|
||||
@expose(hide=True)
|
||||
def info_php80(self):
|
||||
"""Display PHP information"""
|
||||
version = os.popen("/usr/bin/php8.0 -v 2>/dev/null | "
|
||||
"head -n1 | cut -d' ' -f2 |"
|
||||
" cut -d'+' -f1 | tr -d '\n'").read
|
||||
config = configparser.ConfigParser()
|
||||
config.read('/etc/php/8.0/fpm/php.ini')
|
||||
expose_php = config['PHP']['expose_php']
|
||||
memory_limit = config['PHP']['memory_limit']
|
||||
post_max_size = config['PHP']['post_max_size']
|
||||
upload_max_filesize = config['PHP']['upload_max_filesize']
|
||||
max_execution_time = config['PHP']['max_execution_time']
|
||||
|
||||
if os.path.exists('/etc/php/8.0/fpm/pool.d/www.conf'):
|
||||
config.read('/etc/php/8.0/fpm/pool.d/www.conf')
|
||||
else:
|
||||
Log.error(self, 'php-fpm pool config not found')
|
||||
if config.has_section('www'):
|
||||
wconfig = config['www']
|
||||
elif config.has_section('www-php80'):
|
||||
wconfig = config['www-php80']
|
||||
else:
|
||||
Log.error(self, 'Unable to parse configuration')
|
||||
www_listen = wconfig['listen']
|
||||
www_ping_path = wconfig['ping.path']
|
||||
www_pm_status_path = wconfig['pm.status_path']
|
||||
www_pm = wconfig['pm']
|
||||
www_pm_max_requests = wconfig['pm.max_requests']
|
||||
www_pm_max_children = wconfig['pm.max_children']
|
||||
www_pm_start_servers = wconfig['pm.start_servers']
|
||||
www_pm_min_spare_servers = wconfig['pm.min_spare_servers']
|
||||
www_pm_max_spare_servers = wconfig['pm.max_spare_servers']
|
||||
www_request_terminate_time = (wconfig
|
||||
['request_terminate_timeout'])
|
||||
try:
|
||||
www_xdebug = (wconfig
|
||||
['php_admin_flag[xdebug.profiler_enable'
|
||||
'_trigger]'])
|
||||
except Exception as e:
|
||||
Log.debug(self, "{0}".format(e))
|
||||
www_xdebug = 'off'
|
||||
|
||||
config.read('/etc/php/8.0/fpm/pool.d/debug.conf')
|
||||
debug_listen = config['debug']['listen']
|
||||
debug_ping_path = config['debug']['ping.path']
|
||||
debug_pm_status_path = config['debug']['pm.status_path']
|
||||
debug_pm = config['debug']['pm']
|
||||
debug_pm_max_requests = config['debug']['pm.max_requests']
|
||||
debug_pm_max_children = config['debug']['pm.max_children']
|
||||
debug_pm_start_servers = config['debug']['pm.start_servers']
|
||||
debug_pm_min_spare_servers = config['debug']['pm.min_spare_servers']
|
||||
debug_pm_max_spare_servers = config['debug']['pm.max_spare_servers']
|
||||
debug_request_terminate = (config['debug']
|
||||
['request_terminate_timeout'])
|
||||
try:
|
||||
debug_xdebug = (config['debug']['php_admin_flag[xdebug.profiler_'
|
||||
'enable_trigger]'])
|
||||
except Exception as e:
|
||||
Log.debug(self, "{0}".format(e))
|
||||
debug_xdebug = 'off'
|
||||
|
||||
data = dict(version=version, expose_php=expose_php,
|
||||
memory_limit=memory_limit, post_max_size=post_max_size,
|
||||
upload_max_filesize=upload_max_filesize,
|
||||
max_execution_time=max_execution_time,
|
||||
www_listen=www_listen, www_ping_path=www_ping_path,
|
||||
www_pm_status_path=www_pm_status_path, www_pm=www_pm,
|
||||
www_pm_max_requests=www_pm_max_requests,
|
||||
www_pm_max_children=www_pm_max_children,
|
||||
www_pm_start_servers=www_pm_start_servers,
|
||||
www_pm_min_spare_servers=www_pm_min_spare_servers,
|
||||
www_pm_max_spare_servers=www_pm_max_spare_servers,
|
||||
www_request_terminate_timeout=www_request_terminate_time,
|
||||
www_xdebug_profiler_enable_trigger=www_xdebug,
|
||||
debug_listen=debug_listen, debug_ping_path=debug_ping_path,
|
||||
debug_pm_status_path=debug_pm_status_path,
|
||||
debug_pm=debug_pm,
|
||||
debug_pm_max_requests=debug_pm_max_requests,
|
||||
debug_pm_max_children=debug_pm_max_children,
|
||||
debug_pm_start_servers=debug_pm_start_servers,
|
||||
debug_pm_min_spare_servers=debug_pm_min_spare_servers,
|
||||
debug_pm_max_spare_servers=debug_pm_max_spare_servers,
|
||||
debug_request_terminate_timeout=debug_request_terminate,
|
||||
debug_xdebug_profiler_enable_trigger=debug_xdebug)
|
||||
self.app.render((data), 'info_php.mustache')
|
||||
|
||||
@expose(hide=True)
|
||||
def info_php81(self):
|
||||
"""Display PHP information"""
|
||||
version = os.popen("/usr/bin/php8.1 -v 2>/dev/null | "
|
||||
"head -n1 | cut -d' ' -f2 |"
|
||||
" cut -d'+' -f1 | tr -d '\n'").read
|
||||
config = configparser.ConfigParser()
|
||||
config.read('/etc/php/8.1/fpm/php.ini')
|
||||
expose_php = config['PHP']['expose_php']
|
||||
memory_limit = config['PHP']['memory_limit']
|
||||
post_max_size = config['PHP']['post_max_size']
|
||||
upload_max_filesize = config['PHP']['upload_max_filesize']
|
||||
max_execution_time = config['PHP']['max_execution_time']
|
||||
|
||||
if os.path.exists('/etc/php/8.1/fpm/pool.d/www.conf'):
|
||||
config.read('/etc/php/8.1/fpm/pool.d/www.conf')
|
||||
else:
|
||||
Log.error(self, 'php-fpm pool config not found')
|
||||
if config.has_section('www'):
|
||||
wconfig = config['www']
|
||||
elif config.has_section('www-php81'):
|
||||
wconfig = config['www-php81']
|
||||
else:
|
||||
Log.error(self, 'Unable to parse configuration')
|
||||
www_listen = wconfig['listen']
|
||||
www_ping_path = wconfig['ping.path']
|
||||
www_pm_status_path = wconfig['pm.status_path']
|
||||
www_pm = wconfig['pm']
|
||||
www_pm_max_requests = wconfig['pm.max_requests']
|
||||
www_pm_max_children = wconfig['pm.max_children']
|
||||
www_pm_start_servers = wconfig['pm.start_servers']
|
||||
www_pm_min_spare_servers = wconfig['pm.min_spare_servers']
|
||||
www_pm_max_spare_servers = wconfig['pm.max_spare_servers']
|
||||
www_request_terminate_time = (wconfig
|
||||
['request_terminate_timeout'])
|
||||
try:
|
||||
www_xdebug = (wconfig
|
||||
['php_admin_flag[xdebug.profiler_enable'
|
||||
'_trigger]'])
|
||||
except Exception as e:
|
||||
Log.debug(self, "{0}".format(e))
|
||||
www_xdebug = 'off'
|
||||
|
||||
config.read('/etc/php/8.1/fpm/pool.d/debug.conf')
|
||||
debug_listen = config['debug']['listen']
|
||||
debug_ping_path = config['debug']['ping.path']
|
||||
debug_pm_status_path = config['debug']['pm.status_path']
|
||||
debug_pm = config['debug']['pm']
|
||||
debug_pm_max_requests = config['debug']['pm.max_requests']
|
||||
debug_pm_max_children = config['debug']['pm.max_children']
|
||||
debug_pm_start_servers = config['debug']['pm.start_servers']
|
||||
debug_pm_min_spare_servers = config['debug']['pm.min_spare_servers']
|
||||
debug_pm_max_spare_servers = config['debug']['pm.max_spare_servers']
|
||||
debug_request_terminate = (config['debug']
|
||||
['request_terminate_timeout'])
|
||||
try:
|
||||
debug_xdebug = (config['debug']['php_admin_flag[xdebug.profiler_'
|
||||
'enable_trigger]'])
|
||||
except Exception as e:
|
||||
Log.debug(self, "{0}".format(e))
|
||||
debug_xdebug = 'off'
|
||||
|
||||
data = dict(version=version, expose_php=expose_php,
|
||||
memory_limit=memory_limit, post_max_size=post_max_size,
|
||||
upload_max_filesize=upload_max_filesize,
|
||||
max_execution_time=max_execution_time,
|
||||
www_listen=www_listen, www_ping_path=www_ping_path,
|
||||
www_pm_status_path=www_pm_status_path, www_pm=www_pm,
|
||||
www_pm_max_requests=www_pm_max_requests,
|
||||
www_pm_max_children=www_pm_max_children,
|
||||
www_pm_start_servers=www_pm_start_servers,
|
||||
www_pm_min_spare_servers=www_pm_min_spare_servers,
|
||||
www_pm_max_spare_servers=www_pm_max_spare_servers,
|
||||
www_request_terminate_timeout=www_request_terminate_time,
|
||||
www_xdebug_profiler_enable_trigger=www_xdebug,
|
||||
debug_listen=debug_listen, debug_ping_path=debug_ping_path,
|
||||
debug_pm_status_path=debug_pm_status_path,
|
||||
debug_pm=debug_pm,
|
||||
debug_pm_max_requests=debug_pm_max_requests,
|
||||
debug_pm_max_children=debug_pm_max_children,
|
||||
debug_pm_start_servers=debug_pm_start_servers,
|
||||
debug_pm_min_spare_servers=debug_pm_min_spare_servers,
|
||||
debug_pm_max_spare_servers=debug_pm_max_spare_servers,
|
||||
debug_request_terminate_timeout=debug_request_terminate,
|
||||
debug_xdebug_profiler_enable_trigger=debug_xdebug)
|
||||
self.app.render((data), 'info_php.mustache')
|
||||
|
||||
@expose(hide=True)
|
||||
def info_mysql(self):
|
||||
"""Display MySQL information"""
|
||||
@@ -368,7 +548,8 @@ class WOInfoController(CementBaseController):
|
||||
pargs = self.app.pargs
|
||||
if (not pargs.nginx and not pargs.php and
|
||||
not pargs.mysql and not pargs.php73 and
|
||||
not pargs.php74):
|
||||
not pargs.php74 and not pargs.php80 and
|
||||
not pargs.php81):
|
||||
pargs.nginx = True
|
||||
pargs.php = True
|
||||
pargs.mysql = True
|
||||
@@ -376,6 +557,10 @@ class WOInfoController(CementBaseController):
|
||||
pargs.php73 = True
|
||||
if WOAptGet.is_installed(self, 'php7.4-fpm'):
|
||||
pargs.php74 = True
|
||||
if WOAptGet.is_installed(self, 'php8.0-fpm'):
|
||||
pargs.php80 = True
|
||||
if WOAptGet.is_installed(self, 'php8.1-fpm'):
|
||||
pargs.php81 = True
|
||||
|
||||
if pargs.nginx:
|
||||
if ((not WOAptGet.is_installed(self, 'nginx-custom')) and
|
||||
@@ -402,6 +587,18 @@ class WOInfoController(CementBaseController):
|
||||
else:
|
||||
Log.info(self, "PHP 7.4 is not installed")
|
||||
|
||||
if pargs.php80:
|
||||
if WOAptGet.is_installed(self, 'php8.0-fpm'):
|
||||
self.info_php80()
|
||||
else:
|
||||
Log.info(self, "PHP 8.0 is not installed")
|
||||
|
||||
if pargs.php81:
|
||||
if WOAptGet.is_installed(self, 'php8.1-fpm'):
|
||||
self.info_php81()
|
||||
else:
|
||||
Log.info(self, "PHP 8.1 is not installed")
|
||||
|
||||
if pargs.mysql:
|
||||
if WOShellExec.cmd_exec(self, "/usr/bin/mysqladmin ping"):
|
||||
self.info_mysql()
|
||||
|
||||
@@ -39,6 +39,10 @@ class WOSiteCreateController(CementBaseController):
|
||||
dict(help="create php 7.3 site", action='store_true')),
|
||||
(['--php74'],
|
||||
dict(help="create php 7.4 site", action='store_true')),
|
||||
(['--php80'],
|
||||
dict(help="create php 8.0 site", action='store_true')),
|
||||
(['--php81'],
|
||||
dict(help="create php 8.1 site", action='store_true')),
|
||||
(['--mysql'],
|
||||
dict(help="create mysql site", action='store_true')),
|
||||
(['--wp'],
|
||||
@@ -167,7 +171,7 @@ class WOSiteCreateController(CementBaseController):
|
||||
data['port'] = port
|
||||
data['basic'] = True
|
||||
|
||||
if pargs.php72 or pargs.php73 or pargs.php74:
|
||||
if pargs.php72 or pargs.php73 or pargs.php74 or pargs.php80 or pargs.php81:
|
||||
data = dict(
|
||||
site_name=wo_domain, www_domain=wo_www_domain,
|
||||
static=False, basic=False,
|
||||
@@ -214,6 +218,8 @@ class WOSiteCreateController(CementBaseController):
|
||||
data['php73'] = False
|
||||
data['php74'] = False
|
||||
data['php72'] = False
|
||||
data['php80'] = False
|
||||
data['php81'] = False
|
||||
|
||||
if data and pargs.php73:
|
||||
data['php73'] = True
|
||||
@@ -224,6 +230,12 @@ class WOSiteCreateController(CementBaseController):
|
||||
elif data and pargs.php72:
|
||||
data['php72'] = True
|
||||
data['wo_php'] = 'php72'
|
||||
elif data and pargs.php80:
|
||||
data['php80'] = True
|
||||
data['wo_php'] = 'php80'
|
||||
elif data and pargs.php81:
|
||||
data['php81'] = True
|
||||
data['wo_php'] = 'php81'
|
||||
else:
|
||||
if self.app.config.has_section('php'):
|
||||
config_php_ver = self.app.config.get(
|
||||
@@ -237,6 +249,12 @@ class WOSiteCreateController(CementBaseController):
|
||||
elif config_php_ver == '7.4':
|
||||
data['php74'] = True
|
||||
data['wo_php'] = 'php74'
|
||||
elif config_php_ver == '8.0':
|
||||
data['php80'] = True
|
||||
data['wo_php'] = 'php80'
|
||||
elif config_php_ver == '8.1':
|
||||
data['php81'] = True
|
||||
data['wo_php'] = 'php81'
|
||||
else:
|
||||
data['php73'] = True
|
||||
data['wo_php'] = 'php73'
|
||||
@@ -306,6 +324,10 @@ class WOSiteCreateController(CementBaseController):
|
||||
php_version = "7.2"
|
||||
elif data['php74']:
|
||||
php_version = "7.4"
|
||||
elif data['php80']:
|
||||
php_version = "8.0"
|
||||
elif data['php81']:
|
||||
php_version = "8.1"
|
||||
else:
|
||||
php_version = "7.3"
|
||||
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -47,6 +47,10 @@ class WOSiteUpdateController(CementBaseController):
|
||||
dict(help="update to php73 site", action='store_true')),
|
||||
(['--php74'],
|
||||
dict(help="update to php74 site", action='store_true')),
|
||||
(['--php80'],
|
||||
dict(help="update to php80 site", action='store_true')),
|
||||
(['--php81'],
|
||||
dict(help="update to php81 site", action='store_true')),
|
||||
(['--mysql'],
|
||||
dict(help="update to mysql site", action='store_true')),
|
||||
(['--wp'],
|
||||
@@ -111,6 +115,7 @@ class WOSiteUpdateController(CementBaseController):
|
||||
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.mysql or pargs.wp or pargs.wpsubdir or
|
||||
pargs.wpsubdomain or pargs.wpfc or pargs.wpsc or
|
||||
pargs.wprocket or pargs.wpce or
|
||||
@@ -143,6 +148,8 @@ class WOSiteUpdateController(CementBaseController):
|
||||
php73 = False
|
||||
php74 = False
|
||||
php72 = False
|
||||
php80 = False
|
||||
php81 = False
|
||||
|
||||
data = dict()
|
||||
try:
|
||||
@@ -191,11 +198,13 @@ class WOSiteUpdateController(CementBaseController):
|
||||
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")
|
||||
|
||||
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
|
||||
pargs.php74 or
|
||||
pargs.php74 or pargs.php80 or pargs.php81 or
|
||||
pargs.mysql or pargs.wp or pargs.wpfc or pargs.wpsc or
|
||||
pargs.wprocket or pargs.wpce or
|
||||
pargs.wpsubdir or pargs.wpsubdomain)):
|
||||
@@ -263,16 +272,18 @@ class WOSiteUpdateController(CementBaseController):
|
||||
|
||||
if (((stype == 'php' and
|
||||
oldsitetype not in ['html', 'proxy', 'php', 'php72',
|
||||
'php73', 'php74']) or
|
||||
'php73', 'php74', 'php80', 'php81']) or
|
||||
(stype == 'mysql' and oldsitetype not in [
|
||||
'html', 'php', 'php72', 'php73', 'php74', 'proxy']) or
|
||||
'html', 'php', 'php72', 'php73', 'php74','php80', 'php81',
|
||||
'proxy']) or
|
||||
(stype == 'wp' and oldsitetype not in [
|
||||
'html', 'php', 'php72', 'php73', 'php74', 'mysql',
|
||||
'proxy', 'wp']) or
|
||||
'html', 'php', 'php72', 'php73', 'php74', 'php80', 'php81',
|
||||
'mysql', 'proxy', 'wp']) or
|
||||
(stype == 'wpsubdir' and oldsitetype in ['wpsubdomain']) or
|
||||
(stype == 'wpsubdomain' and oldsitetype in ['wpsubdir']) or
|
||||
(stype == oldsitetype and cache == oldcachetype)) and
|
||||
not (pargs.php72 or pargs.php73 or pargs.php74)):
|
||||
not (pargs.php72 or pargs.php73 or pargs.php74 or pargs.php80 or
|
||||
pargs.php81)):
|
||||
Log.info(self, Log.FAIL + "can not update {0} {1} to {2} {3}".
|
||||
format(oldsitetype, oldcachetype, stype, cache))
|
||||
return 1
|
||||
@@ -291,7 +302,7 @@ class WOSiteUpdateController(CementBaseController):
|
||||
data = dict(
|
||||
site_name=wo_domain, www_domain=wo_www_domain,
|
||||
static=False, basic=True, wp=False, wpfc=False,
|
||||
php72=False, php73=False, php74=False,
|
||||
php72=False, php73=False, php74=False, php80=False, php81=False,
|
||||
wpsc=False, wpredis=False, wprocket=False, wpce=False,
|
||||
multisite=False, wpsubdir=False, webroot=wo_site_webroot,
|
||||
currsitetype=oldsitetype, currcachetype=oldcachetype)
|
||||
@@ -316,9 +327,9 @@ class WOSiteUpdateController(CementBaseController):
|
||||
data['wpsubdir'] = True
|
||||
|
||||
if ((pargs.php72 or pargs.php73 or
|
||||
pargs.php74) and (not data)):
|
||||
pargs.php74 or pargs.php80 or pargs.php81) and (not data)):
|
||||
Log.debug(
|
||||
self, "pargs php72, or php73, or php74 enabled")
|
||||
self, "pargs php72, or php73, or php74, or php80, or php81 enabled")
|
||||
data = dict(
|
||||
site_name=wo_domain,
|
||||
www_domain=wo_www_domain,
|
||||
@@ -333,7 +344,8 @@ class WOSiteUpdateController(CementBaseController):
|
||||
data['multisite'] = False
|
||||
data['wpsubdir'] = False
|
||||
elif (oldsitetype == 'php' or oldsitetype == 'mysql' or
|
||||
oldsitetype == 'php73'or oldsitetype == 'php74'):
|
||||
oldsitetype == 'php73' or oldsitetype == 'php74' or
|
||||
oldsitetype == 'php80' or oldsitetype == 'php81'):
|
||||
data['static'] = False
|
||||
data['wp'] = False
|
||||
data['multisite'] = False
|
||||
@@ -409,6 +421,14 @@ class WOSiteUpdateController(CementBaseController):
|
||||
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
|
||||
|
||||
if pargs.php72:
|
||||
if php72 is old_php72:
|
||||
@@ -428,8 +448,21 @@ class WOSiteUpdateController(CementBaseController):
|
||||
"site")
|
||||
pargs.php74 = 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 (data and (not pargs.php73) and
|
||||
(not pargs.php74) and (not pargs.php72)):
|
||||
(not pargs.php74) and (not pargs.php72) and
|
||||
(not pargs.php80) and (not pargs.php81)):
|
||||
data['php72'] = bool(old_php72 is True)
|
||||
Log.debug(self, "data php72 = {0}".format(data['php72']))
|
||||
php72 = bool(old_php72 is True)
|
||||
@@ -439,6 +472,12 @@ class WOSiteUpdateController(CementBaseController):
|
||||
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['php80'] = bool(old_php80 is True)
|
||||
Log.debug(self, "data php80 = {0}".format(data['php80']))
|
||||
php80 = bool(old_php80 is True)
|
||||
|
||||
if pargs.letsencrypt:
|
||||
acme_domains = []
|
||||
@@ -516,7 +555,9 @@ class WOSiteUpdateController(CementBaseController):
|
||||
cache = 'wpce'
|
||||
|
||||
if ((php73 is old_php73) and (php72 is old_php72) and
|
||||
(php74 is old_php74) and (stype == oldsitetype and
|
||||
(php74 is old_php74) and (php80 is old_php80) and
|
||||
(php81 is old_php81) and
|
||||
(stype == oldsitetype and
|
||||
cache == oldcachetype)):
|
||||
Log.debug(self, "Nothing to update")
|
||||
return 1
|
||||
@@ -530,6 +571,12 @@ class WOSiteUpdateController(CementBaseController):
|
||||
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'
|
||||
else:
|
||||
data['wo_php'] = 'php73'
|
||||
check_php_version = '7.3'
|
||||
@@ -830,7 +877,8 @@ class WOSiteUpdateController(CementBaseController):
|
||||
|
||||
# Setup WordPress if old sites are html/php/mysql sites
|
||||
if data['wp'] and oldsitetype in ['html', 'proxy', 'php', 'php72',
|
||||
'mysql', 'php73', 'php74']:
|
||||
'mysql', 'php73', 'php74', 'php80',
|
||||
'php81',]:
|
||||
try:
|
||||
wo_wp_creds = setupwordpress(self, data)
|
||||
except SiteError as e:
|
||||
|
||||
@@ -47,6 +47,10 @@ class WOStackController(CementBaseController):
|
||||
dict(help='Install PHP 7.3 stack', action='store_true')),
|
||||
(['--php74'],
|
||||
dict(help='Install PHP 7.4 stack', action='store_true')),
|
||||
(['--php80'],
|
||||
dict(help='Install PHP 8.0 stack', action='store_true')),
|
||||
(['--php81'],
|
||||
dict(help='Install PHP 8.1 stack', action='store_true')),
|
||||
(['--mysql'],
|
||||
dict(help='Install MySQL stack', action='store_true')),
|
||||
(['--mariadb'],
|
||||
@@ -117,6 +121,7 @@ class WOStackController(CementBaseController):
|
||||
# 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.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
|
||||
@@ -142,6 +147,8 @@ class WOStackController(CementBaseController):
|
||||
pargs.admin = True
|
||||
pargs.php73 = True
|
||||
pargs.php74 = True
|
||||
pargs.php80 = True
|
||||
pargs.php81 = True
|
||||
pargs.redis = True
|
||||
pargs.proftpd = True
|
||||
|
||||
@@ -155,6 +162,10 @@ class WOStackController(CementBaseController):
|
||||
pargs.php73 = True
|
||||
elif config_php_ver == '7.4':
|
||||
pargs.php74 = True
|
||||
elif config_php_ver == '8.0':
|
||||
pargs.php80 = True
|
||||
elif config_php_ver == '8.1':
|
||||
pargs.php80 = True
|
||||
else:
|
||||
pargs.php74 = True
|
||||
pargs.nginx = True
|
||||
@@ -226,6 +237,26 @@ class WOStackController(CementBaseController):
|
||||
Log.debug(self, "PHP 7.4 already installed")
|
||||
Log.info(self, "PHP 7.4 already installed")
|
||||
|
||||
# PHP 8.0
|
||||
if pargs.php80:
|
||||
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)
|
||||
else:
|
||||
Log.debug(self, "PHP 8.0 already installed")
|
||||
Log.info(self, "PHP 8.0 already installed")
|
||||
|
||||
# PHP 8.1
|
||||
if pargs.php81:
|
||||
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)
|
||||
else:
|
||||
Log.debug(self, "PHP 8.1 already installed")
|
||||
Log.info(self, "PHP 8.1 already installed")
|
||||
|
||||
# MariaDB 10.3
|
||||
if pargs.mysql:
|
||||
pargs.mysqltuner = True
|
||||
@@ -485,7 +516,9 @@ class WOStackController(CementBaseController):
|
||||
pargs.mysql = True
|
||||
if not (WOAptGet.is_installed(self, 'php7.2-fpm') or
|
||||
WOAptGet.is_installed(self, 'php7.3-fpm') or
|
||||
WOAptGet.is_installed(self, 'php7.4-fpm')):
|
||||
WOAptGet.is_installed(self, 'php7.4-fpm') or
|
||||
WOAptGet.is_installed(self, 'php8.0-fpm') or
|
||||
WOAptGet.is_installed(self, 'php8.1-fpm')):
|
||||
pargs.php74 = True
|
||||
Log.debug(self, "Setting packages variable for utils")
|
||||
packages = packages + [[
|
||||
@@ -582,7 +615,8 @@ class WOStackController(CementBaseController):
|
||||
(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.all)):
|
||||
(not pargs.php72) (not pargs.php80) and
|
||||
(not pargs.php81) and (not pargs.all)):
|
||||
self.app.args.print_help()
|
||||
|
||||
if pargs.php:
|
||||
@@ -636,7 +670,9 @@ class WOStackController(CementBaseController):
|
||||
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')):
|
||||
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 7.2 is not installed")
|
||||
@@ -648,7 +684,9 @@ class WOStackController(CementBaseController):
|
||||
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')):
|
||||
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 7.3 is not installed")
|
||||
@@ -660,12 +698,42 @@ class WOStackController(CementBaseController):
|
||||
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')):
|
||||
WOAptGet.is_installed(self, 'php7.2-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 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
|
||||
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')):
|
||||
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")
|
||||
|
||||
# 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
|
||||
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.0-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")
|
||||
|
||||
# REDIS
|
||||
if pargs.redis:
|
||||
if WOAptGet.is_installed(self, 'redis-server'):
|
||||
@@ -898,6 +966,7 @@ class WOStackController(CementBaseController):
|
||||
(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.php73) and (not pargs.php74) and
|
||||
(not pargs.php72) and (not pargs.all)):
|
||||
self.app.args.print_help()
|
||||
@@ -913,6 +982,8 @@ class WOStackController(CementBaseController):
|
||||
pargs.admin = True
|
||||
pargs.php73 = True
|
||||
pargs.php74 = True
|
||||
pargs.php80 = True
|
||||
pargs.php81 = True
|
||||
pargs.fail2ban = True
|
||||
pargs.proftpd = True
|
||||
pargs.utils = True
|
||||
@@ -966,8 +1037,10 @@ class WOStackController(CementBaseController):
|
||||
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')):
|
||||
apt_packages = apt_packages + WOVar.wo_php_extra
|
||||
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 7.3 is not installed")
|
||||
Log.info(self, "PHP 7.3 is not installed")
|
||||
@@ -978,12 +1051,42 @@ class WOStackController(CementBaseController):
|
||||
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')):
|
||||
WOAptGet.is_installed(self, 'php7.2-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 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
|
||||
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')):
|
||||
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")
|
||||
|
||||
# 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_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, 'php7.4-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")
|
||||
|
||||
# REDIS
|
||||
if pargs.redis:
|
||||
if WOAptGet.is_installed(self, 'redis-server'):
|
||||
|
||||
@@ -229,7 +229,7 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
||||
.format(ngxcom),
|
||||
'wpsubdir.mustache', data)
|
||||
|
||||
wo_php_version = ["php72", "php73", "php74"]
|
||||
wo_php_version = ["php72", "php73", "php74", "php80" "php81"]
|
||||
for wo_php in wo_php_version:
|
||||
data = dict(upstream="{0}".format(wo_php),
|
||||
release=WOVar.wo_version)
|
||||
@@ -922,6 +922,330 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
||||
'upstream.mustache', data, True)
|
||||
WOConf.nginxcommon(self)
|
||||
|
||||
# php8.0 configuration
|
||||
if set(WOVar.wo_php80).issubset(set(apt_packages)):
|
||||
WOGit.add(self, ["/etc/php"], msg="Adding PHP into Git")
|
||||
Log.info(self, "Configuring php8.0-fpm")
|
||||
ngxroot = '/var/www/'
|
||||
# Create log directories
|
||||
if not os.path.exists('/var/log/php/8.0/'):
|
||||
Log.debug(self, 'Creating directory /var/log/php/8.0/')
|
||||
os.makedirs('/var/log/php/8.0/')
|
||||
|
||||
if not os.path.isfile('/etc/php/8.0/fpm/php.ini.orig'):
|
||||
WOFileUtils.copyfile(self, '/etc/php/8.0/fpm/php.ini',
|
||||
'/etc/php/8.0/fpm/php.ini.orig')
|
||||
|
||||
# Parse etc/php/8.0/fpm/php.ini
|
||||
config = configparser.ConfigParser()
|
||||
Log.debug(self, "configuring php file /etc/php/8.0/"
|
||||
"fpm/php.ini")
|
||||
config.read('/etc/php/8.0/fpm/php.ini.orig')
|
||||
config['PHP']['expose_php'] = 'Off'
|
||||
config['PHP']['post_max_size'] = '100M'
|
||||
config['PHP']['upload_max_filesize'] = '100M'
|
||||
config['PHP']['max_execution_time'] = '300'
|
||||
config['PHP']['max_input_time'] = '300'
|
||||
config['PHP']['max_input_vars'] = '20000'
|
||||
config['Date']['date.timezone'] = WOVar.wo_timezone
|
||||
config['opcache']['opcache.enable'] = '1'
|
||||
config['opcache']['opcache.interned_strings_buffer'] = '8'
|
||||
config['opcache']['opcache.max_accelerated_files'] = '10000'
|
||||
config['opcache']['opcache.memory_consumption'] = '256'
|
||||
config['opcache']['opcache.save_comments'] = '1'
|
||||
config['opcache']['opcache.revalidate_freq'] = '5'
|
||||
config['opcache']['opcache.consistency_checks'] = '0'
|
||||
config['opcache']['opcache.validate_timestamps'] = '1'
|
||||
config['opcache']['opcache.preload_user'] = 'www-data'
|
||||
with open('/etc/php/8.0/fpm/php.ini',
|
||||
encoding='utf-8', mode='w') as configfile:
|
||||
Log.debug(self, "Writting php configuration into "
|
||||
"/etc/php/8.0/fpm/php.ini")
|
||||
config.write(configfile)
|
||||
|
||||
# Render php-fpm pool template for php8.0
|
||||
data = dict(pid="/run/php/php8.0-fpm.pid",
|
||||
error_log="/var/log/php8.0-fpm.log",
|
||||
include="/etc/php/8.0/fpm/pool.d/*.conf")
|
||||
WOTemplate.deploy(
|
||||
self, '/etc/php/8.0/fpm/php-fpm.conf',
|
||||
'php-fpm.mustache', data)
|
||||
|
||||
data = dict(pool='www-php80', listen='php80-fpm.sock',
|
||||
user='www-data',
|
||||
group='www-data', listenuser='root',
|
||||
listengroup='www-data', openbasedir=True)
|
||||
WOTemplate.deploy(self, '/etc/php/8.0/fpm/pool.d/www.conf',
|
||||
'php-pool.mustache', data)
|
||||
data = dict(pool='www-two-php80', listen='php80-two-fpm.sock',
|
||||
user='www-data',
|
||||
group='www-data', listenuser='root',
|
||||
listengroup='www-data', openbasedir=True)
|
||||
WOTemplate.deploy(self, '/etc/php/8.0/fpm/pool.d/www-two.conf',
|
||||
'php-pool.mustache', data)
|
||||
|
||||
# Generate /etc/php/8.0/fpm/pool.d/debug.conf
|
||||
WOFileUtils.copyfile(self, "/etc/php/8.0/fpm/pool.d/www.conf",
|
||||
"/etc/php/8.0/fpm/pool.d/debug.conf")
|
||||
WOFileUtils.searchreplace(self, "/etc/php/8.0/fpm/pool.d/"
|
||||
"debug.conf", "[www-php80]", "[debug]")
|
||||
config = configparser.ConfigParser()
|
||||
config.read('/etc/php/8.0/fpm/pool.d/debug.conf')
|
||||
config['debug']['listen'] = '127.0.0.1:9180'
|
||||
config['debug']['rlimit_core'] = 'unlimited'
|
||||
config['debug']['slowlog'] = '/var/log/php/8.0/slow.log'
|
||||
config['debug']['request_slowlog_timeout'] = '10s'
|
||||
with open('/etc/php/8.0/fpm/pool.d/debug.conf',
|
||||
encoding='utf-8', mode='w') as confifile:
|
||||
Log.debug(self, "writting PHP 8.0 configuration into "
|
||||
"/etc/php/8.0/fpm/pool.d/debug.conf")
|
||||
config.write(confifile)
|
||||
|
||||
with open("/etc/php/8.0/fpm/pool.d/debug.conf",
|
||||
encoding='utf-8', mode='a') as myfile:
|
||||
myfile.write(
|
||||
"php_admin_value[xdebug.profiler_output_dir] "
|
||||
"= /tmp/ \nphp_admin_value[xdebug.profiler_"
|
||||
"output_name] = cachegrind.out.%p-%H-%R "
|
||||
"\nphp_admin_flag[xdebug.profiler_enable"
|
||||
"_trigger] = on \nphp_admin_flag[xdebug."
|
||||
"profiler_enable] = off\n")
|
||||
|
||||
# Disable xdebug
|
||||
if not WOShellExec.cmd_exec(
|
||||
self, "grep -q \';zend_extension\'"
|
||||
" /etc/php/8.0/mods-available/xdebug.ini"):
|
||||
WOFileUtils.searchreplace(
|
||||
self, "/etc/php/8.0/mods-available/"
|
||||
"xdebug.ini",
|
||||
"zend_extension", ";zend_extension")
|
||||
|
||||
# PHP and Debug pull configuration
|
||||
if not os.path.exists('{0}22222/htdocs/fpm/status/'
|
||||
.format(ngxroot)):
|
||||
Log.debug(self, 'Creating directory '
|
||||
'{0}22222/htdocs/fpm/status/ '
|
||||
.format(ngxroot))
|
||||
os.makedirs('{0}22222/htdocs/fpm/status/'
|
||||
.format(ngxroot))
|
||||
open('{0}22222/htdocs/fpm/status/debug80'
|
||||
.format(ngxroot),
|
||||
encoding='utf-8', mode='a').close()
|
||||
open('{0}22222/htdocs/fpm/status/php80'
|
||||
.format(ngxroot),
|
||||
encoding='utf-8', mode='a').close()
|
||||
|
||||
# Write info.php
|
||||
if not os.path.exists('{0}22222/htdocs/php/'
|
||||
.format(ngxroot)):
|
||||
Log.debug(self, 'Creating directory '
|
||||
'{0}22222/htdocs/php/ '
|
||||
.format(ngxroot))
|
||||
os.makedirs('{0}22222/htdocs/php'
|
||||
.format(ngxroot))
|
||||
|
||||
WOFileUtils.textwrite(
|
||||
self, "{0}22222/htdocs/php/info.php"
|
||||
.format(ngxroot), "<?php\nphpinfo();\n?>")
|
||||
|
||||
# write opcache clean for php80
|
||||
if not os.path.exists('{0}22222/htdocs/cache/opcache'
|
||||
.format(ngxroot)):
|
||||
os.makedirs('{0}22222/htdocs/cache/opcache'
|
||||
.format(ngxroot))
|
||||
WOFileUtils.textwrite(
|
||||
self, '{0}22222/htdocs/cache/opcache/php80.php'
|
||||
.format(ngxroot),
|
||||
'<?php opcache_reset(); ?>')
|
||||
|
||||
WOFileUtils.chown(self, "{0}22222/htdocs"
|
||||
.format(ngxroot),
|
||||
'www-data',
|
||||
'www-data', recursive=True)
|
||||
|
||||
# enable imagick php extension
|
||||
WOShellExec.cmd_exec(self, 'phpenmod -v ALL imagick')
|
||||
|
||||
# check service restart or rollback configuration
|
||||
if not WOService.restart_service(self, 'php8.0-fpm'):
|
||||
WOGit.rollback(self, ["/etc/php"], msg="Rollback PHP")
|
||||
else:
|
||||
WOGit.add(self, ["/etc/php"], msg="Adding PHP into Git")
|
||||
|
||||
if os.path.exists('/etc/nginx/conf.d/upstream.conf'):
|
||||
if not WOFileUtils.grepcheck(
|
||||
self, '/etc/nginx/conf.d/upstream.conf', 'php81'):
|
||||
data = dict(php="9000", debug="9001",
|
||||
php7="9070", debug7="9170",
|
||||
php8="9080", debug8="9180",
|
||||
release=WOVar.wo_version)
|
||||
WOTemplate.deploy(
|
||||
self, '/etc/nginx/conf.d/upstream.conf',
|
||||
'upstream.mustache', data, True)
|
||||
WOConf.nginxcommon(self)
|
||||
|
||||
# php8.1 configuration
|
||||
if set(WOVar.wo_php81).issubset(set(apt_packages)):
|
||||
WOGit.add(self, ["/etc/php"], msg="Adding PHP into Git")
|
||||
Log.info(self, "Configuring php8.1-fpm")
|
||||
ngxroot = '/var/www/'
|
||||
# Create log directories
|
||||
if not os.path.exists('/var/log/php/8.1/'):
|
||||
Log.debug(self, 'Creating directory /var/log/php/8.1/')
|
||||
os.makedirs('/var/log/php/8.1/')
|
||||
|
||||
if not os.path.isfile('/etc/php/8.1/fpm/php.ini.orig'):
|
||||
WOFileUtils.copyfile(self, '/etc/php/8.1/fpm/php.ini',
|
||||
'/etc/php/8.1/fpm/php.ini.orig')
|
||||
|
||||
# Parse etc/php/8.1/fpm/php.ini
|
||||
config = configparser.ConfigParser()
|
||||
Log.debug(self, "configuring php file /etc/php/8.1/"
|
||||
"fpm/php.ini")
|
||||
config.read('/etc/php/8.1/fpm/php.ini.orig')
|
||||
config['PHP']['expose_php'] = 'Off'
|
||||
config['PHP']['post_max_size'] = '100M'
|
||||
config['PHP']['upload_max_filesize'] = '100M'
|
||||
config['PHP']['max_execution_time'] = '300'
|
||||
config['PHP']['max_input_time'] = '300'
|
||||
config['PHP']['max_input_vars'] = '20000'
|
||||
config['Date']['date.timezone'] = WOVar.wo_timezone
|
||||
config['opcache']['opcache.enable'] = '1'
|
||||
config['opcache']['opcache.interned_strings_buffer'] = '8'
|
||||
config['opcache']['opcache.max_accelerated_files'] = '10000'
|
||||
config['opcache']['opcache.memory_consumption'] = '256'
|
||||
config['opcache']['opcache.save_comments'] = '1'
|
||||
config['opcache']['opcache.revalidate_freq'] = '5'
|
||||
config['opcache']['opcache.consistency_checks'] = '0'
|
||||
config['opcache']['opcache.validate_timestamps'] = '1'
|
||||
config['opcache']['opcache.preload_user'] = 'www-data'
|
||||
with open('/etc/php/8.1/fpm/php.ini',
|
||||
encoding='utf-8', mode='w') as configfile:
|
||||
Log.debug(self, "Writting php configuration into "
|
||||
"/etc/php/8.1/fpm/php.ini")
|
||||
config.write(configfile)
|
||||
|
||||
# Render php-fpm pool template for php8.1
|
||||
data = dict(pid="/run/php/php8.1-fpm.pid",
|
||||
error_log="/var/log/php8.1-fpm.log",
|
||||
include="/etc/php/8.1/fpm/pool.d/*.conf")
|
||||
WOTemplate.deploy(
|
||||
self, '/etc/php/8.1/fpm/php-fpm.conf',
|
||||
'php-fpm.mustache', data)
|
||||
|
||||
data = dict(pool='www-php81', listen='php81-fpm.sock',
|
||||
user='www-data',
|
||||
group='www-data', listenuser='root',
|
||||
listengroup='www-data', openbasedir=True)
|
||||
WOTemplate.deploy(self, '/etc/php/8.1/fpm/pool.d/www.conf',
|
||||
'php-pool.mustache', data)
|
||||
data = dict(pool='www-two-php81', listen='php81-two-fpm.sock',
|
||||
user='www-data',
|
||||
group='www-data', listenuser='root',
|
||||
listengroup='www-data', openbasedir=True)
|
||||
WOTemplate.deploy(self, '/etc/php/8.1/fpm/pool.d/www-two.conf',
|
||||
'php-pool.mustache', data)
|
||||
|
||||
# Generate /etc/php/8.1/fpm/pool.d/debug.conf
|
||||
WOFileUtils.copyfile(self, "/etc/php/8.1/fpm/pool.d/www.conf",
|
||||
"/etc/php/8.1/fpm/pool.d/debug.conf")
|
||||
WOFileUtils.searchreplace(self, "/etc/php/8.1/fpm/pool.d/"
|
||||
"debug.conf", "[www-php81]", "[debug]")
|
||||
config = configparser.ConfigParser()
|
||||
config.read('/etc/php/8.1/fpm/pool.d/debug.conf')
|
||||
config['debug']['listen'] = '127.0.0.1:9181'
|
||||
config['debug']['rlimit_core'] = 'unlimited'
|
||||
config['debug']['slowlog'] = '/var/log/php/8.1/slow.log'
|
||||
config['debug']['request_slowlog_timeout'] = '10s'
|
||||
with open('/etc/php/8.1/fpm/pool.d/debug.conf',
|
||||
encoding='utf-8', mode='w') as confifile:
|
||||
Log.debug(self, "writting PHP 8.1 configuration into "
|
||||
"/etc/php/8.1/fpm/pool.d/debug.conf")
|
||||
config.write(confifile)
|
||||
|
||||
with open("/etc/php/8.1/fpm/pool.d/debug.conf",
|
||||
encoding='utf-8', mode='a') as myfile:
|
||||
myfile.write(
|
||||
"php_admin_value[xdebug.profiler_output_dir] "
|
||||
"= /tmp/ \nphp_admin_value[xdebug.profiler_"
|
||||
"output_name] = cachegrind.out.%p-%H-%R "
|
||||
"\nphp_admin_flag[xdebug.profiler_enable"
|
||||
"_trigger] = on \nphp_admin_flag[xdebug."
|
||||
"profiler_enable] = off\n")
|
||||
|
||||
# Disable xdebug
|
||||
if not WOShellExec.cmd_exec(
|
||||
self, "grep -q \';zend_extension\'"
|
||||
" /etc/php/8.1/mods-available/xdebug.ini"):
|
||||
WOFileUtils.searchreplace(
|
||||
self, "/etc/php/8.1/mods-available/"
|
||||
"xdebug.ini",
|
||||
"zend_extension", ";zend_extension")
|
||||
|
||||
# PHP and Debug pull configuration
|
||||
if not os.path.exists('{0}22222/htdocs/fpm/status/'
|
||||
.format(ngxroot)):
|
||||
Log.debug(self, 'Creating directory '
|
||||
'{0}22222/htdocs/fpm/status/ '
|
||||
.format(ngxroot))
|
||||
os.makedirs('{0}22222/htdocs/fpm/status/'
|
||||
.format(ngxroot))
|
||||
open('{0}22222/htdocs/fpm/status/debug81'
|
||||
.format(ngxroot),
|
||||
encoding='utf-8', mode='a').close()
|
||||
open('{0}22222/htdocs/fpm/status/php81'
|
||||
.format(ngxroot),
|
||||
encoding='utf-8', mode='a').close()
|
||||
|
||||
# Write info.php
|
||||
if not os.path.exists('{0}22222/htdocs/php/'
|
||||
.format(ngxroot)):
|
||||
Log.debug(self, 'Creating directory '
|
||||
'{0}22222/htdocs/php/ '
|
||||
.format(ngxroot))
|
||||
os.makedirs('{0}22222/htdocs/php'
|
||||
.format(ngxroot))
|
||||
|
||||
WOFileUtils.textwrite(
|
||||
self, "{0}22222/htdocs/php/info.php"
|
||||
.format(ngxroot), "<?php\nphpinfo();\n?>")
|
||||
|
||||
# write opcache clean for php81
|
||||
if not os.path.exists('{0}22222/htdocs/cache/opcache'
|
||||
.format(ngxroot)):
|
||||
os.makedirs('{0}22222/htdocs/cache/opcache'
|
||||
.format(ngxroot))
|
||||
WOFileUtils.textwrite(
|
||||
self, '{0}22222/htdocs/cache/opcache/php81.php'
|
||||
.format(ngxroot),
|
||||
'<?php opcache_reset(); ?>')
|
||||
|
||||
WOFileUtils.chown(self, "{0}22222/htdocs"
|
||||
.format(ngxroot),
|
||||
'www-data',
|
||||
'www-data', recursive=True)
|
||||
|
||||
# enable imagick php extension
|
||||
WOShellExec.cmd_exec(self, 'phpenmod -v ALL imagick')
|
||||
|
||||
# check service restart or rollback configuration
|
||||
if not WOService.restart_service(self, 'php8.1-fpm'):
|
||||
WOGit.rollback(self, ["/etc/php"], msg="Rollback PHP")
|
||||
else:
|
||||
WOGit.add(self, ["/etc/php"], msg="Adding PHP into Git")
|
||||
|
||||
if os.path.exists('/etc/nginx/conf.d/upstream.conf'):
|
||||
if not WOFileUtils.grepcheck(
|
||||
self, '/etc/nginx/conf.d/upstream.conf', 'php81'):
|
||||
data = dict(php="9000", debug="9001",
|
||||
php7="9070", debug7="9170",
|
||||
php8="9080", debug8="9180",
|
||||
release=WOVar.wo_version)
|
||||
WOTemplate.deploy(
|
||||
self, '/etc/nginx/conf.d/upstream.conf',
|
||||
'upstream.mustache', data, True)
|
||||
WOConf.nginxcommon(self)
|
||||
|
||||
# create mysql config if it doesn't exist
|
||||
if "mariadb-server" in apt_packages:
|
||||
WOGit.add(self, ["/etc/mysql"], msg="Adding MySQL into Git")
|
||||
|
||||
@@ -24,6 +24,8 @@ class WOStackStatusController(CementBaseController):
|
||||
pargs.php72 or
|
||||
pargs.php73 or
|
||||
pargs.php74 or
|
||||
pargs.php80 or
|
||||
pargs.php81 or
|
||||
pargs.mysql or
|
||||
pargs.redis or
|
||||
pargs.fail2ban or
|
||||
@@ -56,6 +58,14 @@ class WOStackStatusController(CementBaseController):
|
||||
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 pargs.php72:
|
||||
if os.path.exists('{0}'.format(wo_system) + 'php7.2-fpm.service'):
|
||||
@@ -75,6 +85,18 @@ class WOStackStatusController(CementBaseController):
|
||||
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.mysql:
|
||||
if ((WOVar.wo_mysql_host == "localhost") or
|
||||
(WOVar.wo_mysql_host == "127.0.0.1")):
|
||||
@@ -125,7 +147,7 @@ class WOStackStatusController(CementBaseController):
|
||||
pargs = self.app.pargs
|
||||
if not (pargs.nginx or pargs.php or
|
||||
pargs.php72 or pargs.php73 or
|
||||
pargs.php74 or
|
||||
pargs.php74 or pargs.php80 or pargs.php81 or
|
||||
pargs.mysql or
|
||||
pargs.fail2ban or
|
||||
pargs.netdata or
|
||||
@@ -173,6 +195,18 @@ class WOStackStatusController(CementBaseController):
|
||||
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.mysql:
|
||||
if ((WOVar.wo_mysql_host == "localhost") or
|
||||
(WOVar.wo_mysql_host == "127.0.0.1")):
|
||||
@@ -223,7 +257,7 @@ class WOStackStatusController(CementBaseController):
|
||||
pargs = self.app.pargs
|
||||
if not (pargs.nginx or pargs.php or
|
||||
pargs.php72 or pargs.php73 or
|
||||
pargs.php74 or
|
||||
pargs.php74 or pargs.php80 or pargs.php81 or
|
||||
pargs.mysql or
|
||||
pargs.netdata or
|
||||
pargs.proftpd or
|
||||
@@ -251,6 +285,14 @@ class WOStackStatusController(CementBaseController):
|
||||
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, "PHP8.0-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.1-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, "PHP7.4-FPM is not installed")
|
||||
|
||||
@@ -272,6 +314,18 @@ class WOStackStatusController(CementBaseController):
|
||||
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.mysql:
|
||||
if ((WOVar.wo_mysql_host == "localhost") or
|
||||
(WOVar.wo_mysql_host == "127.0.0.1")):
|
||||
@@ -324,6 +378,8 @@ class WOStackStatusController(CementBaseController):
|
||||
pargs.php72 or
|
||||
pargs.php73 or
|
||||
pargs.php74 or
|
||||
pargs.php80 or
|
||||
pargs.php81 or
|
||||
pargs.mysql or
|
||||
pargs.netdata or
|
||||
pargs.proftpd or
|
||||
@@ -374,6 +430,18 @@ class WOStackStatusController(CementBaseController):
|
||||
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.mysql:
|
||||
if ((WOVar.wo_mysql_host == "localhost") or
|
||||
(WOVar.wo_mysql_host == "127.0.0.1")):
|
||||
@@ -435,7 +503,7 @@ class WOStackStatusController(CementBaseController):
|
||||
pargs = self.app.pargs
|
||||
if not (pargs.nginx or pargs.php or
|
||||
pargs.php72 or pargs.php73 or
|
||||
pargs.php74 or
|
||||
pargs.php74 or pargs.php80 or pargs.php81 or
|
||||
pargs.mysql or
|
||||
pargs.netdata or
|
||||
pargs.proftpd or
|
||||
@@ -465,6 +533,14 @@ class WOStackStatusController(CementBaseController):
|
||||
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 pargs.php72:
|
||||
if os.path.exists('{0}'.format(wo_system) + 'php7.2-fpm.service'):
|
||||
@@ -484,6 +560,18 @@ class WOStackStatusController(CementBaseController):
|
||||
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.mysql:
|
||||
if ((WOVar.wo_mysql_host == "localhost") or
|
||||
(WOVar.wo_mysql_host == "127.0.0.1")):
|
||||
|
||||
@@ -39,6 +39,10 @@ class WOStackUpgradeController(CementBaseController):
|
||||
dict(help='Upgrade PHP 7.3 stack', action='store_true')),
|
||||
(['--php74'],
|
||||
dict(help='Upgrade PHP 7.4 stack', action='store_true')),
|
||||
(['--php80'],
|
||||
dict(help='Upgrade PHP 8.0 stack', action='store_true')),
|
||||
(['--php81'],
|
||||
dict(help='Upgrade PHP 8.1 stack', action='store_true')),
|
||||
(['--mysql'],
|
||||
dict(help='Upgrade MySQL stack', action='store_true')),
|
||||
(['--mariadb'],
|
||||
@@ -81,7 +85,8 @@ class WOStackUpgradeController(CementBaseController):
|
||||
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.mysql or
|
||||
pargs.php72 or pargs.php73 or pargs.php74 or
|
||||
pargs.php80 or pargs.php81 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
|
||||
@@ -108,6 +113,8 @@ class WOStackUpgradeController(CementBaseController):
|
||||
pargs.php72 = True
|
||||
pargs.php73 = True
|
||||
pargs.php74 = True
|
||||
pargs.php80 = True
|
||||
pargs.php81 = True
|
||||
pargs.mysql = True
|
||||
pargs.wpcli = True
|
||||
|
||||
@@ -153,6 +160,18 @@ class WOStackUpgradeController(CementBaseController):
|
||||
apt_packages = apt_packages + WOVar.wo_php74 + \
|
||||
WOVar.wo_php_extra
|
||||
|
||||
# php 8.0
|
||||
if pargs.php80:
|
||||
if WOAptGet.is_installed(self, 'php8.0-fpm'):
|
||||
apt_packages = apt_packages + WOVar.wo_php80 + \
|
||||
WOVar.wo_php_extra
|
||||
|
||||
# php 8.1
|
||||
if pargs.php81:
|
||||
if WOAptGet.is_installed(self, 'php8.1-fpm'):
|
||||
apt_packages = apt_packages + WOVar.wo_php81 + \
|
||||
WOVar.wo_php_extra
|
||||
|
||||
# mysql
|
||||
if pargs.mysql:
|
||||
if WOShellExec.cmd_exec(self, 'mysqladmin ping'):
|
||||
@@ -284,6 +303,8 @@ class WOStackUpgradeController(CementBaseController):
|
||||
if not ("php7.2-fpm" in apt_packages or
|
||||
"php7.3-fpm" in apt_packages or
|
||||
"php7.4-fpm" in apt_packages or
|
||||
"php8.0-fpm" in apt_packages or
|
||||
"php8.1-fpm" in apt_packages or
|
||||
"redis-server" in apt_packages or
|
||||
"nginx-custom" in apt_packages or
|
||||
"mariadb-server" in apt_packages):
|
||||
|
||||
@@ -166,7 +166,9 @@ class WOService():
|
||||
.format(service_name))
|
||||
if is_exist[0] == 0 or service_name in ['php7.2-fpm',
|
||||
'php7.3-fpm',
|
||||
'php7.4-fpm']:
|
||||
'php7.4-fpm',
|
||||
'php8.0-fpm',
|
||||
'php8.1-fpm',]:
|
||||
retcode = subprocess.getstatusoutput('service {0} status'
|
||||
.format(service_name))
|
||||
if retcode[0] == 0:
|
||||
|
||||
@@ -14,9 +14,9 @@ class WOVar():
|
||||
"""Intialization of core variables"""
|
||||
|
||||
# WordOps version
|
||||
wo_version = "3.13.3"
|
||||
wo_version = "3.13.3-fork"
|
||||
# WordOps packages versions
|
||||
wo_wp_cli = "2.5.0"
|
||||
wo_wp_cli = "2.4.0"
|
||||
wo_adminer = "4.7.5"
|
||||
wo_phpmyadmin = "5.0.2"
|
||||
wo_extplorer = "2.1.13"
|
||||
@@ -137,13 +137,10 @@ class WOVar():
|
||||
wo_nginx = ["nginx-custom", "nginx-wo"]
|
||||
wo_nginx_key = '188C9FB063F0247A'
|
||||
|
||||
wo_module = ["fpm", "curl", "gd", "imap",
|
||||
"readline", "common",
|
||||
"cli", "mbstring", "intl",
|
||||
"bcmath", "mysql", "opcache",
|
||||
"zip", "xml", "soap", "memcached",
|
||||
"imagick", "igbinary", "msgpack",
|
||||
"redis", "xdebug"]
|
||||
wo_module = ["bcmath", "cli", "common", "curl", "fpm", "gd", "igbinary",
|
||||
"imagick", "imap", "intl", "mbstring", "memcached", "msgpack",
|
||||
"mysql", "opcache", "readline", "redis", "soap", "xdebug",
|
||||
"xml", "zip"]
|
||||
wo_php72 = []
|
||||
for module in wo_module:
|
||||
wo_php72 = wo_php72 + ["php7.2-{0}".format(module)]
|
||||
@@ -152,9 +149,15 @@ class WOVar():
|
||||
for module in wo_module:
|
||||
wo_php73 = wo_php73 + ["php7.3-{0}".format(module)]
|
||||
wo_php73 = wo_php73 + ["php7.3-recode"]
|
||||
wo_php74 = []
|
||||
wo_php74 = ["geoip", "json"]
|
||||
for module in wo_module:
|
||||
wo_php74 = wo_php74 + ["php7.4-{0}".format(module)]
|
||||
wo_php80 = []
|
||||
for module in wo_module:
|
||||
wo_php80 = wo_php80 + ["php8.0-{0}".format(module)]
|
||||
wo_php81 = []
|
||||
for module in wo_module:
|
||||
wo_php81 = wo_php81 + ["php8.1-{0}".format(module)]
|
||||
|
||||
wo_php_extra = ["graphviz"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user