diff --git a/wo/cli/controllers/base.py b/wo/cli/controllers/base.py index ad49a25..9a2dbc0 100644 --- a/wo/cli/controllers/base.py +++ b/wo/cli/controllers/base.py @@ -6,7 +6,7 @@ VERSION = WOVariables.wo_version BANNER = """ WordOps v%s -Copyright (c) 2018 WordOps. +Copyright (c) 2019 WordOps. """ % VERSION diff --git a/wo/cli/plugins/debug.py b/wo/cli/plugins/debug.py index 218bb08..6cfe596 100644 --- a/wo/cli/plugins/debug.py +++ b/wo/cli/plugins/debug.py @@ -49,7 +49,7 @@ class WODebugController(CementBaseController): dict(help='start/stop debugging fastcgi configuration', action='store' or 'store_const', choices=('on', 'off'), const='on', nargs='?')), - (['--php72'], + (['--php73'], dict(help='start/stop debugging server PHP 7.2 configuration', action='store' or 'store_const', choices=('on', 'off'), const='on', nargs='?')), @@ -80,7 +80,7 @@ class WODebugController(CementBaseController): action='store', dest='interval')), (['site_name'], dict(help='Website Name', nargs='?', default=None)) - ] + ] usage = "wo debug [] [options] " @expose(hide=True) @@ -100,7 +100,7 @@ class WODebugController(CementBaseController): for ip_addr in debug_address: if not ("debug_connection "+ip_addr in open('/etc/nginx/' - 'nginx.conf', encoding='utf-8').read()): + 'nginx.conf', encoding='utf-8').read()): Log.info(self, "Setting up Nginx debug connection" " for "+ip_addr) WOShellExec.cmd_exec(self, "sed -i \"/events {{/a\\ \\ \\ " @@ -187,26 +187,28 @@ class WODebugController(CementBaseController): # Change upstream.conf nc = NginxConfig() nc.loadf('/etc/nginx/conf.d/upstream.conf') - nc.set([('upstream','php',), 'server'], '127.0.0.1:9001') + nc.set([('upstream', 'php',), 'server'], '127.0.0.1:9001') if os.path.isfile("/etc/nginx/common/wpfc-hhvm.conf"): - nc.set([('upstream','hhvm',), 'server'], '127.0.0.1:9001') + nc.set([('upstream', 'hhvm',), 'server'], '127.0.0.1:9001') nc.savef('/etc/nginx/conf.d/upstream.conf') # Enable xdebug - WOFileUtils.searchreplace(self, "/etc/{0}/mods-available/".format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5") + - "xdebug.ini", - ";zend_extension", - "zend_extension") + WOFileUtils.searchreplace(self, "/etc/{0}/mods-available/".format("php/7.2" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5") + + "xdebug.ini", + ";zend_extension", + "zend_extension") # Fix slow log is not enabled default in PHP5.6 config = configparser.ConfigParser() - config.read('/etc/{0}/fpm/pool.d/debug.conf'.format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) - config['debug']['slowlog'] = '/var/log/{0}/slow.log'.format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5") + config.read('/etc/{0}/fpm/pool.d/debug.conf'.format("php/7.2" if (WOVariables.wo_platform_codename == + 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) + config['debug']['slowlog'] = '/var/log/{0}/slow.log'.format("php/7.2" if ( + WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5") config['debug']['request_slowlog_timeout'] = '10s' - with open('/etc/{0}/fpm/pool.d/debug.conf'.format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5"), + with open('/etc/{0}/fpm/pool.d/debug.conf'.format("php/7.2" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5"), encoding='utf-8', mode='w') as confifile: Log.debug(self, "Writting debug.conf configuration into " - "/etc/{0}/fpm/pool.d/debug.conf".format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) + "/etc/{0}/fpm/pool.d/debug.conf".format("php/7.2" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) config.write(confifile) self.trigger_php = True @@ -214,7 +216,8 @@ class WODebugController(CementBaseController): else: Log.info(self, "PHP debug is already enabled") - self.msg = self.msg + ['/var/log/{0}/slow.log'.format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")] + self.msg = self.msg + ['/var/log/{0}/slow.log'.format("php/7.2" if ( + WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")] # PHP global debug stop elif (self.app.pargs.php == 'off' and not self.app.pargs.site_name): @@ -226,13 +229,13 @@ class WODebugController(CementBaseController): # Change upstream.conf nc = NginxConfig() nc.loadf('/etc/nginx/conf.d/upstream.conf') - nc.set([('upstream','php',), 'server'], '127.0.0.1:9000') + nc.set([('upstream', 'php',), 'server'], '127.0.0.1:9000') if os.path.isfile("/etc/nginx/common/wpfc-hhvm.conf"): - nc.set([('upstream','hhvm',), 'server'], '127.0.0.1:8000') + nc.set([('upstream', 'hhvm',), 'server'], '127.0.0.1:8000') nc.savef('/etc/nginx/conf.d/upstream.conf') # Disable xdebug - WOFileUtils.searchreplace(self, "/etc/{0}/mods-available/".format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5") + + WOFileUtils.searchreplace(self, "/etc/{0}/mods-available/".format("php/7.2" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5") + "xdebug.ini", "zend_extension", ";zend_extension") @@ -248,38 +251,43 @@ class WODebugController(CementBaseController): # PHP5-FPM start global debug if (self.app.pargs.fpm == 'on' and not self.app.pargs.site_name): if not WOShellExec.cmd_exec(self, "grep \"log_level = debug\" " - "/etc/{0}/fpm/php-fpm.conf".format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")): + "/etc/{0}/fpm/php-fpm.conf".format("php/7.2" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")): Log.info(self, "Setting up PHP5-FPM log_level = debug") config = configparser.ConfigParser() - config.read('/etc/{0}/fpm/php-fpm.conf'.format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) + config.read('/etc/{0}/fpm/php-fpm.conf'.format("php/7.2" if (WOVariables.wo_platform_codename == + 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) config.remove_option('global', 'include') config['global']['log_level'] = 'debug' - config['global']['include'] = '/etc/{0}/fpm/pool.d/*.conf'.format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5") - with open('/etc/{0}/fpm/php-fpm.conf'.format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5"), + config['global']['include'] = '/etc/{0}/fpm/pool.d/*.conf'.format("php/7.2" if ( + WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5") + with open('/etc/{0}/fpm/php-fpm.conf'.format("php/7.2" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5"), encoding='utf-8', mode='w') as configfile: Log.debug(self, "Writting php5-FPM configuration into " - "/etc/{0}/fpm/php-fpm.conf".format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) + "/etc/{0}/fpm/php-fpm.conf".format("php/7.2" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) config.write(configfile) self.trigger_php = True else: Log.info(self, "PHP5-FPM log_level = debug already setup") - self.msg = self.msg + ['/var/log/{0}/fpm.log'.format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")] + self.msg = self.msg + ['/var/log/{0}/fpm.log'.format("php/7.2" if ( + WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")] # PHP5-FPM stop global debug elif (self.app.pargs.fpm == 'off' and not self.app.pargs.site_name): if WOShellExec.cmd_exec(self, "grep \"log_level = debug\" " - "/etc/{0}/fpm/php-fpm.conf".format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")): + "/etc/{0}/fpm/php-fpm.conf".format("php/7.2" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")): Log.info(self, "Disabling PHP5-FPM log_level = debug") config = configparser.ConfigParser() - config.read('/etc/{0}/fpm/php-fpm.conf'.format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) + config.read('/etc/{0}/fpm/php-fpm.conf'.format("php/7.2" if (WOVariables.wo_platform_codename == + 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) config.remove_option('global', 'include') config['global']['log_level'] = 'notice' - config['global']['include'] = '/etc/{0}/fpm/pool.d/*.conf'.format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5") - with open('/etc/{0}/fpm/php-fpm.conf'.format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5"), + config['global']['include'] = '/etc/{0}/fpm/pool.d/*.conf'.format("php/7.2" if ( + WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5") + with open('/etc/{0}/fpm/php-fpm.conf'.format("php/7.2" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5"), encoding='utf-8', mode='w') as configfile: Log.debug(self, "writting php5 configuration into " - "/etc/{0}/fpm/php-fpm.conf".format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) + "/etc/{0}/fpm/php-fpm.conf".format("php/7.2" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) config.write(configfile) self.trigger_php = True @@ -287,13 +295,13 @@ class WODebugController(CementBaseController): Log.info(self, "PHP5-FPM log_level = debug already disabled") @expose(hide=True) - def debug_php72(self): + def debug_php73(self): """Start/Stop PHP debug""" # PHP global debug start - if (self.app.pargs.php72 == 'on' and not self.app.pargs.site_name): + if (self.app.pargs.php73 == 'on' and not self.app.pargs.site_name): if (WOVariables.wo_platform_codename == 'wheezy' or WOVariables.wo_platform_codename == 'precise'): - Log.error(self,"PHP 7.2 not supported.") + Log.error(self, "PHP 7.2 not supported.") if not (WOShellExec.cmd_exec(self, "sed -n \"/upstream php7" "{/,/}/p \" /etc/nginx/" "conf.d/upstream.conf " @@ -304,16 +312,16 @@ class WODebugController(CementBaseController): # Change upstream.conf nc = NginxConfig() nc.loadf('/etc/nginx/conf.d/upstream.conf') - nc.set([('upstream','php72',), 'server'], '127.0.0.1:9172') + nc.set([('upstream', 'php73',), 'server'], '127.0.0.1:9172') if os.path.isfile("/etc/nginx/common/wpfc-hhvm.conf"): - nc.set([('upstream','hhvm',), 'server'], '127.0.0.1:9172') + nc.set([('upstream', 'hhvm',), 'server'], '127.0.0.1:9172') nc.savef('/etc/nginx/conf.d/upstream.conf') # Enable xdebug WOFileUtils.searchreplace(self, "/etc/php/7.2/mods-available/" - "xdebug.ini", - ";zend_extension", - "zend_extension") + "xdebug.ini", + ";zend_extension", + "zend_extension") # Fix slow log is not enabled default in PHP5.6 config = configparser.ConfigParser() @@ -334,8 +342,8 @@ class WODebugController(CementBaseController): self.msg = self.msg + ['/var/log/php/7.2/slow.log'] # PHP global debug stop - elif (self.app.pargs.php7 == 'off' and not self.app.pargs.site_name): - if WOShellExec.cmd_exec(self, " sed -n \"/upstream php72 {/,/}/p\" " + elif (self.app.pargs.php73 == 'off' and not self.app.pargs.site_name): + if WOShellExec.cmd_exec(self, " sed -n \"/upstream php73 {/,/}/p\" " "/etc/nginx/conf.d/upstream.conf " "| grep 9172"): Log.info(self, "Disabling PHP 7.2 debug") @@ -343,9 +351,9 @@ class WODebugController(CementBaseController): # Change upstream.conf nc = NginxConfig() nc.loadf('/etc/nginx/conf.d/upstream.conf') - nc.set([('upstream','php72',), 'server'], '127.0.0.1:9072') + nc.set([('upstream', 'php73',), 'server'], '127.0.0.1:9072') if os.path.isfile("/etc/nginx/common/wpfc-hhvm.conf"): - nc.set([('upstream','hhvm',), 'server'], '127.0.0.1:8000') + nc.set([('upstream', 'hhvm',), 'server'], '127.0.0.1:8000') nc.savef('/etc/nginx/conf.d/upstream.conf') # Disable xdebug @@ -565,7 +573,7 @@ class WODebugController(CementBaseController): if ('{0}{1}/logs/error.log'.format(WOVariables.wo_webroot, self.app.pargs.site_name) - not in self.msg): + not in self.msg): self.msg = self.msg + ['{0}{1}/logs/error.log' .format(WOVariables.wo_webroot, self.app.pargs.site_name)] @@ -595,9 +603,9 @@ class WODebugController(CementBaseController): if self.app.pargs.php: self.app.pargs.php = 'off' self.debug_php() - if self.app.pargs.php7: - self.app.pargs.php7 = 'off' - self.debug_php7() + if self.app.pargs.php73: + self.app.pargs.php73 = 'off' + self.debug_php73() if self.app.pargs.fpm: self.app.pargs.fpm = 'off' self.debug_fpm() @@ -626,12 +634,12 @@ class WODebugController(CementBaseController): # Reload PHP if self.trigger_php: if WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic': - if WOAptGet.is_installed(self,'php5.6-fpm'): - WOService.reload_service(self, 'php5.6-fpm') - if WOAptGet.is_installed(self,'php7.2-fpm'): + if WOAptGet.is_installed(self, 'php7.2-fpm'): + WOService.reload_service(self, 'php7.2-fpm') + if WOAptGet.is_installed(self, 'php7.2-fpm'): WOService.reload_service(self, 'php7.2-fpm') else: - WOService.reload_service(self, 'php5-fpm') + WOService.reload_service(self, 'php7.2-fpm') self.app.close(0) @expose(hide=True) @@ -644,12 +652,12 @@ class WODebugController(CementBaseController): self.trigger_php = False if ((not self.app.pargs.nginx) and (not self.app.pargs.php) and (not self.app.pargs.php7) - and (not self.app.pargs.fpm) and (not self.app.pargs.fpm7) and (not self.app.pargs.mysql) - and (not self.app.pargs.wp) and (not self.app.pargs.rewrite) - and (not self.app.pargs.all) - and (not self.app.pargs.site_name) - and (not self.app.pargs.import_slow_log) - and (not self.app.pargs.interval)): + and (not self.app.pargs.fpm) and (not self.app.pargs.fpm7) and (not self.app.pargs.mysql) + and (not self.app.pargs.wp) and (not self.app.pargs.rewrite) + and (not self.app.pargs.all) + and (not self.app.pargs.site_name) + and (not self.app.pargs.import_slow_log) + and (not self.app.pargs.interval)): if self.app.pargs.stop or self.app.pargs.start: print("--start/stop option is deprecated since ee v3.0.5") self.app.args.print_help() @@ -716,8 +724,8 @@ class WODebugController(CementBaseController): self.app.pargs.nginx = 'on' self.app.pargs.php = 'on' self.app.pargs.fpm = 'on' - if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') and WOAptGet.is_installed(self,'php7.2-fpm'): - self.app.pargs.php7 = 'on' + if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') and WOAptGet.is_installed(self, 'php7.2-fpm'): + self.app.pargs.php73 = 'on' self.app.pargs.fpm7 = 'on' self.app.pargs.mysql = 'on' self.app.pargs.rewrite = 'on' @@ -728,16 +736,16 @@ class WODebugController(CementBaseController): self.app.pargs.nginx = 'off' self.app.pargs.php = 'off' self.app.pargs.fpm = 'off' - if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') and WOAptGet.is_installed(self,'php7.2-fpm'): - self.app.pargs.php7 = 'off' + if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') and WOAptGet.is_installed(self, 'php7.2-fpm'): + self.app.pargs.php73 = 'off' self.app.pargs.fpm7 = 'off' self.app.pargs.mysql = 'off' self.app.pargs.rewrite = 'off' - if ((not self.app.pargs.nginx) and (not self.app.pargs.php) and (not self.app.pargs.php7) - and (not self.app.pargs.fpm) and (not self.app.pargs.fpm7) and (not self.app.pargs.mysql) - and (not self.app.pargs.wp) and (not self.app.pargs.rewrite) - and self.app.pargs.site_name): + if ((not self.app.pargs.nginx) and (not self.app.pargs.php) and (not self.app.pargs.php73) + and (not self.app.pargs.fpm) and (not self.app.pargs.fpm7) and (not self.app.pargs.mysql) + and (not self.app.pargs.wp) and (not self.app.pargs.rewrite) + and self.app.pargs.site_name): self.app.args.print_help() # self.app.pargs.nginx = 'on' # self.app.pargs.wp = 'on' @@ -749,8 +757,8 @@ class WODebugController(CementBaseController): self.debug_php() if self.app.pargs.fpm: self.debug_fpm() - if self.app.pargs.php7: - self.debug_php7() + if self.app.pargs.php73: + self.debug_php73() if self.app.pargs.fpm7: self.debug_fpm7() if self.app.pargs.mysql: @@ -774,9 +782,9 @@ class WODebugController(CementBaseController): # Reload PHP if self.trigger_php: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - if WOAptGet.is_installed(self,'php5.6-fpm'): + if WOAptGet.is_installed(self, 'php5.6-fpm'): WOService.restart_service(self, 'php5.6-fpm') - if WOAptGet.is_installed(self,'php7.2-fpm'): + if WOAptGet.is_installed(self, 'php7.2-fpm'): WOService.restart_service(self, 'php7.2-fpm') else: WOService.restart_service(self, 'php5-fpm') diff --git a/wo/cli/plugins/info.py b/wo/cli/plugins/info.py index f70f444..127f847 100644 --- a/wo/cli/plugins/info.py +++ b/wo/cli/plugins/info.py @@ -27,15 +27,15 @@ class WOInfoController(CementBaseController): dict(help='Get MySQL configuration information', action='store_true')), (['--php'], - dict(help='Get PHP configuration information', - action='store_true')), - (['--php72'], dict(help='Get PHP 7.2 configuration information', action='store_true')), + (['--php73'], + dict(help='Get PHP 7.3 configuration information', + action='store_true')), (['--nginx'], dict(help='Get Nginx configuration information', action='store_true')), - ] + ] usage = "wo info [options]" @expose(hide=True) @@ -66,17 +66,19 @@ class WOInfoController(CementBaseController): @expose(hide=True) def info_php(self): """Display PHP information""" - version = os.popen("{0} -v 2>/dev/null | head -n1 | cut -d' ' -f2 |".format("php5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php") + + version = os.popen("{0} -v 2>/dev/null | head -n1 | cut -d' ' -f2 |".format("php7.2" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php") + " cut -d'+' -f1 | tr -d '\n'").read config = configparser.ConfigParser() - config.read('/etc/{0}/fpm/php.ini'.format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) + config.read('/etc/{0}/fpm/php.ini'.format("php/7.2" if (WOVariables.wo_platform_codename == + 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) 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'] - config.read('/etc/{0}/fpm/pool.d/www.conf'.format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) + config.read('/etc/{0}/fpm/pool.d/www.conf'.format("php/7.2" if (WOVariables.wo_platform_codename == + 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) www_listen = config['www']['listen'] www_ping_path = config['www']['ping.path'] www_pm_status_path = config['www']['pm.status_path'] @@ -94,7 +96,8 @@ class WOInfoController(CementBaseController): except Exception as e: www_xdebug = 'off' - config.read('/etc/{0}/fpm/pool.d/debug.conf'.format("php/5.6" if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) + config.read('/etc/{0}/fpm/pool.d/debug.conf'.format("php/7.2" if (WOVariables.wo_platform_codename == + 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') else "php5")) debug_listen = config['debug']['listen'] debug_ping_path = config['debug']['ping.path'] debug_pm_status_path = config['debug']['pm.status_path'] @@ -138,19 +141,19 @@ class WOInfoController(CementBaseController): self.app.render((data), 'info_php.mustache') @expose(hide=True) - def info_php72(self): + def info_php73(self): """Display PHP information""" - version = os.popen("php7.2 -v 2>/dev/null | head -n1 | cut -d' ' -f2 |" + version = os.popen("php7.3 -v 2>/dev/null | head -n1 | cut -d' ' -f2 |" " cut -d'+' -f1 | tr -d '\n'").read config = configparser.ConfigParser() - config.read('/etc/php/7.2/fpm/php.ini') + config.read('/etc/php/7.3/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'] - config.read('/etc/php/7.2/fpm/pool.d/www.conf') + config.read('/etc/php/7.3/fpm/pool.d/www.conf') www_listen = config['www']['listen'] www_ping_path = config['www']['ping.path'] www_pm_status_path = config['www']['pm.status_path'] @@ -168,7 +171,7 @@ class WOInfoController(CementBaseController): except Exception as e: www_xdebug = 'off' - config.read('/etc/php/7.2/fpm/pool.d/debug.conf') + config.read('/etc/php/7.3/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'] @@ -243,12 +246,12 @@ class WOInfoController(CementBaseController): def default(self): """default function for info""" if (not self.app.pargs.nginx and not self.app.pargs.php - and not self.app.pargs.mysql and not self.app.pargs.php72): + and not self.app.pargs.mysql and not self.app.pargs.php73): self.app.pargs.nginx = True self.app.pargs.php = True self.app.pargs.mysql = True if WOAptGet.is_installed(self, 'php7.2-fpm'): - self.app.pargs.php = True + self.app.pargs.php = True if self.app.pargs.nginx: if WOAptGet.is_installed(self, 'nginx-custom') or WOAptGet.is_installed(self, 'nginx-common'): @@ -258,21 +261,21 @@ class WOInfoController(CementBaseController): if self.app.pargs.php: if (WOVariables.wo_platform_distro == 'debian' or WOVariables.wo_platform_codename == 'precise'): - if WOAptGet.is_installed(self, 'php5-fpm'): + if WOAptGet.is_installed(self, 'php7.2-fpm'): self.info_php() else: - Log.error(self, "PHP5 is not installed") + Log.error(self, "PHP 7.2 is not installed") else: - if WOAptGet.is_installed(self, 'php5.6-fpm'): + if WOAptGet.is_installed(self, 'php7.2-fpm'): self.info_php() else: - Log.error(self, "PHP5.6 is not installed") + Log.error(self, "PHP 7.2 is not installed") - if self.app.pargs.php72: - if WOAptGet.is_installed(self, 'php7.2-fpm'): - self.info_php72() + if self.app.pargs.php73: + if WOAptGet.is_installed(self, 'php7.3-fpm'): + self.info_php73() else: - Log.error(self, "PHP 7.2 is not installed") + Log.error(self, "PHP 7.3 is not installed") if self.app.pargs.mysql: if WOShellExec.cmd_exec(self, "mysqladmin ping"): diff --git a/wo/cli/plugins/site.py b/wo/cli/plugins/site.py index 1a7752e..1a70bfc 100644 --- a/wo/cli/plugins/site.py +++ b/wo/cli/plugins/site.py @@ -309,8 +309,8 @@ class WOSiteCreateController(CementBaseController): dict(help="create html site", action='store_true')), (['--php'], dict(help="create php site", action='store_true')), - (['--php72'], - dict(help="create php 7.2 site", action='store_true')), + (['--php73'], + dict(help="create php 7.3 site", action='store_true')), (['--mysql'], dict(help="create mysql site", action='store_true')), (['--wp'], @@ -344,9 +344,6 @@ class WOSiteCreateController(CementBaseController): dest='wppass')), (['--proxy'], dict(help="create proxy for site", nargs='+')), - (['--experimental'], - dict(help="Enable Experimenal packages without prompt", - action='store_true')), ] @expose(hide=True) @@ -410,16 +407,16 @@ class WOSiteCreateController(CementBaseController): data['port'] = port wo_site_webroot = "" - if self.app.pargs.php72: + if self.app.pargs.php73: data = dict(site_name=wo_domain, www_domain=wo_www_domain, - static=False, basic=False, php72=True, wp=False, + static=False, basic=False, php73=True, wp=False, wpfc=False, wpsc=False, multisite=False, wpsubdir=False, webroot=wo_site_webroot) data['basic'] = True if stype in ['html', 'php' ]: data = dict(site_name=wo_domain, www_domain=wo_www_domain, - static=True, basic=False, php72=False, wp=False, + static=True, basic=False, php73=False, wp=False, wpfc=False, wpsc=False, multisite=False, wpsubdir=False, webroot=wo_site_webroot) @@ -430,7 +427,7 @@ class WOSiteCreateController(CementBaseController): elif stype in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']: data = dict(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, wpsc=False, wpredis=False, multisite=False, wpsubdir=False, webroot=wo_site_webroot, wo_db_name='', wo_db_user='', wo_db_pass='', @@ -453,49 +450,14 @@ class WOSiteCreateController(CementBaseController): if stype == "html" and self.app.pargs.hhvm: Log.error(self, "Can not create HTML site with HHVM") - if data and self.app.pargs.php72: - if (not self.app.pargs.experimental): - Log.info(self, "Do you wish to install PHP 7.2 now for {0}?".format(wo_domain)) - - # Check prompt - check_prompt = input("Type \"y\" to continue [n]:") - if check_prompt != "Y" and check_prompt != "y": - Log.info(self, "Not using PHP 7.2 for site.") - data['php72'] = False - data['basic'] = True - php72 = 0 - self.app.pargs.php72 = False - else: - data['php72'] = True - php72 = 1 - else: - data['php72'] = True - php72 = 1 - elif data: - data['php72'] = False - php72 = 0 + if data and self.app.pargs.php73: + data['php73'] = True + php73 = 1 if (not self.app.pargs.wpfc) and (not self.app.pargs.wpsc) and (not self.app.pargs.wpredis) and (not self.app.pargs.hhvm): data['basic'] = True if data and self.app.pargs.hhvm: - if (not self.app.pargs.experimental): - Log.info(self, "HHVM is experimental feature and it may not " - "work with all plugins of your site.\nYou can " - "disable it by passing --hhvm=off later.\nDo you wish" - " to enable HHVM now for {0}?".format(wo_domain)) - - # Check prompt - check_prompt = input("Type \"y\" to continue [n]:") - if check_prompt != "Y" and check_prompt != "y": - Log.info(self, "Not using HHVM for site.") - data['hhvm'] = False - hhvm = 0 - self.app.pargs.hhvm = False - else: - data['hhvm'] = True - hhvm = 1 - else: data['hhvm'] = True hhvm = 1 @@ -503,20 +465,7 @@ class WOSiteCreateController(CementBaseController): data['hhvm'] = False hhvm = 0 - if (cache == 'wpredis' and (not self.app.pargs.experimental)): - Log.info(self, "Redis is experimental feature and it may not " - "work with all CSS/JS/Cache of your site.\nYou can " - "disable it by changing cache later.\nDo you wish" - " to enable Redis now for {0}?".format(wo_domain)) - - # Check prompt - check_prompt = input("Type \"y\" to continue [n]:") - if check_prompt != "Y" and check_prompt != "y": - Log.error(self, "Not using Redis for site") - cache = 'basic' - data['wpredis'] = False - data['basic'] = True - self.app.pargs.wpredis = False + if cache == 'wpredis': # Check rerequired packages are installed or not wo_auth = site_package_check(self, stype) @@ -563,8 +512,8 @@ class WOSiteCreateController(CementBaseController): " http://{0}".format(wo_domain)) return - if data['php72']: - php_version = "7.2" + if data['php73']: + php_version = "7.3" else: php_version = "7.2" @@ -705,23 +654,6 @@ class WOSiteCreateController(CementBaseController): "`tail /var/log/wo/wordops.log` and please try again") if self.app.pargs.letsencrypt : - if (not self.app.pargs.experimental): - if stype in ['wpsubdomain']: - Log.warn(self, "Wildcard domains are not supported in Lets Encrypt.\nWP SUBDOMAIN site will get SSL for primary site only.") - - Log.info(self, "Letsencrypt is currently in beta phase." - " \nDo you wish" - " to enable SSl now for {0}?".format(wo_domain)) - - # Check prompt - check_prompt = input("Type \"y\" to continue [n]:") - if check_prompt != "Y" and check_prompt != "y": - data['letsencrypt'] = False - letsencrypt = False - else: - data['letsencrypt'] = True - letsencrypt = True - else: data['letsencrypt'] = True letsencrypt = True @@ -775,8 +707,8 @@ class WOSiteUpdateController(CementBaseController): dict(help="update to html site", action='store_true')), (['--php'], dict(help="update to php site", action='store_true')), - (['--php72'], - dict(help="update to php7 site", + (['--php73'], + dict(help="update to PHP 7.3 site", action='store' or 'store_const', choices=('on', 'off'), const='on', nargs='?')), (['--mysql'], @@ -804,9 +736,6 @@ class WOSiteUpdateController(CementBaseController): choices=('on', 'off', 'renew'), const='on', nargs='?')), (['--proxy'], dict(help="update to proxy site", nargs='+')), - (['--experimental'], - dict(help="Enable Experimenal packages without prompt", - action='store_true')), (['--all'], dict(help="update all sites", action='store_true')), ] @@ -822,9 +751,9 @@ class WOSiteUpdateController(CementBaseController): if pargs.html: Log.error(self, "No site can be updated to html") - if not (pargs.php or pargs.php72 or + if not (pargs.php or pargs.php73 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.hhvm or pargs.wpredis or pargs.letsencrypt): Log.error(self, "Please provide options to update sites.") @@ -850,7 +779,7 @@ class WOSiteUpdateController(CementBaseController): def doupdatesite(self, pargs): hhvm = None letsencrypt = False - php72 = None + php73 = None data = dict() @@ -900,13 +829,13 @@ class WOSiteUpdateController(CementBaseController): check_php_version = check_site.php_version if check_php_version == "7.2": - old_php72 = True + old_php73 = True else: - old_php72 = False + old_php73 = False if (pargs.password and not (pargs.html or - pargs.php or pargs.php72 or pargs.mysql or - pargs.wp or pargs.wpfc or pargs.wpsc or + pargs.php or pargs.php73 or pargs.mysql or + pargs.wp or pargs.wpfc or pargs.wpsc or pargs.wpsubdir or pargs.wpsubdomain)): try: updatewpuserpassword(self, wo_domain, wo_site_webroot) @@ -925,16 +854,16 @@ class WOSiteUpdateController(CementBaseController): Log.info(self, Log.FAIL + "Can not update HTML site to HHVM") return 1 - if ((stype == 'php' and oldsitetype not in ['html', 'proxy', 'php72']) or - # (stype == 'php72' and oldsitetype not in ['html', 'mysql', 'php', 'php72', 'wp', 'wpsubdir', 'wpsubdomain', ]) or + if ((stype == 'php' and oldsitetype not in ['html', 'proxy', 'php73']) or + # (stype == 'php73' and oldsitetype not in ['html', 'mysql', 'php', 'php73', 'wp', 'wpsubdir', 'wpsubdomain', ]) or (stype == 'mysql' and oldsitetype not in ['html', 'php', - 'proxy','php72']) or + 'proxy','php73']) or (stype == 'wp' and oldsitetype not in ['html', 'php', 'mysql', - 'proxy', 'wp', 'php72']) or + 'proxy', 'wp', 'php73']) or (stype == 'wpsubdir' and oldsitetype in ['wpsubdomain']) or (stype == 'wpsubdomain' and oldsitetype in ['wpsubdir']) or (stype == oldsitetype and cache == oldcachetype) and - not pargs.php72): + not pargs.php73): Log.info(self, Log.FAIL + "can not update {0} {1} to {2} {3}". format(oldsitetype, oldcachetype, stype, cache)) return 1 @@ -952,7 +881,7 @@ class WOSiteUpdateController(CementBaseController): if stype == 'php': data = dict(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, wpsc=False, wpredis=False, multisite=False, wpsubdir=False, webroot=wo_site_webroot, currsitetype=oldsitetype, currcachetype=oldcachetype) @@ -960,7 +889,7 @@ class WOSiteUpdateController(CementBaseController): elif stype in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']: data = dict(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, wpsc=False, wpredis=False, multisite=False, wpsubdir=False, webroot=wo_site_webroot, wo_db_name='', wo_db_user='', wo_db_pass='', @@ -976,7 +905,7 @@ class WOSiteUpdateController(CementBaseController): if stype == 'wpsubdir': data['wpsubdir'] = True - if pargs.hhvm or pargs.php72: + if pargs.hhvm or pargs.php73: if not data: data = dict(site_name=wo_domain, www_domain=wo_www_domain, currsitetype=oldsitetype, @@ -1038,24 +967,24 @@ class WOSiteUpdateController(CementBaseController): data['hhvm'] = False hhvm = False - if pargs.php72 == 'on' : - data['php72'] = True - php72 = True - check_php_version= '7.2' - elif pargs.php72 == 'off': - data['php72'] = False - php72 = False - check_php_version = '5.6' + if pargs.php73 == 'on' : + data['php73'] = True + php73 = True + check_php_version= '7.3' + elif pargs.php73 == 'off': + data['php73'] = False + php73 = False + check_php_version = '7.2' - if pargs.php72: - if php72 is old_php72: - if php72 is False: - Log.info(self, "PHP 7.2 is already disabled for given " + if pargs.php73: + if php73 is old_php73: + if php73 is False: + Log.info(self, "PHP 7.3 is already disabled for given " "site") - elif php72 is True: - Log.info(self, "PHP 7.2 is already enabled for given " + elif php73 is True: + Log.info(self, "PHP 7.3 is already enabled for given " "site") - pargs.php72 = False + pargs.php73 = False #--letsencrypt=renew code goes here if pargs.letsencrypt == "renew" and not pargs.all: @@ -1154,92 +1083,31 @@ class WOSiteUpdateController(CementBaseController): data['hhvm'] = False hhvm = False - if data and (not pargs.php72): - if old_php72 is True: - data['php72'] = True - php72 = True + if data and (not pargs.php73): + if old_php73 is True: + data['php73'] = True + php73 = True else: - data['php72'] = False - php72 = False + data['php73'] = False + php73 = False - if pargs.hhvm=="on" or pargs.letsencrypt=="on" or pargs.php72=="on": - if pargs.php72 == "on": - if (not pargs.experimental): - Log.info(self, "Do you wish to enable PHP 7.2 now for {0}?".format(wo_domain)) - - check_prompt = input("Type \"y\" to continue [n]:") - if check_prompt != "Y" and check_prompt != "y": - Log.info(self, "Not using PHP 7.2 for site") - data['php72'] = False - php72 = False - else: - data['php72'] = True - php72 = True - else: - data['php72'] = True - php72 = True + if pargs.hhvm=="on" or pargs.letsencrypt=="on" or pargs.php73=="on": + if pargs.php73 == "on": + data['php73'] = True + php73 = True if pargs.hhvm == "on": - if (not pargs.experimental): - Log.info(self, "HHVM is experimental feature and it may not" - " work with all plugins of your site.\nYou can " - "disable it by passing --hhvm=off later.\nDo you wish" - " to enable HHVM now for {0}?".format(wo_domain)) - - # Check prompt - check_prompt = input("Type \"y\" to continue [n]:") - if check_prompt != "Y" and check_prompt != "y": - Log.info(self, "Not using HHVM for site") - data['hhvm'] = False - hhvm = False - else: - data['hhvm'] = True - hhvm = True - else: data['hhvm'] = True hhvm = True if pargs.letsencrypt == "on": - - if (not pargs.experimental): - - if oldsitetype in ['wpsubdomain']: - Log.warn(self, "Wildcard domains are not supported in Lets Encrypt.\nWP SUBDOMAIN site will get SSL for primary site only.") - - Log.info(self, "Letsencrypt is currently in beta phase." - " \nDo you wish" - " to enable SSl now for {0}?".format(wo_domain)) - - check_prompt = input("Type \"y\" to continue [n]:") - if check_prompt != "Y" and check_prompt != "y": - Log.info(self, "Not using letsencrypt for site") - data['letsencrypt'] = False - letsencrypt = False - else: - data['letsencrypt'] = True - letsencrypt = True - else: data['letsencrypt'] = True letsencrypt = True if pargs.wpredis and data['currcachetype'] != 'wpredis': - if (not pargs.experimental): - Log.info(self, "Redis is experimental feature and it may not" - " work with all plugins of your site.\nYou can " - "disable it by changing cache type later.\nDo you wish" - " to enable Redis now for {0}?".format(wo_domain)) - - # Check prompt - check_prompt = input("Type \"y\" to continue [n]: ") - if check_prompt != "Y" and check_prompt != "y": - Log.error(self, "Not using Redis for site") - data['wpredis'] = False - data['basic'] = True - cache = 'basic' - - if ((hhvm is old_hhvm) and (php72 is old_php72) and + if ((hhvm is old_hhvm) and (php73 is old_php73) and (stype == oldsitetype and cache == oldcachetype)): return 1 diff --git a/wo/cli/plugins/site_functions.py b/wo/cli/plugins/site_functions.py index 79b301c..7d128be 100644 --- a/wo/cli/plugins/site_functions.py +++ b/wo/cli/plugins/site_functions.py @@ -72,7 +72,7 @@ def setupdomain(self, data): wo_site_nginx_conf = open('/etc/nginx/sites-available/{0}' .format(wo_domain_name), encoding='utf-8', mode='w') - if not data['php72']: + if not data['php73']: self.app.render((data), 'virtualconf.mustache', out=wo_site_nginx_conf) else: @@ -623,7 +623,7 @@ def sitebackup(self, data): .format(data['site_name']), backup_path) if data['currsitetype'] in ['html', 'php', 'proxy', 'mysql']: - if data['php72'] is True and not data['wp']: + if data['php73'] is True and not data['wp']: Log.info(self, "Backing up Webroot \t\t", end='') WOFileUtils.copyfiles(self, wo_site_webroot + '/htdocs', backup_path + '/htdocs') Log.info(self, "[" + Log.ENDC + "Done" + Log.OKBLUE + "]") @@ -663,7 +663,7 @@ def sitebackup(self, data): Log.info(self, "[" + Log.ENDC + "Done" + Log.OKBLUE + "]") # move wp-config.php/wo-config.php to backup if data['currsitetype'] in ['mysql', 'proxy']: - if data['php72'] is True and not data['wp']: + if data['php73'] is True and not data['wp']: WOFileUtils.copyfile(self, configfiles[0], backup_path) else: WOFileUtils.mvfile(self, configfiles[0], backup_path) @@ -677,7 +677,7 @@ def site_package_check(self, stype): stack = WOStackController() stack.app = self.app if stype in ['html', 'proxy', 'php', 'mysql', 'wp', 'wpsubdir', - 'wpsubdomain', 'php72']: + 'wpsubdomain', 'php73']: Log.debug(self, "Setting apt_packages variable for Nginx") # Check if server has nginx-custom package @@ -708,22 +708,22 @@ def site_package_check(self, stype): wo_nginx.write('fastcgi_param \tSCRIPT_FILENAME ' '\t$request_filename;\n') - if self.app.pargs.php and self.app.pargs.php72: + if self.app.pargs.php and self.app.pargs.php73: Log.error(self,"Error: two different PHP versions cannot be combined within the same WordOps site") - if not self.app.pargs.php72 and stype in ['php', 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']: + if not self.app.pargs.php73 and stype in ['php', 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']: Log.debug(self, "Setting apt_packages variable for PHP") - apt_packages = apt_packages + WOVariables.wo_php72 + WOVariables.wo_php_extra + apt_packages = apt_packages + WOVariables.wo_php73 + WOVariables.wo_php_extra - if self.app.pargs.php72 and stype in [ 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']: + if self.app.pargs.php73 and stype in [ 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - Log.debug(self, "Setting apt_packages variable for PHP 7.2") - if not WOAptGet.is_installed(self, 'php7.2-fpm'): - apt_packages = apt_packages + WOVariables.wo_php72 + WOVariables.wo_php_extra + Log.debug(self, "Setting apt_packages variable for PHP 7.3") + if not WOAptGet.is_installed(self, 'php7.3-fpm'): + apt_packages = apt_packages + WOVariables.wo_php73 + WOVariables.wo_php_extra else: - Log.debug(self, "Setting apt_packages variable for PHP 7.2") - if not WOAptGet.is_installed(self, 'php7.2-fpm'): - apt_packages = apt_packages + WOVariables.wo_php72 + Log.debug(self, "Setting apt_packages variable for PHP 7.3") + if not WOAptGet.is_installed(self, 'php7.3-fpm'): + apt_packages = apt_packages + WOVariables.wo_php73 if stype in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']: Log.debug(self, "Setting apt_packages variable for MySQL") @@ -736,7 +736,7 @@ def site_package_check(self, stype): if stype in ['wp', 'wpsubdir', 'wpsubdomain']: Log.debug(self, "Setting packages variable for WP-CLI") - if not WOShellExec.cmd_exec(self, "which wp"): + if not WOShellExec.cmd_exec(self, "command -v wp"): packages = packages + [["https://github.com/wp-cli/wp-cli/" "releases/download/v{0}/" "wp-cli-{0}.phar" @@ -830,13 +830,13 @@ def site_package_check(self, stype): hhvm_file.write("upstream hhvm {\nserver 127.0.0.1:8000;\n" "server 127.0.0.1:9000 backup;\n}\n") - if self.app.pargs.php72: + if self.app.pargs.php73: if (WOVariables.wo_platform_codename == 'wheezy' or WOVariables.wo_platform_codename == 'precise'): Log.error(self,"PHP 7.0 is not supported in your Platform") - Log.debug(self, "Setting apt_packages variable for PHP 7.0") - if not WOAptGet.is_installed(self, 'php7.2-fpm'): - apt_packages = apt_packages + WOVariables.wo_php72 + WOVariables.wo_php_extra + Log.debug(self, "Setting apt_packages variable for PHP 7.3") + if not WOAptGet.is_installed(self, 'php7.3-fpm'): + apt_packages = apt_packages + WOVariables.wo_php73 + WOVariables.wo_php_extra if os.path.isdir("/etc/nginx/common") and (not os.path.isfile("/etc/nginx/common/php7.conf")): @@ -894,9 +894,9 @@ def site_package_check(self, stype): if os.path.isfile("/etc/nginx/conf.d/upstream.conf"): if not WOFileUtils.grep(self, "/etc/nginx/conf.d/upstream.conf", - "php72"): + "php73"): with open("/etc/nginx/conf.d/upstream.conf", "a") as php_file: - php_file.write("upstream php72 {\nserver 127.0.0.1:9072;\n}\n" + php_file.write("upstream php73 {\nserver 127.0.0.1:9072;\n}\n" "upstream debug72 {\nserver 127.0.0.1:9172;\n}\n") return(stack.install(apt_packages=apt_packages, packages=packages, @@ -1032,7 +1032,7 @@ def detSitePar(opts): cachelist = list() for key, val in opts.items(): if val and key in ['html', 'php', 'mysql', 'wp', - 'wpsubdir', 'wpsubdomain','php72']: + 'wpsubdir', 'wpsubdomain','php73']: typelist.append(key) elif val and key in ['wpfc', 'wpsc', 'wpredis']: cachelist.append(key) @@ -1046,7 +1046,7 @@ def detSitePar(opts): cachetype = 'basic' else: cachetype = cachelist[0] - elif False not in [x in ('php72','mysql','html') for x in typelist]: + elif False not in [x in ('php73','mysql','html') for x in typelist]: sitetype = 'mysql' if not cachelist: cachetype = 'basic' @@ -1058,7 +1058,7 @@ def detSitePar(opts): cachetype = 'basic' else: cachetype = cachelist[0] - elif False not in [x in ('php72','mysql') for x in typelist]: + elif False not in [x in ('php73','mysql') for x in typelist]: sitetype = 'mysql' if not cachelist: cachetype = 'basic' @@ -1076,8 +1076,8 @@ def detSitePar(opts): cachetype = 'basic' else: cachetype = cachelist[0] - elif False not in [x in ('php72','html') for x in typelist]: - sitetype = 'php72' + elif False not in [x in ('php73','html') for x in typelist]: + sitetype = 'php73' if not cachelist: cachetype = 'basic' else: @@ -1094,19 +1094,19 @@ def detSitePar(opts): cachetype = 'basic' else: cachetype = cachelist[0] - elif False not in [x in ('wp','php72') for x in typelist]: + elif False not in [x in ('wp','php73') 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','php73') 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','php73') for x in typelist]: sitetype = 'wpsubdomain' if not cachelist: cachetype = 'basic' @@ -1118,7 +1118,7 @@ def detSitePar(opts): if not typelist and not cachelist: sitetype = None cachetype = None - elif (not typelist or "php72" in typelist) and cachelist: + elif (not typelist or "php73" in typelist) and cachelist: sitetype = 'wp' cachetype = cachelist[0] elif typelist and (not cachelist): diff --git a/wo/cli/plugins/stack.py b/wo/cli/plugins/stack.py index c7334d4..63cf56c 100644 --- a/wo/cli/plugins/stack.py +++ b/wo/cli/plugins/stack.py @@ -53,12 +53,12 @@ class WOStackController(CementBaseController): dict(help='Install admin tools stack', action='store_true')), (['--nginx'], dict(help='Install Nginx stack', action='store_true')), -# (['--nginxmainline'], -# dict(help='Install Nginx mainline stack', action='store_true')), + # (['--nginxmainline'], + # dict(help='Install Nginx mainline stack', action='store_true')), (['--php'], - dict(help='Install PHP stack', action='store_true')), - (['--php72'], dict(help='Install PHP 7.2 stack', action='store_true')), + (['--php73'], + dict(help='Install PHP 7.3 stack', action='store_true')), (['--mysql'], dict(help='Install MySQL stack', action='store_true')), (['--hhvm'], @@ -75,7 +75,7 @@ class WOStackController(CementBaseController): dict(help='Install Redis', action='store_true')), (['--phpredisadmin'], dict(help='Install phpRedisAdmin', action='store_true')), - ] + ] usage = "ee stack (command) [options]" @expose(hide=True) @@ -96,11 +96,11 @@ class WOStackController(CementBaseController): mysql_pref_file.write(mysql_pref) WORepo.add(self, repo_url=WOVariables.wo_mysql_repo) Log.debug(self, 'Adding key for {0}' - .format(WOVariables.wo_mysql_repo)) + .format(WOVariables.wo_mysql_repo)) WORepo.add_key(self, '0xcbcb082a1bb943db', - keyserver="keyserver.ubuntu.com") + keyserver="keyserver.ubuntu.com") WORepo.add_key(self, '0xF1656F24C74CD1D8', - keyserver="keyserver.ubuntu.com") + keyserver="keyserver.ubuntu.com") chars = ''.join(random.sample(string.ascii_letters, 8)) Log.debug(self, "Pre-seeding MySQL") Log.debug(self, "echo \"mariadb-server-10.1 " @@ -154,7 +154,7 @@ class WOStackController(CementBaseController): WORepo.add_key(self, WOVariables.wo_nginx_key) if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - if set(WOVariables.wo_php72).issubset(set(apt_packages)): + if set(WOVariables.wo_php73).issubset(set(apt_packages)): Log.info(self, "Adding repository for PHP, please wait...") Log.debug(self, 'Adding ppa for PHP') WORepo.add(self, ppa=WOVariables.wo_php_repo) @@ -173,7 +173,7 @@ class WOStackController(CementBaseController): WORepo.add(self, ppa=WOVariables.wo_php_repo) if WOVariables.wo_platform_codename == 'jessie': - if set(WOVariables.wo_php72).issubset(set(apt_packages)): + if set(WOVariables.wo_php73).issubset(set(apt_packages)): Log.debug(self, 'Adding repo_url of php 7.0 for debian') WORepo.add(self, repo_url=WOVariables.wo_php_repo) Log.debug(self, 'Adding Dotdeb/php GPG key') @@ -243,8 +243,8 @@ class WOStackController(CementBaseController): self.app.render((data), 'fastcgi.mustache', out=wo_nginx) wo_nginx.close() - data = dict(php="9000", debug="9001", hhvm="8000",php72="9072",debug7="9172", - hhvmconf=False, php7conf= True if WOAptGet.is_installed(self,'php7.2-fpm') else False ) + data = dict(php="9000", debug="9001", hhvm="8000", php73="9072", debug7="9172", + hhvmconf=False, php7conf=True if WOAptGet.is_installed(self, 'php7.2-fpm') else False) Log.debug(self, 'Writting the nginx configuration to ' 'file /etc/nginx/conf.d/upstream.conf') wo_nginx = open('/etc/nginx/conf.d/upstream.conf', @@ -315,56 +315,56 @@ class WOStackController(CementBaseController): out=wo_nginx) wo_nginx.close() - #php7 conf + # php7 conf if (WOVariables.wo_platform_codename == 'stretch' or WOVariables.wo_platform_codename == 'jessie' or WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') and (not - os.path.isfile("/etc/nginx/common/php7.conf")): + os.path.isfile("/etc/nginx/common/php7.conf")): #data = dict() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/locations-php7.conf') + 'file /etc/nginx/common/locations-php7.conf') wo_nginx = open('/etc/nginx/common/locations-php7.conf', - encoding='utf-8', mode='w') + encoding='utf-8', mode='w') self.app.render((data), 'locations-php7.mustache', - out=wo_nginx) + out=wo_nginx) wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/php7.conf') + 'file /etc/nginx/common/php7.conf') wo_nginx = open('/etc/nginx/common/php7.conf', - encoding='utf-8', mode='w') + encoding='utf-8', mode='w') self.app.render((data), 'php7.mustache', - out=wo_nginx) + out=wo_nginx) wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/wpcommon-php7.conf') + 'file /etc/nginx/common/wpcommon-php7.conf') wo_nginx = open('/etc/nginx/common/wpcommon-php7.conf', - encoding='utf-8', mode='w') + encoding='utf-8', mode='w') self.app.render((data), 'wpcommon-php7.mustache', - out=wo_nginx) + out=wo_nginx) wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/wpfc-php7.conf') + 'file /etc/nginx/common/wpfc-php7.conf') wo_nginx = open('/etc/nginx/common/wpfc-php7.conf', - encoding='utf-8', mode='w') + encoding='utf-8', mode='w') self.app.render((data), 'wpfc-php7.mustache', - out=wo_nginx) + out=wo_nginx) wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/wpsc-php7.conf') + 'file /etc/nginx/common/wpsc-php7.conf') wo_nginx = open('/etc/nginx/common/wpsc-php7.conf', - encoding='utf-8', mode='w') + encoding='utf-8', mode='w') self.app.render((data), 'wpsc-php7.mustache', - out=wo_nginx) + out=wo_nginx) wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' 'file /etc/nginx/common/redis-php7.conf') wo_nginx = open('/etc/nginx/common/redis-php7.conf', - encoding='utf-8', mode='w') + encoding='utf-8', mode='w') self.app.render((data), 'redis-php7.mustache', - out=wo_nginx) + out=wo_nginx) wo_nginx.close() # Nginx-Plus does not have nginx package structure like this @@ -393,8 +393,8 @@ class WOStackController(CementBaseController): wo_nginx.close() passwd = ''.join([random.choice - (string.ascii_letters + string.digits) - for n in range(6)]) + (string.ascii_letters + string.digits) + for n in range(6)]) try: WOShellExec.cmd_exec(self, "printf \"WordOps:" "$(openssl passwd -crypt " @@ -433,14 +433,14 @@ class WOStackController(CementBaseController): '22222.access.log', '{0}22222/' 'logs/access.log' - .format(WOVariables.wo_webroot)] + .format(WOVariables.wo_webroot)] ) WOFileUtils.create_symlink(self, ['/var/log/nginx/' '22222.error.log', '{0}22222/' 'logs/error.log' - .format(WOVariables.wo_webroot)] + .format(WOVariables.wo_webroot)] ) try: @@ -474,7 +474,8 @@ class WOStackController(CementBaseController): .format(WOVariables.wo_webroot)) except CommandExecutionError as e: - Log.error(self, "Failed to generate HTTPS certificate for 22222") + Log.error( + self, "Failed to generate HTTPS certificate for 22222") # Nginx Configation into GIT WOGit.add(self, @@ -482,12 +483,12 @@ class WOStackController(CementBaseController): WOService.reload_service(self, 'nginx') if set(["nginx-plus"]).issubset(set(apt_packages)) or set(["nginx"]).issubset(set(apt_packages)): WOShellExec.cmd_exec(self, "sed -i -e 's/^user/#user/'" - " -e '/^#user/a user" - "\ www-data\;'" - " /etc/nginx/nginx.conf") + " -e '/^#user/a user" + "\ www-data\;'" + " /etc/nginx/nginx.conf") if not WOShellExec.cmd_exec(self, "cat /etc/nginx/" - "nginx.conf | grep -q " - "'/etc/nginx/sites-enabled'"): + "nginx.conf | grep -q " + "'/etc/nginx/sites-enabled'"): WOShellExec.cmd_exec(self, "sed -i '/\/etc\/" "nginx\/conf\.d\/\*" "\.conf/a \ include" @@ -505,17 +506,17 @@ class WOStackController(CementBaseController): wo_nginx.close() print("HTTP Auth User Name: WordOps" - + "\nHTTP Auth Password : {0}".format(passwd)) + + "\nHTTP Auth Password : {0}".format(passwd)) WOService.reload_service(self, 'nginx') else: self.msg = (self.msg + ["HTTP Auth User Name: WordOps"] - + ["HTTP Auth Password : {0}".format(passwd)]) + + ["HTTP Auth Password : {0}".format(passwd)]) else: WOService.restart_service(self, 'nginx') - if WOAptGet.is_installed(self,'redis-server'): + if WOAptGet.is_installed(self, 'redis-server'): if os.path.isfile("/etc/nginx/nginx.conf") and (not - os.path.isfile("/etc/nginx/common/redis.conf")): + os.path.isfile("/etc/nginx/common/redis.conf")): data = dict() Log.debug(self, 'Writting the nginx configuration to ' @@ -527,7 +528,7 @@ class WOStackController(CementBaseController): wo_nginx.close() if os.path.isfile("/etc/nginx/nginx.conf") and (not - os.path.isfile("/etc/nginx/common/redis-hhvm.conf")): + os.path.isfile("/etc/nginx/common/redis-hhvm.conf")): data = dict() Log.debug(self, 'Writting the nginx configuration to ' @@ -540,14 +541,14 @@ class WOStackController(CementBaseController): if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): if os.path.isfile("/etc/nginx/nginx.conf") and (not - os.path.isfile("/etc/nginx/common/redis-php7.conf")): + os.path.isfile("/etc/nginx/common/redis-php7.conf")): data = dict() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/redis-php7.conf') + 'file /etc/nginx/common/redis-php7.conf') wo_nginx = open('/etc/nginx/common/redis-php7.conf', - encoding='utf-8', mode='w') + encoding='utf-8', mode='w') self.app.render((data), 'redis-php7.mustache', - out=wo_nginx) + out=wo_nginx) wo_nginx.close() if os.path.isfile("/etc/nginx/conf.d/upstream.conf"): @@ -561,16 +562,16 @@ class WOStackController(CementBaseController): " keepalive 10;\n}\n") if os.path.isfile("/etc/nginx/nginx.conf") and (not - os.path.isfile("/etc/nginx/conf.d/redis.conf")): + os.path.isfile("/etc/nginx/conf.d/redis.conf")): with open("/etc/nginx/conf.d/redis.conf", "a") as redis_file: redis_file.write("# Log format Settings\n" "log_format rt_cache_redis '$remote_addr $upstream_response_time $srcache_fetch_status [$time_local] '\n" "'$http_host \"$request\" $status $body_bytes_sent '\n" "'\"$http_referer\" \"$http_user_agent\"';\n") - #setup nginx common folder for php7 - if self.app.pargs.php72: + # setup nginx common folder for php7 + if self.app.pargs.php73: if os.path.isdir("/etc/nginx/common") and (not - os.path.isfile("/etc/nginx/common/php7.conf")): + os.path.isfile("/etc/nginx/common/php7.conf")): data = dict() Log.debug(self, 'Writting the nginx configuration to ' 'file /etc/nginx/common/locations-php7.conf') @@ -581,15 +582,15 @@ class WOStackController(CementBaseController): wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/php7.conf') + 'file /etc/nginx/common/php7.conf') wo_nginx = open('/etc/nginx/common/php7.conf', - encoding='utf-8', mode='w') + encoding='utf-8', mode='w') self.app.render((data), 'php7.mustache', - out=wo_nginx) + out=wo_nginx) wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/wpcommon-php7.conf') + 'file /etc/nginx/common/wpcommon-php7.conf') wo_nginx = open('/etc/nginx/common/wpcommon-php7.conf', encoding='utf-8', mode='w') self.app.render((data), 'wpcommon-php7.mustache', @@ -597,37 +598,37 @@ class WOStackController(CementBaseController): wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/wpfc-php7.conf') + 'file /etc/nginx/common/wpfc-php7.conf') wo_nginx = open('/etc/nginx/common/wpfc-php7.conf', - encoding='utf-8', mode='w') + encoding='utf-8', mode='w') self.app.render((data), 'wpfc-php7.mustache', - out=wo_nginx) + out=wo_nginx) wo_nginx.close() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/wpsc-php7.conf') + 'file /etc/nginx/common/wpsc-php7.conf') wo_nginx = open('/etc/nginx/common/wpsc-php7.conf', - encoding='utf-8', mode='w') + encoding='utf-8', mode='w') self.app.render((data), 'wpsc-php7.mustache', - out=wo_nginx) + out=wo_nginx) wo_nginx.close() if os.path.isdir("/etc/nginx/common") and (not os.path.isfile("/etc/nginx/common/redis-php7.conf")): data = dict() Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/redis-php7.conf') + 'file /etc/nginx/common/redis-php7.conf') wo_nginx = open('/etc/nginx/common/redis-php7.conf', - encoding='utf-8', mode='w') + encoding='utf-8', mode='w') self.app.render((data), 'redis-php7.mustache', - out=wo_nginx) + out=wo_nginx) wo_nginx.close() if os.path.isfile("/etc/nginx/conf.d/upstream.conf"): if not WOFileUtils.grep(self, "/etc/nginx/conf.d/upstream.conf", - "php72"): + "php73"): with open("/etc/nginx/conf.d/upstream.conf", "a") as php_file: - php_file.write("upstream php72 {\nserver 127.0.0.1:9072;\n}\n" - "upstream debug72 {\nserver 127.0.0.1:9172;\n}\n") + php_file.write("upstream php73 {\nserver 127.0.0.1:9072;\n}\n" + "upstream debug72 {\nserver 127.0.0.1:9172;\n}\n") if set(WOVariables.wo_hhvm).issubset(set(apt_packages)): @@ -637,7 +638,7 @@ class WOStackController(CementBaseController): "9000", "8000") if (WOVariables.wo_platform_codename != 'xenial' or WOVariables.wo_platform_codename != 'bionic'): WOFileUtils.searchreplace(self, "/etc/nginx/hhvm.conf", - "9000", "8000") + "9000", "8000") with open("/etc/hhvm/php.ini", "a") as hhvm_file: hhvm_file.write("hhvm.log.header = true\n" @@ -675,7 +676,7 @@ class WOStackController(CementBaseController): WOService.restart_service(self, 'hhvm') if os.path.isfile("/etc/nginx/nginx.conf") and (not - os.path.isfile("/etc/nginx/common/php-hhvm.conf")): + os.path.isfile("/etc/nginx/common/php-hhvm.conf")): data = dict() Log.debug(self, 'Writting the nginx configuration to ' @@ -708,7 +709,7 @@ class WOStackController(CementBaseController): if set(WOVariables.wo_redis).issubset(set(apt_packages)): if os.path.isfile("/etc/nginx/nginx.conf") and (not - os.path.isfile("/etc/nginx/common/redis.conf")): + os.path.isfile("/etc/nginx/common/redis.conf")): data = dict() Log.debug(self, 'Writting the nginx configuration to ' @@ -720,7 +721,7 @@ class WOStackController(CementBaseController): wo_nginx.close() if os.path.isfile("/etc/nginx/nginx.conf") and (not - os.path.isfile("/etc/nginx/common/redis-hhvm.conf")): + os.path.isfile("/etc/nginx/common/redis-hhvm.conf")): data = dict() Log.debug(self, 'Writting the nginx configuration to ' @@ -742,7 +743,7 @@ class WOStackController(CementBaseController): " keepalive 10;\n}\n") if os.path.isfile("/etc/nginx/nginx.conf") and (not - os.path.isfile("/etc/nginx/conf.d/redis.conf")): + os.path.isfile("/etc/nginx/conf.d/redis.conf")): with open("/etc/nginx/conf.d/redis.conf", "a") as redis_file: redis_file.write("# Log format Settings\n" "log_format rt_cache_redis '$remote_addr $upstream_response_time $srcache_fetch_status [$time_local] '\n" @@ -772,11 +773,11 @@ class WOStackController(CementBaseController): # Parse /etc/php/7.2/fpm/php-fpm.conf data = dict(pid="/run/php/php7.2-fpm.pid", error_log="/var/log/php/7.2/fpm.log", - include="/etc/php/7.2/fpm/pool.d/*.conf") + include="/etc/php/7.2/fpm/pool.d/*.conf") Log.debug(self, "writting php5 configuration into " - "/etc/php/7.2/fpm/php-fpm.conf") + "/etc/php/7.2/fpm/php-fpm.conf") wo_php_fpm = open('/etc/php/7.2/fpm/php-fpm.conf', - encoding='utf-8', mode='w') + encoding='utf-8', mode='w') self.app.render((data), 'php-fpm.mustache', out=wo_php_fpm) wo_php_fpm.close() @@ -793,7 +794,10 @@ class WOStackController(CementBaseController): config['www']['pm.max_spare_servers'] = '5' config['www']['request_terminate_timeout'] = '100' config['www']['pm'] = 'ondemand' - config['www']['listen'] = '127.0.0.1:9072' + config['www']['chdir'] = '/' + config['www']['prefix'] = '/var/run/php' + config['www']['listen'] = 'php73-fpm.sock' + config['www']['listen.backlog'] = '32768' with codecs.open('/etc/php/7.2/fpm/pool.d/www.conf', encoding='utf-8', mode='w') as configfile: Log.debug(self, "Writing PHP 7.2 configuration into " @@ -829,9 +833,9 @@ class WOStackController(CementBaseController): # Disable xdebug if not WOShellExec.cmd_exec(self, "grep -q \';zend_extension\' /etc/php/7.2/mods-available/xdebug.ini"): WOFileUtils.searchreplace(self, "/etc/php/7.2/mods-available/" - "xdebug.ini", - "zend_extension", - ";zend_extension") + "xdebug.ini", + "zend_extension", + ";zend_extension") # PHP and Debug pull configuration if not os.path.exists('{0}22222/htdocs/fpm/status/' @@ -870,41 +874,41 @@ class WOStackController(CementBaseController): WOGit.add(self, ["/etc/php"], msg="Adding PHP into Git") WOService.restart_service(self, 'php7.2-fpm') - #PHP7.0 configuration for debian - if (WOVariables.wo_platform_codename == 'jessie' ) and set(WOVariables.wo_php72).issubset(set(apt_packages)): + # PHP7.3 configuration for debian + if (WOVariables.wo_platform_codename == 'jessie') and set(WOVariables.wo_php73).issubset(set(apt_packages)): # Create log directories - if not os.path.exists('/var/log/php/7.2/'): - Log.debug(self, 'Creating directory /var/log/php/7.2/') - os.makedirs('/var/log/php/7.2/') + if not os.path.exists('/var/log/php/7.3/'): + Log.debug(self, 'Creating directory /var/log/php/7.3/') + os.makedirs('/var/log/php/7.3/') - # Parse etc/php/7.2/fpm/php.ini + # Parse etc/php/7.3/fpm/php.ini config = configparser.ConfigParser() - Log.debug(self, "configuring php file /etc/php/7.2/fpm/php.ini") - config.read('/etc/php/7.2/fpm/php.ini') + Log.debug(self, "configuring php file /etc/php/7.3/fpm/php.ini") + config.read('/etc/php/7.3/fpm/php.ini') 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']['date.timezone'] = WOVariables.wo_timezone - with open('/etc/php/7.2/fpm/php.ini', + with open('/etc/php/7.3/fpm/php.ini', encoding='utf-8', mode='w') as configfile: Log.debug(self, "Writting php configuration into " - "/etc/php/7.2/fpm/php.ini") + "/etc/php/7.3/fpm/php.ini") config.write(configfile) - # Parse /etc/php/7.2/fpm/php-fpm.conf - data = dict(pid="/run/php/php7.2-fpm.pid", error_log="/var/log/php7.2-fpm.log", - include="/etc/php/7.2/fpm/pool.d/*.conf") + # Parse /etc/php/7.3/fpm/php-fpm.conf + data = dict(pid="/run/php/php7.3-fpm.pid", error_log="/var/log/php7.3-fpm.log", + include="/etc/php/7.3/fpm/pool.d/*.conf") Log.debug(self, "writting php 7.0 configuration into " - "/etc/php/7.2/fpm/php-fpm.conf") - wo_php_fpm = open('/etc/php/7.2/fpm/php-fpm.conf', - encoding='utf-8', mode='w') + "/etc/php/7.3/fpm/php-fpm.conf") + wo_php_fpm = open('/etc/php/7.3/fpm/php-fpm.conf', + encoding='utf-8', mode='w') self.app.render((data), 'php-fpm.mustache', out=wo_php_fpm) wo_php_fpm.close() - # Parse /etc/php/7.2/fpm/pool.d/www.conf + # Parse /etc/php/7.3/fpm/pool.d/www.conf config = configparser.ConfigParser() - config.read_file(codecs.open('/etc/php/7.2/fpm/pool.d/www.conf', + config.read_file(codecs.open('/etc/php/7.3/fpm/pool.d/www.conf', "r", "utf8")) config['www']['ping.path'] = '/ping' config['www']['pm.status_path'] = '/status' @@ -915,31 +919,34 @@ class WOStackController(CementBaseController): config['www']['pm.max_spare_servers'] = '30' config['www']['request_terminate_timeout'] = '300' config['www']['pm'] = 'ondemand' - config['www']['listen'] = '127.0.0.1:9072' - with codecs.open('/etc/php/7.2/fpm/pool.d/www.conf', + config['www']['chdir'] = '/' + config['www']['prefix'] = '/var/run/php' + config['www']['listen'] = 'php73-fpm.sock' + config['www']['listen.backlog'] = '32768' + with codecs.open('/etc/php/7.3/fpm/pool.d/www.conf', encoding='utf-8', mode='w') as configfile: Log.debug(self, "writting PHP5 configuration into " - "/etc/php/7.2/fpm/pool.d/www.conf") + "/etc/php/7.3/fpm/pool.d/www.conf") config.write(configfile) - # Generate /etc/php/7.2/fpm/pool.d/debug.conf - WOFileUtils.copyfile(self, "/etc/php/7.2/fpm/pool.d/www.conf", - "/etc/php/7.2/fpm/pool.d/debug.conf") - WOFileUtils.searchreplace(self, "/etc/php/7.2/fpm/pool.d/" + # Generate /etc/php/7.3/fpm/pool.d/debug.conf + WOFileUtils.copyfile(self, "/etc/php/7.3/fpm/pool.d/www.conf", + "/etc/php/7.3/fpm/pool.d/debug.conf") + WOFileUtils.searchreplace(self, "/etc/php/7.3/fpm/pool.d/" "debug.conf", "[www]", "[debug]") config = configparser.ConfigParser() - config.read('/etc/php/7.2/fpm/pool.d/debug.conf') - config['debug']['listen'] = '127.0.0.1:9172' + config.read('/etc/php/7.3/fpm/pool.d/debug.conf') + config['debug']['listen'] = '127.0.0.1:9182' config['debug']['rlimit_core'] = 'unlimited' - config['debug']['slowlog'] = '/var/log/php/7.2/slow.log' + config['debug']['slowlog'] = '/var/log/php/7.3/slow.log' config['debug']['request_slowlog_timeout'] = '10s' - with open('/etc/php/7.2/fpm/pool.d/debug.conf', + with open('/etc/php/7.3/fpm/pool.d/debug.conf', encoding='utf-8', mode='w') as confifile: Log.debug(self, "writting PHP5 configuration into " - "/etc/php/7.2/fpm/pool.d/debug.conf") + "/etc/php/7.3/fpm/pool.d/debug.conf") config.write(confifile) - with open("/etc/php/7.2/fpm/pool.d/debug.conf", + with open("/etc/php/7.3/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_" @@ -949,11 +956,11 @@ class WOStackController(CementBaseController): "profiler_enable] = off\n") # Disable xdebug - if not WOShellExec.cmd_exec(self, "grep -q \';zend_extension\' /etc/php/7.2/mods-available/xdebug.ini"): - WOFileUtils.searchreplace(self, "/etc/php/7.2/mods-available/" - "xdebug.ini", - "zend_extension", - ";zend_extension") + if not WOShellExec.cmd_exec(self, "grep -q \';zend_extension\' /etc/php/7.3/mods-available/xdebug.ini"): + WOFileUtils.searchreplace(self, "/etc/php/7.3/mods-available/" + "xdebug.ini", + "zend_extension", + ";zend_extension") # PHP and Debug pull configuration if not os.path.exists('{0}22222/htdocs/fpm/status/' @@ -990,10 +997,10 @@ class WOStackController(CementBaseController): WOVariables.wo_php_user, recursive=True) WOGit.add(self, ["/etc/php"], msg="Adding PHP into Git") - WOService.restart_service(self, 'php7.2-fpm') + WOService.restart_service(self, 'php7.3-fpm') - #preconfiguration for php7.2 - if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') and set(WOVariables.wo_php72).issubset(set(apt_packages)): + # preconfiguration for php7.2 + if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic') and set(WOVariables.wo_php).issubset(set(apt_packages)): # Create log directories if not os.path.exists('/var/log/php/7.2/'): Log.debug(self, 'Creating directory /var/log/php/7.2/') @@ -1016,11 +1023,11 @@ class WOStackController(CementBaseController): # Parse /etc/php/7.2/fpm/php-fpm.conf data = dict(pid="/run/php/php7.2-fpm.pid", error_log="/var/log/php/7.2/fpm.log", - include="/etc/php/7.2/fpm/pool.d/*.conf") + include="/etc/php/7.2/fpm/pool.d/*.conf") Log.debug(self, "writting php 7.0 configuration into " - "/etc/php/7.2/fpm/php-fpm.conf") + "/etc/php/7.2/fpm/php-fpm.conf") wo_php_fpm = open('/etc/php/7.2/fpm/php-fpm.conf', - encoding='utf-8', mode='w') + encoding='utf-8', mode='w') self.app.render((data), 'php-fpm.mustache', out=wo_php_fpm) wo_php_fpm.close() @@ -1073,9 +1080,9 @@ class WOStackController(CementBaseController): # Disable xdebug if not WOShellExec.cmd_exec(self, "grep -q \';zend_extension\' /etc/php/7.2/mods-available/xdebug.ini"): WOFileUtils.searchreplace(self, "/etc/php/7.2/mods-available/" - "xdebug.ini", - "zend_extension", - ";zend_extension") + "xdebug.ini", + "zend_extension", + ";zend_extension") # PHP and Debug pull configuration if not os.path.exists('{0}22222/htdocs/fpm/status/' @@ -1114,8 +1121,6 @@ class WOStackController(CementBaseController): WOGit.add(self, ["/etc/php"], msg="Adding PHP into Git") WOService.restart_service(self, 'php7.2-fpm') - - if set(WOVariables.wo_mysql).issubset(set(apt_packages)): if not os.path.isfile("/etc/mysql/my.cnf"): config = ("[mysqld]\nwait_timeout = 30\n" @@ -1169,12 +1174,12 @@ class WOStackController(CementBaseController): '{0}22222/htdocs/db/pma/config.inc.php file ' .format(WOVariables.wo_webroot)) blowfish_key = ''.join([random.choice - (string.ascii_letters + string.digits) - for n in range(10)]) + (string.ascii_letters + string.digits) + for n in range(10)]) WOFileUtils.searchreplace(self, '{0}22222/htdocs/db/pma/config.inc.php' .format(WOVariables.wo_webroot), - "$cfg[\'blowfish_secret\'] = \'\';","$cfg[\'blowfish_secret\'] = \'{0}\';" + "$cfg[\'blowfish_secret\'] = \'\';", "$cfg[\'blowfish_secret\'] = \'{0}\';" .format(blowfish_key)) Log.debug(self, 'Setting HOST Server For Mysql to ' '{0}22222/htdocs/db/pma/config.inc.php file ' @@ -1182,7 +1187,7 @@ class WOStackController(CementBaseController): WOFileUtils.searchreplace(self, '{0}22222/htdocs/db/pma/config.inc.php' .format(WOVariables.wo_webroot), - "$cfg[\'Servers\'][$i][\'host\'] = \'localhost\';","$cfg[\'Servers\'][$i][\'host\'] = \'{0}\';" + "$cfg[\'Servers\'][$i][\'host\'] = \'localhost\';", "$cfg[\'Servers\'][$i][\'host\'] = \'{0}\';" .format(WOVariables.wo_mysql_host)) Log.debug(self, 'Setting Privileges of webroot permission to ' '{0}22222/htdocs/db/pma file ' @@ -1273,7 +1278,7 @@ class WOStackController(CementBaseController): WOMysql.execute(self, 'grant select on *.* to \'anemometer\'' '@\'{0}\' IDENTIFIED' ' BY \'{1}\''.format(self.app.config.get('mysql', - 'grant-host'),chars)) + 'grant-host'), chars)) Log.debug(self, "grant all on slow-query-log.*" " to anemometer@root_user IDENTIFIED BY password ") WOMysql.execute(self, 'grant all on slow_query_log.* to' @@ -1338,12 +1343,12 @@ class WOStackController(CementBaseController): try: # Default action for stack installation if ((not self.app.pargs.web) and (not self.app.pargs.admin) and - (not self.app.pargs.nginx) and (not self.app.pargs.php) and - (not self.app.pargs.mysql) and (not self.app.pargs.wpcli) and - (not self.app.pargs.phpmyadmin) and (not self.app.pargs.hhvm) and - (not self.app.pargs.adminer) and (not self.app.pargs.utils) and - (not self.app.pargs.redis) and (not self.app.pargs.phpredisadmin) and - (not self.app.pargs.php72)): + (not self.app.pargs.nginx) and (not self.app.pargs.php) and + (not self.app.pargs.mysql) and (not self.app.pargs.wpcli) and + (not self.app.pargs.phpmyadmin) and (not self.app.pargs.hhvm) and + (not self.app.pargs.adminer) and (not self.app.pargs.utils) and + (not self.app.pargs.redis) and (not self.app.pargs.phpredisadmin) and + (not self.app.pargs.php73)): self.app.pargs.web = True self.app.pargs.admin = True @@ -1385,7 +1390,7 @@ class WOStackController(CementBaseController): self.post_pref(apt, packages) elif WOAptGet.is_installed(self, 'nginx'): Log.info(self, "WordOps detected an already installed nginx package." - "It may or may not have required modules.\n") + "It may or may not have required modules.\n") apt = ["nginx"] + WOVariables.wo_nginx self.post_pref(apt, packages) else: @@ -1393,43 +1398,45 @@ class WOStackController(CementBaseController): if self.app.pargs.php: Log.debug(self, "Setting apt_packages variable for PHP") - if not (WOAptGet.is_installed(self, 'php5-fpm') or WOAptGet.is_installed(self, 'php5.6-fpm')): + if not (WOAptGet.is_installed(self, 'php5-fpm') or WOAptGet.is_installed(self, 'php7.2-fpm')): if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - apt_packages = apt_packages + WOVariables.wo_php72 + WOVariables.wo_php_extra + apt_packages = apt_packages + WOVariables.wo_php + WOVariables.wo_php_extra else: apt_packages = apt_packages + WOVariables.wo_php else: Log.debug(self, "PHP already installed") Log.info(self, "PHP already installed") - #PHP 7.0 for Debian (jessie+) - if self.app.pargs.php72 and WOVariables.wo_platform_distro == 'debian': + # PHP 7.3 for Debian (jessie+) + if self.app.pargs.php73 and WOVariables.wo_platform_distro == 'debian': if (WOVariables.wo_platform_codename == 'jessie'): - Log.debug(self, "Setting apt_packages variable for PHP 7.2") - if not WOAptGet.is_installed(self, 'php7.2-fpm') : - apt_packages = apt_packages + WOVariables.wo_php72 + Log.debug(self, "Setting apt_packages variable for PHP 7.3") + if not WOAptGet.is_installed(self, 'php7.3-fpm'): + apt_packages = apt_packages + WOVariables.wo_php73 if not WOAptGet.is_installed(self, 'php5-fpm'): apt_packages = apt_packages + WOVariables.wo_php else: - Log.debug(self, "PHP 7.2 already installed") - Log.info(self, "PHP 7.2 already installed") + Log.debug(self, "PHP 7.3 already installed") + Log.info(self, "PHP 7.3 already installed") else: - Log.debug(self, "PHP 7.2 Not Available for your Distribution") - Log.info(self, "PHP 7.2 Not Available for your Distribution") + Log.debug( + self, "PHP 7.3 Not Available for your Distribution") + Log.info(self, "PHP 7.3 Not Available for your Distribution") - #PHP 7.0 for Ubuntu - if self.app.pargs.php72 and not WOVariables.wo_platform_distro == 'debian': + # PHP 7.3 for Ubuntu + if self.app.pargs.php73 and not WOVariables.wo_platform_distro == 'debian': if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - Log.debug(self, "Setting apt_packages variable for PHP 7.2") - if not WOAptGet.is_installed(self, 'php7.2-fpm') : - apt_packages = apt_packages + WOVariables.wo_php72 + WOVariables.wo_php_extra + Log.debug(self, "Setting apt_packages variable for PHP 7.3") + if not WOAptGet.is_installed(self, 'php7.3-fpm'): + apt_packages = apt_packages + WOVariables.wo_php73 + WOVariables.wo_php_extra else: - Log.debug(self, "PHP 7.2 already installed") - Log.info(self, "PHP 7.2 already installed") + Log.debug(self, "PHP 7.3 already installed") + Log.info(self, "PHP 7.3 already installed") else: - Log.debug(self, "Unfortunately PHP 7.2 is not available for your Ubuntu or Debian version.") - Log.info(self, "Unfortunately PHP 7.2 is not available for your Ubuntu or Debian version.") - + Log.debug( + self, "Unfortunately PHP 7.3 is not available for your Ubuntu or Debian version.") + Log.info( + self, "Unfortunately PHP 7.3 is not available for your Ubuntu or Debian version.") if self.app.pargs.hhvm: Log.debug(self, "Setting apt packages variable for HHVM") @@ -1458,7 +1465,7 @@ class WOStackController(CementBaseController): if self.app.pargs.wpcli: Log.debug(self, "Setting packages variable for WP-CLI") - if not WOShellExec.cmd_exec(self, "which wp"): + if not WOShellExec.cmd_exec(self, "command -v wp"): packages = packages + [["https://github.com/wp-cli/wp-cli/" "releases/download/v{0}/" "wp-cli-{0}.phar" @@ -1478,7 +1485,7 @@ class WOStackController(CementBaseController): Log.debug(self, "Setting packages varible for phpRedisAdmin") packages = packages + [["https://github.com/ErikDubbelboer/" "phpRedisAdmin/archive/master.tar.gz", - "/tmp/pra.tar.gz","phpRedisAdmin"], + "/tmp/pra.tar.gz", "phpRedisAdmin"], ["https://github.com/nrk/predis/" "archive/v1.0.1.tar.gz", "/tmp/predis.tar.gz", "Predis"]] @@ -1492,7 +1499,7 @@ class WOStackController(CementBaseController): "htdocs/db/adminer/index.php" .format(WOVariables.wo_webroot), "Adminer"]] - + if self.app.pargs.utils: Log.debug(self, "Setting packages variable for utils") packages = packages + [["https://storage.googleapis.com/google-code-archive-downloads/" @@ -1563,19 +1570,21 @@ class WOStackController(CementBaseController): if os.path.isfile("/etc/redis/redis.conf"): if WOVariables.wo_ram < 512: Log.debug(self, "Setting maxmemory variable to {0} in redis.conf" - .format(int(WOVariables.wo_ram*1024*1024*0.1))) + .format(int(WOVariables.wo_ram*1024*1024*0.1))) WOShellExec.cmd_exec(self, "sed -i 's/# maxmemory /maxmemory {0}/' /etc/redis/redis.conf" .format(int(WOVariables.wo_ram*1024*1024*0.1))) - Log.debug(self, "Setting maxmemory-policy variable to allkeys-lru in redis.conf") + Log.debug( + self, "Setting maxmemory-policy variable to allkeys-lru in redis.conf") WOShellExec.cmd_exec(self, "sed -i 's/# maxmemory-policy.*/maxmemory-policy allkeys-lru/' " "/etc/redis/redis.conf") WOService.restart_service(self, 'redis-server') else: Log.debug(self, "Setting maxmemory variable to {0} in redis.conf" - .format(int(WOVariables.wo_ram*1024*1024*0.2))) + .format(int(WOVariables.wo_ram*1024*1024*0.2))) WOShellExec.cmd_exec(self, "sed -i 's/# maxmemory /maxmemory {0}/' /etc/redis/redis.conf" .format(int(WOVariables.wo_ram*1024*1024*0.2))) - Log.debug(self, "Setting maxmemory-policy variable to allkeys-lru in redis.conf") + Log.debug( + self, "Setting maxmemory-policy variable to allkeys-lru in redis.conf") WOShellExec.cmd_exec(self, "sed -i 's/# maxmemory-policy.*/maxmemory-policy allkeys-lru/' " "/etc/redis/redis.conf") WOService.restart_service(self, 'redis-server') @@ -1594,12 +1603,12 @@ class WOStackController(CementBaseController): packages = [] if ((not self.app.pargs.web) and (not self.app.pargs.admin) and - (not self.app.pargs.nginx) and (not self.app.pargs.php) and - (not self.app.pargs.php72) and (not self.app.pargs.mysql) and - (not self.app.pargs.wpcli) and (not self.app.pargs.phpmyadmin) and - (not self.app.pargs.hhvm) and (not self.app.pargs.adminer) and - (not self.app.pargs.utils) and (not self.app.pargs.all) and - (not self.app.pargs.redis) and (not self.app.pargs.phpredisadmin)): + (not self.app.pargs.nginx) and (not self.app.pargs.php) and + (not self.app.pargs.php73) and (not self.app.pargs.mysql) and + (not self.app.pargs.wpcli) and (not self.app.pargs.phpmyadmin) and + (not self.app.pargs.hhvm) and (not self.app.pargs.adminer) and + (not self.app.pargs.utils) and (not self.app.pargs.all) and + (not self.app.pargs.redis) and (not self.app.pargs.phpredisadmin)): self.app.pargs.web = True self.app.pargs.admin = True @@ -1607,7 +1616,7 @@ class WOStackController(CementBaseController): self.app.pargs.web = True self.app.pargs.admin = True if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - self.app.pargs.php72 = True + self.app.pargs.php73 = True if self.app.pargs.web: self.app.pargs.nginx = True @@ -1625,35 +1634,35 @@ class WOStackController(CementBaseController): Log.debug(self, "Removing apt_packages variable of Nginx") apt_packages = apt_packages + WOVariables.wo_nginx else: - Log.error(self,"Cannot Remove! Nginx Stable version not found.") + Log.error(self, "Cannot Remove! Nginx Stable version not found.") if self.app.pargs.php: Log.debug(self, "Removing apt_packages variable of PHP") if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - apt_packages = apt_packages + WOVariables.wo_php72 + apt_packages = apt_packages + WOVariables.wo_php if not WOAptGet.is_installed(self, 'php7.2-fpm'): apt_packages = apt_packages + WOVariables.wo_php_extra else: apt_packages = apt_packages + WOVariables.wo_php - #PHP7.0 for debian(jessie+) - if self.app.pargs.php72: + # PHP7.3 for debian(jessie+) + if self.app.pargs.php73: if (WOVariables.wo_platform_codename == 'jessie'): - Log.debug(self, "Removing apt_packages variable of PHP 7.0") - apt_packages = apt_packages + WOVariables.wo_php72 - if not WOAptGet.is_installed(self, 'php5-fpm'): + Log.debug(self, "Removing apt_packages variable of PHP 7.3") + apt_packages = apt_packages + WOVariables.wo_php73 + if not WOAptGet.is_installed(self, 'php7.3-fpm'): apt_packages = apt_packages + WOVariables.wo_php_extra else: - Log.info(self,"PHP 7.0 not supported.") + Log.info(self, "PHP 7.3 not supported.") - if self.app.pargs.php72: + if self.app.pargs.php73: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - Log.debug(self, "Removing apt_packages variable of PHP 7.0") - apt_packages = apt_packages + WOVariables.wo_php72 - if not WOAptGet.is_installed(self, 'php5.6-fpm'): + Log.debug(self, "Removing apt_packages variable of PHP 7.3") + apt_packages = apt_packages + WOVariables.wo_php73 + if not WOAptGet.is_installed(self, 'php7.3-fpm'): apt_packages = apt_packages + WOVariables.wo_php_extra else: - Log.info(self,"PHP 7.0 not supported.") + Log.info(self, "PHP 7.3 not supported.") if self.app.pargs.hhvm: if WOAptGet.is_installed(self, 'hhvm'): @@ -1712,7 +1721,7 @@ class WOStackController(CementBaseController): if wo_prompt == 'YES' or wo_prompt == 'yes': - if (set(["nginx-custom"]).issubset(set(apt_packages))) : + if (set(["nginx-custom"]).issubset(set(apt_packages))): WOService.stop_service(self, 'nginx') if len(packages): @@ -1725,16 +1734,16 @@ class WOStackController(CementBaseController): WOAptGet.remove(self, apt_packages) WOAptGet.auto_remove(self) - Log.info(self, "Successfully removed packages") - #Added for Ondrej Repo missing package Fix - if self.app.pargs.php72: - if WOAptGet.is_installed(self, 'php5.6-fpm'): - Log.info(self, "PHP5.6-fpm found on system.") - Log.info(self, "Verifying and installing missing packages,") - WOShellExec.cmd_exec(self, "apt-get install -y php-memcached php-igbinary") - + # Added for Ondrej Repo missing package Fix + if self.app.pargs.php: + if WOAptGet.is_installed(self, 'php7.2-fpm'): + Log.info(self, "PHP7.2-fpm found on system.") + Log.info( + self, "Verifying and installing missing packages,") + WOShellExec.cmd_exec( + self, "apt-get install -y php-memcached php-igbinary") @expose(help="Purge packages") def purge(self): @@ -1744,12 +1753,12 @@ class WOStackController(CementBaseController): # Default action for stack purge if ((not self.app.pargs.web) and (not self.app.pargs.admin) and - (not self.app.pargs.nginx) and (not self.app.pargs.php) and - (not self.app.pargs.php7) and (not self.app.pargs.mysql) and - (not self.app.pargs.wpcli) and (not self.app.pargs.phpmyadmin) and - (not self.app.pargs.hhvm) and (not self.app.pargs.adminer) and - (not self.app.pargs.utils) and (not self.app.pargs.all) and - (not self.app.pargs.redis) and (not self.app.pargs.phpredisadmin)): + (not self.app.pargs.nginx) and (not self.app.pargs.php) and + (not self.app.pargs.php73) and (not self.app.pargs.mysql) and + (not self.app.pargs.wpcli) and (not self.app.pargs.phpmyadmin) and + (not self.app.pargs.hhvm) and (not self.app.pargs.adminer) and + (not self.app.pargs.utils) and (not self.app.pargs.all) and + (not self.app.pargs.redis) and (not self.app.pargs.phpredisadmin)): self.app.pargs.web = True self.app.pargs.admin = True @@ -1757,7 +1766,7 @@ class WOStackController(CementBaseController): self.app.pargs.web = True self.app.pargs.admin = True if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - self.app.pargs.php7 = True + self.app.pargs.php73 = True if self.app.pargs.web: self.app.pargs.nginx = True @@ -1775,32 +1784,32 @@ class WOStackController(CementBaseController): Log.debug(self, "Purge apt_packages variable of Nginx") apt_packages = apt_packages + WOVariables.wo_nginx else: - Log.error(self,"Cannot Purge! Nginx Stable version not found.") + Log.error(self, "Cannot Purge! Nginx Stable version not found.") if self.app.pargs.php: Log.debug(self, "Purge apt_packages variable PHP") if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): apt_packages = apt_packages + WOVariables.wo_php_extra else: - apt_packages = apt_packages + WOVariables.wo_php72 + apt_packages = apt_packages + WOVariables.wo_php73 - #For debian --php7 - if self.app.pargs.php72: + # For debian --php73 + if self.app.pargs.php73: if (WOVariables.wo_platform_codename == 'jessie'): - Log.debug(self, "Removing apt_packages variable of PHP 7.0") - apt_packages = apt_packages + WOVariables.wo_php72 - if not WOAptGet.is_installed(self, 'php5-fpm'): + Log.debug(self, "Removing apt_packages variable of PHP 7.3") + apt_packages = apt_packages + WOVariables.wo_php73 + if not WOAptGet.is_installed(self, 'php7.2-fpm'): apt_packages = apt_packages + WOVariables.wo_php_extra else: - Log.info(self,"PHP 7.2 not supported.") + Log.info(self, "PHP 7.3 not supported.") - if self.app.pargs.php72: + if self.app.pargs.php73: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - Log.debug(self, "Removing apt_packages variable of PHP 7.0") - apt_packages = apt_packages + WOVariables.wo_php72 - if not WOAptGet.is_installed(self, 'php5.6-fpm'): + Log.debug(self, "Removing apt_packages variable of PHP 7.3") + apt_packages = apt_packages + WOVariables.wo_php73 + if not WOAptGet.is_installed(self, 'php7.3-fpm'): apt_packages = apt_packages + WOVariables.wo_php_extra else: - Log.info(self,"PHP 7.2 not supported.") + Log.info(self, "PHP 7.3 not supported.") if self.app.pargs.hhvm: if WOAptGet.is_installed(self, 'hhvm'): Log.debug(self, "Purge apt_packages varible of HHVM") @@ -1855,7 +1864,7 @@ class WOStackController(CementBaseController): if wo_prompt == 'YES' or wo_prompt == 'yes': - if (set(["nginx-custom"]).issubset(set(apt_packages))) : + if (set(["nginx-custom"]).issubset(set(apt_packages))): WOService.stop_service(self, 'nginx') if len(apt_packages): @@ -1867,16 +1876,16 @@ class WOStackController(CementBaseController): WOFileUtils.remove(self, packages) WOAptGet.auto_remove(self) - Log.info(self, "Successfully purged packages") - #Added for php Ondrej repo missing package fix - if self.app.pargs.php72: - if WOAptGet.is_installed(self, 'php5.6-fpm'): - Log.info(self, "PHP5.6-fpm found on system.") - Log.info(self, "Verifying and installing missing packages,") - WOShellExec.cmd_exec(self, "apt-get install -y php-memcached php-igbinary") - + # Added for php Ondrej repo missing package fix + if self.app.pargs.php73: + if WOAptGet.is_installed(self, 'php7.3-fpm'): + Log.info(self, "PHP7.3-fpm found on system.") + Log.info( + self, "Verifying and installing missing packages,") + WOShellExec.cmd_exec( + self, "apt-get install -y php-memcached php-igbinary") def load(app): @@ -1887,4 +1896,4 @@ def load(app): handler.register(WOStackUpgradeController) # register a hook (function) to run after arguments are parsed. - hook.register('post_argument_parsing', wo_stack_hook) \ No newline at end of file + hook.register('post_argument_parsing', wo_stack_hook) diff --git a/wo/cli/plugins/stack_services.py b/wo/cli/plugins/stack_services.py index 10183d6..a2cf3c5 100644 --- a/wo/cli/plugins/stack_services.py +++ b/wo/cli/plugins/stack_services.py @@ -15,13 +15,13 @@ class WOStackStatusController(CementBaseController): arguments = [ (['--memcache'], dict(help='start/stop/restart memcache', action='store_true')), - ] + ] @expose(help="Start stack services") def start(self): """Start services""" services = [] - if not (self.app.pargs.nginx or self.app.pargs.php or self.app.pargs.php7 + if not (self.app.pargs.nginx or self.app.pargs.php or self.app.pargs.php73 or self.app.pargs.mysql or self.app.pargs.hhvm or self.app.pargs.memcache or self.app.pargs.redis): self.app.pargs.nginx = True @@ -29,43 +29,43 @@ class WOStackStatusController(CementBaseController): self.app.pargs.mysql = True if self.app.pargs.nginx: - if WOAptGet.is_installed(self, 'nginx-custom') or WOAptGet.is_installed(self,'nginx-mainline'): + if WOAptGet.is_installed(self, 'nginx-custom') or WOAptGet.is_installed(self, 'nginx-mainline'): services = services + ['nginx'] else: Log.info(self, "Nginx is not installed") if self.app.pargs.php: if (WOVariables.wo_platform_distro == 'debian' or WOVariables.wo_platform_codename == 'precise'): - if WOAptGet.is_installed(self, 'php5-fpm'): - services = services + ['php5-fpm'] + if WOAptGet.is_installed(self, 'php7.2-fpm'): + services = services + ['php7.2-fpm'] else: - Log.info(self, "PHP5-FPM is not installed") + Log.info(self, "PHP7.2-FPM is not installed") else: - if WOAptGet.is_installed(self, 'php5.6-fpm'): - services = services + ['php5.6-fpm'] + if WOAptGet.is_installed(self, 'php7.2-fpm'): + services = services + ['php7.2-fpm'] else: - Log.info(self, "PHP5.6-FPM is not installed") + Log.info(self, "PHP7.2-FPM is not installed") if WOAptGet.is_installed(self, 'php7.2-fpm'): services = services + ['php7.2-fpm'] else: Log.info(self, "PHP7.2-FPM is not installed") - if self.app.pargs.php7: + if self.app.pargs.php73: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - if WOAptGet.is_installed(self, 'php7.2-fpm'): - services = services + ['php7.2-fpm'] + if WOAptGet.is_installed(self, 'php7.3-fpm'): + services = services + ['php7.3-fpm'] else: - Log.info(self, "PHP7.2-FPM is not installed") + Log.info(self, "PHP7.3-FPM is not installed") else: - Log.info(self, "Your platform does not support PHP 7") + Log.info(self, "Your platform does not support PHP 7.3") if self.app.pargs.mysql: if ((WOVariables.wo_mysql_host is "localhost") or - (WOVariables.wo_mysql_host is "127.0.0.1")): + (WOVariables.wo_mysql_host is "127.0.0.1")): if (WOAptGet.is_installed(self, 'mysql-server') or - WOAptGet.is_installed(self, 'percona-server-server-5.6') or - WOAptGet.is_installed(self, 'mariadb-server')): + WOAptGet.is_installed(self, 'percona-server-server-5.6') or + WOAptGet.is_installed(self, 'mariadb-server')): services = services + ['mysql'] else: Log.info(self, "MySQL is not installed") @@ -98,7 +98,7 @@ class WOStackStatusController(CementBaseController): def stop(self): """Stop services""" services = [] - if not (self.app.pargs.nginx or self.app.pargs.php or self.app.pargs.php7 + if not (self.app.pargs.nginx or self.app.pargs.php or self.app.pargs.php73 or self.app.pargs.mysql or self.app.pargs.hhvm or self.app.pargs.memcache or self.app.pargs.redis): self.app.pargs.nginx = True @@ -106,43 +106,43 @@ class WOStackStatusController(CementBaseController): self.app.pargs.mysql = True if self.app.pargs.nginx: - if WOAptGet.is_installed(self, 'nginx-custom') or WOAptGet.is_installed(self,'nginx-mainline'): + if WOAptGet.is_installed(self, 'nginx-custom') or WOAptGet.is_installed(self, 'nginx-mainline'): services = services + ['nginx'] else: Log.info(self, "Nginx is not installed") if self.app.pargs.php: if (WOVariables.wo_platform_distro == 'debian' or WOVariables.wo_platform_codename == 'precise'): - if WOAptGet.is_installed(self, 'php5-fpm'): - services = services + ['php5-fpm'] + if WOAptGet.is_installed(self, 'php7.2-fpm'): + services = services + ['php7.2-fpm'] else: Log.info(self, "PHP5-FPM is not installed") else: - if WOAptGet.is_installed(self, 'php5.6-fpm'): - services = services + ['php5.6-fpm'] + if WOAptGet.is_installed(self, 'php7.2-fpm'): + services = services + ['php7.2-fpm'] else: - Log.info(self, "PHP5.6-FPM is not installed") + Log.info(self, "PHP7.2-FPM is not installed") if WOAptGet.is_installed(self, 'php7.2-fpm'): services = services + ['php7.2-fpm'] else: Log.info(self, "PHP7.2-FPM is not installed") - if self.app.pargs.php7: + if self.app.pargs.php73: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - if WOAptGet.is_installed(self, 'php7.2-fpm'): - services = services + ['php7.2-fpm'] + if WOAptGet.is_installed(self, 'php7.3-fpm'): + services = services + ['php7.3-fpm'] else: - Log.info(self, "PHP7.2-FPM is not installed") + Log.info(self, "PHP7.3-FPM is not installed") else: - Log.info(self, "Your platform does not support PHP 7") + Log.info(self, "Your platform does not support PHP 7.3") if self.app.pargs.mysql: if ((WOVariables.wo_mysql_host is "localhost") or - (WOVariables.wo_mysql_host is "127.0.0.1")): + (WOVariables.wo_mysql_host is "127.0.0.1")): if (WOAptGet.is_installed(self, 'mysql-server') or - WOAptGet.is_installed(self, 'percona-server-server-5.6') or - WOAptGet.is_installed(self, 'mariadb-server')): + WOAptGet.is_installed(self, 'percona-server-server-5.6') or + WOAptGet.is_installed(self, 'mariadb-server')): services = services + ['mysql'] else: Log.info(self, "MySQL is not installed") @@ -175,7 +175,7 @@ class WOStackStatusController(CementBaseController): def restart(self): """Restart services""" services = [] - if not (self.app.pargs.nginx or self.app.pargs.php or self.app.pargs.php7 + if not (self.app.pargs.nginx or self.app.pargs.php or self.app.pargs.php73 or self.app.pargs.mysql or self.app.pargs.hhvm or self.app.pargs.memcache or self.app.pargs.redis): self.app.pargs.nginx = True @@ -183,44 +183,43 @@ class WOStackStatusController(CementBaseController): self.app.pargs.mysql = True if self.app.pargs.nginx: - if WOAptGet.is_installed(self, 'nginx-custom') or WOAptGet.is_installed(self,'nginx-mainline'): + if WOAptGet.is_installed(self, 'nginx-custom') or WOAptGet.is_installed(self, 'nginx-mainline'): services = services + ['nginx'] else: Log.info(self, "Nginx is not installed") if self.app.pargs.php: if (WOVariables.wo_platform_distro == 'debian' or WOVariables.wo_platform_codename == 'precise'): - if WOAptGet.is_installed(self, 'php5-fpm'): - services = services + ['php5-fpm'] + if WOAptGet.is_installed(self, 'php7.2-fpm'): + services = services + ['php7.2-fpm'] else: - Log.info(self, "PHP5-FPM is not installed") + Log.info(self, "PHP7.2-FPM is not installed") else: - if WOAptGet.is_installed(self, 'php5.6-fpm'): - services = services + ['php5.6-fpm'] + if WOAptGet.is_installed(self, 'php7.2-fpm'): + services = services + ['php7.2-fpm'] else: - Log.info(self, "PHP5.6-FPM is not installed") + Log.info(self, "PHP7.2-FPM is not installed") if WOAptGet.is_installed(self, 'php7.2-fpm'): services = services + ['php7.2-fpm'] else: Log.info(self, "PHP7.2-FPM is not installed") - if self.app.pargs.php7: + if self.app.pargs.php73: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - if WOAptGet.is_installed(self, 'php7.2-fpm'): - services = services + ['php7.2-fpm'] + if WOAptGet.is_installed(self, 'php7.3-fpm'): + services = services + ['php7.3-fpm'] else: - Log.info(self, "PHP7.2-FPM is not installed") + Log.info(self, "PHP7.3-FPM is not installed") else: - Log.info(self, "Your platform does not support PHP 7") - + Log.info(self, "Your platform does not support PHP 7.3") if self.app.pargs.mysql: if ((WOVariables.wo_mysql_host is "localhost") or - (WOVariables.wo_mysql_host is "127.0.0.1")): + (WOVariables.wo_mysql_host is "127.0.0.1")): if (WOAptGet.is_installed(self, 'mysql-server') or - WOAptGet.is_installed(self, 'percona-server-server-5.6') or - WOAptGet.is_installed(self, 'mariadb-server')): + WOAptGet.is_installed(self, 'percona-server-server-5.6') or + WOAptGet.is_installed(self, 'mariadb-server')): services = services + ['mysql'] else: Log.info(self, "MySQL is not installed") @@ -253,7 +252,7 @@ class WOStackStatusController(CementBaseController): def status(self): """Status of services""" services = [] - if not (self.app.pargs.nginx or self.app.pargs.php or self.app.pargs.php7 + if not (self.app.pargs.nginx or self.app.pargs.php or self.app.pargs.php73 or self.app.pargs.mysql or self.app.pargs.hhvm or self.app.pargs.memcache or self.app.pargs.redis): self.app.pargs.nginx = True @@ -262,43 +261,43 @@ class WOStackStatusController(CementBaseController): self.app.pargs.hhvm = True if self.app.pargs.nginx: - if WOAptGet.is_installed(self, 'nginx-custom') or WOAptGet.is_installed(self,'nginx-mainline'): + if WOAptGet.is_installed(self, 'nginx-custom') or WOAptGet.is_installed(self, 'nginx-mainline'): services = services + ['nginx'] else: Log.info(self, "Nginx is not installed") if self.app.pargs.php: if (WOVariables.wo_platform_distro == 'debian' or WOVariables.wo_platform_codename == 'precise'): - if WOAptGet.is_installed(self, 'php5-fpm'): - services = services + ['php5-fpm'] + if WOAptGet.is_installed(self, 'php7.2-fpm'): + services = services + ['php7.2-fpm'] else: - Log.info(self, "PHP5-FPM is not installed") + Log.info(self, "PHP7.2-FPM is not installed") else: - if WOAptGet.is_installed(self, 'php5.6-fpm'): - services = services + ['php5.6-fpm'] + if WOAptGet.is_installed(self, 'php7.2-fpm'): + services = services + ['php7.2-fpm'] else: - Log.info(self, "PHP5.6-FPM is not installed") + Log.info(self, "PHP7.2-FPM is not installed") if WOAptGet.is_installed(self, 'php7.2-fpm'): services = services + ['php7.2-fpm'] else: Log.info(self, "PHP7.2-FPM is not installed") - if self.app.pargs.php7: + if self.app.pargs.php73: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - if WOAptGet.is_installed(self, 'php7.2-fpm'): - services = services + ['php7.2-fpm'] + if WOAptGet.is_installed(self, 'php7.3-fpm'): + services = services + ['php7.3-fpm'] else: - Log.info(self, "PHP7.2-FPM is not installed") + Log.info(self, "PHP7.3-FPM is not installed") else: - Log.info(self, "Your platform does not support PHP 7") + Log.info(self, "Your platform does not support PHP 7.3") if self.app.pargs.mysql: if ((WOVariables.wo_mysql_host is "localhost") or - (WOVariables.wo_mysql_host is "127.0.0.1")): + (WOVariables.wo_mysql_host is "127.0.0.1")): if (WOAptGet.is_installed(self, 'mysql-server') or - WOAptGet.is_installed(self, 'percona-server-server-5.6') or - WOAptGet.is_installed(self, 'mariadb-server')): + WOAptGet.is_installed(self, 'percona-server-server-5.6') or + WOAptGet.is_installed(self, 'mariadb-server')): services = services + ['mysql'] else: Log.info(self, "MySQL is not installed") @@ -331,51 +330,51 @@ class WOStackStatusController(CementBaseController): def reload(self): """Reload service""" services = [] - if not (self.app.pargs.nginx or self.app.pargs.php or self.app.pargs.php7 - or self.app.pargs.mysql or self.app.pargs.hhvm or self.app.pargs.memcache + if not (self.app.pargs.nginx or self.app.pargs.php or self.app.pargs.php73 + or self.app.pargs.mysql or self.app.pargs.hhvm or self.app.pargs.memcache or self.app.pargs.redis): self.app.pargs.nginx = True self.app.pargs.php = True self.app.pargs.mysql = True if self.app.pargs.nginx: - if WOAptGet.is_installed(self, 'nginx-custom') or WOAptGet.is_installed(self,'nginx-mainline'): + if WOAptGet.is_installed(self, 'nginx-custom') or WOAptGet.is_installed(self, 'nginx-mainline'): services = services + ['nginx'] else: Log.info(self, "Nginx is not installed") if self.app.pargs.php: if (WOVariables.wo_platform_distro == 'debian' or WOVariables.wo_platform_codename == 'precise'): - if WOAptGet.is_installed(self, 'php5-fpm'): - services = services + ['php5-fpm'] + if WOAptGet.is_installed(self, 'php7.2-fpm'): + services = services + ['php7.2-fpm'] else: - Log.info(self, "PHP5-FPM is not installed") + Log.info(self, "PHP7.2-FPM is not installed") else: - if WOAptGet.is_installed(self, 'php5.6-fpm'): - services = services + ['php5.6-fpm'] + if WOAptGet.is_installed(self, 'php7.2-fpm'): + services = services + ['php7.2-fpm'] else: - Log.info(self, "PHP5.6-FPM is not installed") + Log.info(self, "php7.2-fpm is not installed") if WOAptGet.is_installed(self, 'php7.2-fpm'): services = services + ['php7.2-fpm'] else: Log.info(self, "PHP7.2-FPM is not installed") - if self.app.pargs.php7: + if self.app.pargs.php73: if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'): - if WOAptGet.is_installed(self, 'php7.2-fpm'): - services = services + ['php7.2-fpm'] + if WOAptGet.is_installed(self, 'php7.3-fpm'): + services = services + ['php7.3-fpm'] else: - Log.info(self, "PHP7.2-FPM is not installed") + Log.info(self, "PHP7.3-FPM is not installed") else: Log.info(self, "Your platform does not support PHP 7") if self.app.pargs.mysql: if ((WOVariables.wo_mysql_host is "localhost") or - (WOVariables.wo_mysql_host is "127.0.0.1")): + (WOVariables.wo_mysql_host is "127.0.0.1")): if (WOAptGet.is_installed(self, 'mysql-server') or - WOAptGet.is_installed(self, 'percona-server-server-5.6') or - WOAptGet.is_installed(self, 'mariadb-server')): + WOAptGet.is_installed(self, 'percona-server-server-5.6') or + WOAptGet.is_installed(self, 'mariadb-server')): services = services + ['mysql'] else: Log.info(self, "MySQL is not installed") @@ -391,7 +390,7 @@ class WOStackStatusController(CementBaseController): services = services + ['memcached'] else: Log.info(self, "Memcache is not installed") - + if self.app.pargs.redis: if WOAptGet.is_installed(self, 'redis-server'): services = services + ['redis-server'] diff --git a/wo/cli/templates/php.mustache b/wo/cli/templates/php.mustache index 65f75fe..7288f48 100644 --- a/wo/cli/templates/php.mustache +++ b/wo/cli/templates/php.mustache @@ -6,5 +6,5 @@ location / { location ~ \.php$ { try_files $uri =404; include fastcgi_params; - fastcgi_pass php; + fastcgi_pass php72; } diff --git a/wo/cli/templates/php7.mustache b/wo/cli/templates/php7.mustache index 871d3c5..d0ab167 100644 --- a/wo/cli/templates/php7.mustache +++ b/wo/cli/templates/php7.mustache @@ -6,5 +6,5 @@ location / { location ~ \.php$ { try_files $uri =404; include fastcgi_params; - fastcgi_pass php7; + fastcgi_pass php73; } diff --git a/wo/cli/templates/redis-php7.mustache b/wo/cli/templates/redis-php7.mustache index 93d5943..42779bb 100644 --- a/wo/cli/templates/redis-php7.mustache +++ b/wo/cli/templates/redis-php7.mustache @@ -52,5 +52,5 @@ location ~ \.php$ { more_set_headers 'X-SRCache-Store-Status $srcache_store_status'; include fastcgi_params; - fastcgi_pass php7; + fastcgi_pass php73; } diff --git a/wo/cli/templates/redis.mustache b/wo/cli/templates/redis.mustache index e29e02f..273a1c3 100644 --- a/wo/cli/templates/redis.mustache +++ b/wo/cli/templates/redis.mustache @@ -53,5 +53,5 @@ location ~ \.php$ { more_set_headers 'X-SRCache-Store-Status $srcache_store_status'; include fastcgi_params; - fastcgi_pass php; + fastcgi_pass php72; } diff --git a/wo/cli/templates/upstream.mustache b/wo/cli/templates/upstream.mustache index 3db3ead..9e8f1e4 100644 --- a/wo/cli/templates/upstream.mustache +++ b/wo/cli/templates/upstream.mustache @@ -1,18 +1,24 @@ # Common upstream settings upstream php { -server 127.0.0.1:9072; +server 127.0.0.1:9000; } upstream debug { # Debug Pool -server 127.0.0.1:9172; +server 127.0.0.1:9100; +} +upstream php72 { +server unix:/var/run/php/php72-fpm.sock; +} +upstream php73 { +server unix:/var/run/php/php73-fpm.sock; } {{#php7conf}} upstream php7 { -server 127.0.0.1:9072; +server 127.0.0.1:9070; } upstream debug7 { # Debug Pool -server 127.0.0.1:9172; +server 127.0.0.1:9170; } {{/php7conf}} diff --git a/wo/cli/templates/wpcommon-php7.mustache b/wo/cli/templates/wpcommon-php7.mustache index 1b4b0fc..e99977b 100644 --- a/wo/cli/templates/wpcommon-php7.mustache +++ b/wo/cli/templates/wpcommon-php7.mustache @@ -4,7 +4,7 @@ location = /wp-login.php { limit_req zone=one burst=1 nodelay; include fastcgi_params; - fastcgi_pass php7; + fastcgi_pass php73; } # Disable wp-config.txt location = /wp-config.txt { diff --git a/wo/cli/templates/wpfc-php7.mustache b/wo/cli/templates/wpfc-php7.mustache index b62d088..55c999d 100644 --- a/wo/cli/templates/wpfc-php7.mustache +++ b/wo/cli/templates/wpfc-php7.mustache @@ -26,7 +26,7 @@ location ~ ^/wp-content/cache/minify/(.+\.(css|js))$ { location ~ \.php$ { try_files $uri =404; include fastcgi_params; - fastcgi_pass php7; + fastcgi_pass php73; fastcgi_cache_bypass $skip_cache; fastcgi_no_cache $skip_cache; fastcgi_cache WORDPRESS; diff --git a/wo/cli/templates/wpfc.mustache b/wo/cli/templates/wpfc.mustache index ec03b0c..666c177 100644 --- a/wo/cli/templates/wpfc.mustache +++ b/wo/cli/templates/wpfc.mustache @@ -26,7 +26,7 @@ location ~ ^/wp-content/cache/minify/(.+\.(css|js))$ { location ~ \.php$ { try_files $uri =404; include fastcgi_params; - fastcgi_pass php; + fastcgi_pass php72; fastcgi_cache_bypass $skip_cache; fastcgi_no_cache $skip_cache; fastcgi_cache WORDPRESS; diff --git a/wo/cli/templates/wpsc-php7.mustache b/wo/cli/templates/wpsc-php7.mustache index 7cca3f8..80f96cc 100644 --- a/wo/cli/templates/wpsc-php7.mustache +++ b/wo/cli/templates/wpsc-php7.mustache @@ -25,7 +25,7 @@ location / { location ~ \.php$ { try_files $uri =404; include fastcgi_params; - fastcgi_pass php7; + fastcgi_pass php73; # Following line is needed by WP Super Cache plugin fastcgi_param SERVER_NAME $http_host; } diff --git a/wo/cli/templates/wpsc.mustache b/wo/cli/templates/wpsc.mustache index e5b1648..acbbfe8 100644 --- a/wo/cli/templates/wpsc.mustache +++ b/wo/cli/templates/wpsc.mustache @@ -25,7 +25,7 @@ location / { location ~ \.php$ { try_files $uri =404; include fastcgi_params; - fastcgi_pass php; + fastcgi_pass php72; # Following line is needed by WP Super Cache plugin fastcgi_param SERVER_NAME $http_host; } diff --git a/wo/core/services.py b/wo/core/services.py index ad5d8b8..c028880 100644 --- a/wo/core/services.py +++ b/wo/core/services.py @@ -100,8 +100,8 @@ class WOService(): Log.info(self, "Reload : {0:10}".format(service_name), end='') retcode = subprocess.getstatusoutput(service_cmd) if retcode[0] == 0: - Log.info(self, "[" + Log.ENDC + "OK" + Log.OKBLUE + "]") - return True + Log.info(self, "[" + Log.ENDC + "OK" + Log.OKBLUE + "]") + return True else: Log.debug(self, "{0}".format(retcode[1])) Log.info(self, "[" + Log.FAIL + "Failed" + Log.OKBLUE+"]") @@ -113,11 +113,10 @@ class WOService(): def get_service_status(self, service_name): - try: is_exist = subprocess.getstatusoutput('which {0}' .format(service_name)) - if is_exist[0] == 0 or service_name in ['php7.0-fpm', 'php5.6-fpm']: + if is_exist[0] == 0 or service_name in ['php7.2-fpm', 'php7.3-fpm']: retcode = subprocess.getstatusoutput('service {0} status' .format(service_name)) if retcode[0] == 0: diff --git a/wo/core/variables.py b/wo/core/variables.py index 4139c21..43c63b1 100644 --- a/wo/core/variables.py +++ b/wo/core/variables.py @@ -11,14 +11,14 @@ import datetime class WOVariables(): """Intialization of core variables""" - # WordOps version + # WordOps version wo_version = "3.9.2" # WordOps packages versions wo_wp_cli = "2.0.1" wo_adminer = "4.6.3" # Get WPCLI path - wo_wpcli_path = os.popen('which wp | tr "\n" " "').read() + wo_wpcli_path = os.popen('command -v wp | tr "\n" " "').read() if wo_wpcli_path == '': wo_wpcli_path = '/usr/bin/wp ' @@ -68,9 +68,9 @@ class WOVariables(): wo_mysql_host = "" config = configparser.RawConfigParser() if os.path.exists('/etc/mysql/conf.d/my.cnf'): - cnfpath = "/etc/mysql/conf.d/my.cnf" + cnfpath = "/etc/mysql/conf.d/my.cnf" else: - cnfpath = os.path.expanduser("~")+"/.my.cnf" + cnfpath = os.path.expanduser("~")+"/.my.cnf" if [cnfpath] == config.read(cnfpath): try: wo_mysql_host = config.get('client', 'host') @@ -89,7 +89,7 @@ class WOVariables(): "/rtCamp:/EasyEngine/xUbuntu_16.04/ /") elif wo_platform_codename == 'bionic': wo_nginx_repo = ("deb http://download.opensuse.org/repositories/home:" - "/rtCamp:/EasyEngine/xUbuntu_18.04/ /") + "/rtCamp:/EasyEngine/xUbuntu_18.04/ /") elif wo_platform_codename == 'jessie': wo_nginx_repo = ("deb http://download.opensuse.org/repositories/home:" "/rtCamp:/EasyEngine/Debian_8.0/ /") @@ -104,40 +104,41 @@ class WOVariables(): if wo_platform_distro == 'ubuntu': if (wo_platform_codename == 'trusty' or wo_platform_codename == 'xenial' or wo_platform_codename == 'bionic'): wo_php_repo = "ppa:ondrej/php" - wo_php = ["php7.2-fpm", "php-sodium", "php7.2-curl", "php7.2-gd", "php7.2-imap", - "php7.2-readline", "php7.2-common", "php7.2-recode", - "php7.2-cli", "php7.2-mbstring", - "php7.2-bcmath", "php7.2-mysql", "php7.2-opcache", "php7.2-zip", "php7.2-xml", "php7.2-soap"] - wo_php72 = ["php7.2-fpm", "php-sodium", "php7.2-curl", "php7.2-gd", "php7.2-imap", - "php7.2-readline", "php7.2-common", "php7.2-recode", - "php7.2-cli", "php7.2-mbstring", - "php7.2-bcmath", "php7.2-mysql", "php7.2-opcache", "php7.2-zip", "php7.2-xml", "php7.2-soap"] - wo_php_extra = ["php-memcached", "php-imagick", "php-memcache", "memcached", + wo_php = ["php7.2-fpm", "php7.2-curl", "php7.2-gd", "php7.2-imap", + "php7.2-readline", "php7.2-common", "php7.2-recode", + "php7.2-cli", "php7.2-mbstring", + "php7.2-bcmath", "php7.2-mysql", "php7.2-opcache", "php7.2-zip", "php7.2-xml", "php7.2-soap"] + wo_php73 = ["php7.3-fpm", "php7.3-curl", "php7.3-gd", "php7.3-imap", + "php7.3-readline", "php7.3-common", "php7.3-recode", + "php7.3-cli", "php7.3-mbstring", + "php7.3-bcmath", "php7.3-mysql", "php7.3-opcache", "php7.3-zip", "php7.3-xml", "php7.3-soap"] + wo_php_extra = ["php-memcached", "php-imagick", "graphviz", "php-pear", "php-xdebug", "php-msgpack", "php-redis"] elif wo_platform_distro == 'debian': - wo_php_repo = ("deb https://packages.sury.org/php/ {codename} main".format(codename=wo_platform_codename)) + wo_php_repo = ( + "deb https://packages.sury.org/php/ {codename} main".format(codename=wo_platform_codename)) wo_php = ["php7.2-fpm", "php7.2-curl", "php7.2-gd", "php7.2-imap", - "php-sodium", "php7.2-common", "php7.2-readline", "php7.2-redis", - "php7.2-mysql", "php7.2-cli", "php7.2-memcache", "php7.2-imagick", + "php7.2-common", "php7.2-readline", "php-redis", + "php7.2-mysql", "php7.2-cli", "php-imagick", "php7.2-mbstring", "php7.2-recode", "php7.2-bcmath", "php7.2-opcache", "php7.2-zip", "php7.2-xml", - "php7.2-soap", "php7.2-msgpack", - "memcached", "graphviz", "php-pear", "php7.2-xdebug"] - wo_php72 = ["php7.2-fpm", "php7.2-curl", "php7.2-gd", "php7.2-imap", - "php-sodium", "php7.2-common", "php7.2-readline", "php7.2-redis", - "php7.2-mysql", "php7.2-cli", "php7.2-memcache", "php7.2-imagick", - "php7.2-mbstring", "php7.2-recode", "php7.2-bcmath", "php7.2-opcache", "php7.2-zip", "php7.2-xml", - "php7.2-soap", "php7.2-msgpack", - "memcached", "graphviz", "php-pear", "php7.2-xdebug"] + "php7.2-soap", "php7.2-msgpack", + "graphviz", "php-pear", "php-xdebug"] + wo_php73 = ["php7.3-fpm", "php7.3-curl", "php7.3-gd", "php7.3-imap", + "php7.3-common", "php7.3-readline", "php-redis", + "php7.3-mysql", "php7.3-cli", "php-imagick", + "php7.3-mbstring", "php7.3-recode", "php7.3-bcmath", "php7.3-opcache", "php7.3-zip", "php7.3-xml", + "php7.3-soap", "php7.3-msgpack", + "graphviz", "php-pear", "php-xdebug"] wo_php_extra = [] # MySQL repo and packages if wo_platform_distro == 'ubuntu': wo_mysql_repo = ("deb [arch=amd64,i386,ppc64el] http://sfo1.mirrors.digitalocean.com/mariadb/repo/" - "10.1/ubuntu {codename} main" + "10.3/ubuntu {codename} main" .format(codename=wo_platform_codename)) elif wo_platform_distro == 'debian': wo_mysql_repo = ("deb [arch=amd64,i386,ppc64el] http://sfo1.mirrors.digitalocean.com/mariadb/repo/" - "10.1/debian {codename} main" + "10.3/debian {codename} main" .format(codename=wo_platform_codename)) wo_mysql = ["mariadb-server", "percona-toolkit"] @@ -146,7 +147,7 @@ class WOVariables(): if wo_platform_distro == 'ubuntu': if wo_platform_codename == "trusty" or wo_platform_codename == "xenial" or wo_platform_codename == "bionic": wo_hhvm_repo = ("deb http://dl.hhvm.com/ubuntu {codename} main" - .format(codename=wo_platform_codename)) + .format(codename=wo_platform_codename)) else: wo_hhvm_repo = ("deb http://dl.hhvm.com/debian {codename} main" .format(codename=wo_platform_codename)) @@ -159,10 +160,10 @@ class WOVariables(): else: wo_redis_repo = ("deb https://packages.sury.org/php/ {codename} all" - .format(codename=wo_platform_codename)) + .format(codename=wo_platform_codename)) if (wo_platform_codename == 'trusty' or wo_platform_codename == 'xenial' or wo_platform_codename == 'bionic' or wo_platform_distro == 'debian'): - wo_redis = ['redis-server', 'php7.2-redis'] + wo_redis = ['redis-server', 'php-redis'] # Repo path wo_repo_file = "wo-repo.list"