diff --git a/ee/cli/plugins/debug.py b/ee/cli/plugins/debug.py index cf8dca40..3572501d 100644 --- a/ee/cli/plugins/debug.py +++ b/ee/cli/plugins/debug.py @@ -73,9 +73,33 @@ class EEDebugController(CementBaseController): @expose(hide=True) def debug_php(self): if self.start: - print("Start PHP debug") + if not (EEShellExec.cmd_exec(self, "sed -n \"/upstream php" + "{/,/}/p \" /etc/nginx/" + "conf.d/upstream.conf " + "| grep 9001")): + print("Enabling PHP debug") + data = dict(php="9001", debug="9001") + self.app.log.debug('writting the nginx configration to file' + '/etc/nginx/conf.d/upstream.conf ') + ee_nginx = open('/etc/nginx/conf.d/upstream.conf', 'w') + self.app.render((data), 'upstream.mustache', out=ee_nginx) + ee_nginx.close() + + else: + print("PHP debug is allready enabled") else: - print("Stop PHP debug") + if EEShellExec.cmd_exec(self, "sed -n \"/upstream php {/,/}/p\" " + "/etc/nginx/conf.d/upstream.conf " + "| grep 9001"): + print("Disabling PHP debug") + data = dict(php="9000", debug="9001") + self.app.log.debug('writting the nginx configration to file' + '/etc/nginx/conf.d/upstream.conf ') + ee_nginx = open('/etc/nginx/conf.d/upstream.conf', 'w') + self.app.render((data), 'upstream.mustache', out=ee_nginx) + ee_nginx.close() + else: + print("PHP debug is allready disbaled") @expose(hide=True) def debug_fpm(self): diff --git a/ee/cli/plugins/stack.py b/ee/cli/plugins/stack.py index cafe9a42..9cabdb4d 100644 --- a/ee/cli/plugins/stack.py +++ b/ee/cli/plugins/stack.py @@ -177,6 +177,7 @@ class EEStackController(CementBaseController): self.app.render((data), 'fastcgi.mustache', out=ee_nginx) ee_nginx.close() + data = dict(php="9000", debug="9001") self.app.log.debug('writting the nginx configration to file' '/etc/nginx/conf.d/upstream.conf ') ee_nginx = open('/etc/nginx/conf.d/upstream.conf', 'w') diff --git a/ee/cli/templates/upstream.mustache b/ee/cli/templates/upstream.mustache index d147724e..8a265179 100644 --- a/ee/cli/templates/upstream.mustache +++ b/ee/cli/templates/upstream.mustache @@ -1,9 +1,9 @@ # Common upstream settings upstream php { # server unix:/run/php5-fpm.sock; -server 127.0.0.1:9000; +server 127.0.0.1:{{php}}; } upstream debug { # Debug Pool -server 127.0.0.1:9001; +server 127.0.0.1:{{debug}}; } diff --git a/ee/core/shellexec.py b/ee/core/shellexec.py index 1b9f6e98..2941fdf3 100644 --- a/ee/core/shellexec.py +++ b/ee/core/shellexec.py @@ -16,7 +16,7 @@ class EEShellExec(): if retcode[0] == 0: return True else: - self.app.log.info(retcode[1]) + self.app.log.warn(retcode[1]) return False except OSError as e: self.app.log.info(e)