Browse Source

PHP debug done

bugfixes
gau1991 10 years ago
parent
commit
f977bec127
  1. 28
      ee/cli/plugins/debug.py
  2. 1
      ee/cli/plugins/stack.py
  3. 4
      ee/cli/templates/upstream.mustache
  4. 2
      ee/core/shellexec.py

28
ee/cli/plugins/debug.py

@ -73,9 +73,33 @@ class EEDebugController(CementBaseController):
@expose(hide=True) @expose(hide=True)
def debug_php(self): def debug_php(self):
if self.start: 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:
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: else:
print("Stop PHP debug") print("PHP debug is allready disbaled")
@expose(hide=True) @expose(hide=True)
def debug_fpm(self): def debug_fpm(self):

1
ee/cli/plugins/stack.py

@ -177,6 +177,7 @@ class EEStackController(CementBaseController):
self.app.render((data), 'fastcgi.mustache', out=ee_nginx) self.app.render((data), 'fastcgi.mustache', out=ee_nginx)
ee_nginx.close() ee_nginx.close()
data = dict(php="9000", debug="9001")
self.app.log.debug('writting the nginx configration to file' self.app.log.debug('writting the nginx configration to file'
'/etc/nginx/conf.d/upstream.conf ') '/etc/nginx/conf.d/upstream.conf ')
ee_nginx = open('/etc/nginx/conf.d/upstream.conf', 'w') ee_nginx = open('/etc/nginx/conf.d/upstream.conf', 'w')

4
ee/cli/templates/upstream.mustache

@ -1,9 +1,9 @@
# Common upstream settings # Common upstream settings
upstream php { upstream php {
# server unix:/run/php5-fpm.sock; # server unix:/run/php5-fpm.sock;
server 127.0.0.1:9000; server 127.0.0.1:{{php}};
} }
upstream debug { upstream debug {
# Debug Pool # Debug Pool
server 127.0.0.1:9001; server 127.0.0.1:{{debug}};
} }

2
ee/core/shellexec.py

@ -16,7 +16,7 @@ class EEShellExec():
if retcode[0] == 0: if retcode[0] == 0:
return True return True
else: else:
self.app.log.info(retcode[1]) self.app.log.warn(retcode[1])
return False return False
except OSError as e: except OSError as e:
self.app.log.info(e) self.app.log.info(e)

Loading…
Cancel
Save