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)
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):

1
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')

4
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}};
}

2
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)

Loading…
Cancel
Save