fix site.py

This commit is contained in:
VirtuBox
2019-03-15 23:12:47 +01:00
parent 58f400ed0b
commit 5651d7072e
2 changed files with 34 additions and 32 deletions

View File

@@ -191,14 +191,15 @@ class WODebugController(CementBaseController):
nc.savef('/etc/nginx/conf.d/upstream.conf')
# Enable xdebug
WOFileUtils.searchreplace(self, "/etc/{0}/mods-available/".format("php/7.2" if (WOVariables.wo_platform_distro == 'ubuntu') else "php5") +
WOFileUtils.searchreplace(self, "/etc/{0}/mods-available/".format("php/7.2" if (WOVariables.wo_platform_distro == 'ubuntu') else "php/7.2") +
"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/7.2" if (WOVariables.wo_platform_distro == 'ubuntu') else "php5"))
config.read('/etc/{0}/fpm/pool.d/debug.conf'.format(
"php/7.2" if (WOVariables.wo_platform_distro == 'ubuntu') else "php5"))
config['debug']['slowlog'] = '/var/log/{0}/slow.log'.format("php/7.2" if (
WOVariables.wo_platform_distro == 'ubuntu') else "php5")
config['debug']['request_slowlog_timeout'] = '10s'
@@ -249,7 +250,8 @@ class WODebugController(CementBaseController):
"/etc/{0}/fpm/php-fpm.conf".format("php/7.2" if (WOVariables.wo_platform_distro == 'ubuntu') 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/7.2" if (WOVariables.wo_platform_distro == 'ubuntu') else "php5"))
config.read('/etc/{0}/fpm/php-fpm.conf'.format("php/7.2" if (
WOVariables.wo_platform_distro == 'ubuntu') else "php5"))
config.remove_option('global', 'include')
config['global']['log_level'] = 'debug'
config['global']['include'] = '/etc/{0}/fpm/pool.d/*.conf'.format("php/7.2" if (
@@ -272,7 +274,8 @@ class WODebugController(CementBaseController):
"/etc/{0}/fpm/php-fpm.conf".format("php/7.2" if (WOVariables.wo_platform_distro == 'ubuntu') else "php5")):
Log.info(self, "Disabling PHP5-FPM log_level = debug")
config = configparser.ConfigParser()
config.read('/etc/{0}/fpm/php-fpm.conf'.format("php/7.2" if (WOVariables.wo_platform_distro == 'ubuntu') else "php5"))
config.read('/etc/{0}/fpm/php-fpm.conf'.format("php/7.2" if (
WOVariables.wo_platform_distro == 'ubuntu') else "php5"))
config.remove_option('global', 'include')
config['global']['log_level'] = 'notice'
config['global']['include'] = '/etc/{0}/fpm/pool.d/*.conf'.format("php/7.2" if (
@@ -340,7 +343,8 @@ class WODebugController(CementBaseController):
# Change upstream.conf
nc = NginxConfig()
nc.loadf('/etc/nginx/conf.d/upstream.conf')
nc.set([('upstream', 'php72',), 'server'], 'unix:/var/run/php/php72-fpm.sock')
nc.set([('upstream', 'php72',), 'server'],
'unix:/var/run/php/php72-fpm.sock')
nc.savef('/etc/nginx/conf.d/upstream.conf')
# Disable xdebug
@@ -620,13 +624,10 @@ class WODebugController(CementBaseController):
# Reload PHP
if self.trigger_php:
if WOVariables.wo_platform_distro == 'ubuntu':
if WOAptGet.is_installed(self, 'php7.2-fpm'):
WOService.reload_service(self, 'php7.2-fpm')
if WOAptGet.is_installed(self, 'php7.3-fpm'):
WOService.reload_service(self, 'php7.3-fpm')
else:
if WOAptGet.is_installed(self, 'php7.2-fpm'):
WOService.reload_service(self, 'php7.2-fpm')
if WOAptGet.is_installed(self, 'php7.3-fpm'):
WOService.reload_service(self, 'php7.3-fpm')
self.app.close(0)
@expose(hide=True)
@@ -638,12 +639,12 @@ class WODebugController(CementBaseController):
self.trigger_nginx = False
self.trigger_php = False
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.fpm73) 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)
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.fpm73) 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")
@@ -711,7 +712,7 @@ class WODebugController(CementBaseController):
self.app.pargs.nginx = 'on'
self.app.pargs.php = 'on'
self.app.pargs.fpm = 'on'
if (WOVariables.wo_platform_distro == 'ubuntu') and WOAptGet.is_installed(self, 'php7.2-fpm'):
if WOAptGet.is_installed(self, 'php7.2-fpm'):
self.app.pargs.php73 = 'on'
self.app.pargs.fpm73 = 'on'
self.app.pargs.mysql = 'on'
@@ -723,16 +724,17 @@ class WODebugController(CementBaseController):
self.app.pargs.nginx = 'off'
self.app.pargs.php = 'off'
self.app.pargs.fpm = 'off'
if (WOVariables.wo_platform_distro == 'ubuntu') and WOAptGet.is_installed(self, 'php7.2-fpm'):
if WOAptGet.is_installed(self, 'php7.2-fpm'):
self.app.pargs.php73 = 'off'
self.app.pargs.fpm73 = '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.php73)
and (not self.app.pargs.fpm) and (not self.app.pargs.fpm73) 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.fpm73) 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'
@@ -768,10 +770,10 @@ class WODebugController(CementBaseController):
WOService.reload_service(self, 'nginx')
# Reload PHP
if self.trigger_php:
if WOAptGet.is_installed(self, 'php7.2-fpm'):
WOService.restart_service(self, 'php7.2-fpm')
if WOAptGet.is_installed(self, 'php7.3-fpm'):
WOService.restart_service(self, 'php7.3-fpm')
if WOAptGet.is_installed(self, 'php7.2-fpm'):
WOService.restart_service(self, 'php7.2-fpm')
if WOAptGet.is_installed(self, 'php7.3-fpm'):
WOService.restart_service(self, 'php7.3-fpm')
if len(self.msg) > 0:
if not self.app.pargs.interactive: