fix site.py
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -678,8 +678,8 @@ class WOSiteCreateController(CementBaseController):
|
||||
Log.error(self, "Check the log for details: "
|
||||
"`tail /var/log/wo/wordops.log` and please try again")
|
||||
|
||||
if self.app.pargs.letsencrypt and
|
||||
(not pargs.letsencrypt == "wildcard"):
|
||||
if (self.app.pargs.letsencrypt and
|
||||
not pargs.letsencrypt == "wildcard"):
|
||||
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.")
|
||||
@@ -773,7 +773,7 @@ class WOSiteUpdateController(CementBaseController):
|
||||
(['-le', '--letsencrypt'],
|
||||
dict(help="configure letsencrypt ssl for the site",
|
||||
action='store' or 'store_const',
|
||||
choices=('on', 'off', 'renew', 'subdomain', 'wildcard'),
|
||||
choices=('on', 'off', 'renew', 'subdomain', 'wildcard'),
|
||||
const='on', nargs='?')),
|
||||
(['--proxy'],
|
||||
dict(help="update to proxy site", nargs='+')),
|
||||
@@ -1277,9 +1277,9 @@ class WOSiteUpdateController(CementBaseController):
|
||||
if not WOService.reload_service(self, 'nginx'):
|
||||
Log.error(self, "service nginx reload failed. "
|
||||
"check issues with `nginx -t` command")
|
||||
# Log.info(self,"Removing Cron Job set for
|
||||
# Log.info(self,"Removing Cron Job set for
|
||||
# cert auto-renewal")
|
||||
# WOCron.remove_cron(self,'wo site update {0}
|
||||
# WOCron.remove_cron(self,'wo site update {0}
|
||||
# --le=renew --min_expiry_limit 30 2> \/dev\/null'
|
||||
# .format(wo_domain))
|
||||
Log.info(self, "Successfully Disabled SSl for Site "
|
||||
|
||||
Reference in New Issue
Block a user