|
|
@ -2,6 +2,7 @@ |
|
|
|
|
|
|
|
from cement.core.controller import CementBaseController, expose |
|
|
|
from cement.core import handler, hook |
|
|
|
from ee.core.variables import EEVariables |
|
|
|
from pynginxconfig import NginxConfig |
|
|
|
from ee.core.aptget import EEAptGet |
|
|
|
from ee.core.shellexec import EEShellExec |
|
|
@ -29,6 +30,9 @@ class EEInfoController(CementBaseController): |
|
|
|
(['--php'], |
|
|
|
dict(help='Get PHP configuration information', |
|
|
|
action='store_true')), |
|
|
|
(['--php7'], |
|
|
|
dict(help='Get PHP 7.0 configuration information', |
|
|
|
action='store_true')), |
|
|
|
(['--nginx'], |
|
|
|
dict(help='Get Nginx configuration information', |
|
|
|
action='store_true')), |
|
|
@ -66,14 +70,14 @@ class EEInfoController(CementBaseController): |
|
|
|
version = os.popen("php -v | head -n1 | cut -d' ' -f2 |" |
|
|
|
" cut -d'+' -f1 | tr -d '\n'").read |
|
|
|
config = configparser.ConfigParser() |
|
|
|
config.read('/etc/php5/fpm/php.ini') |
|
|
|
config.read('/etc/{0}/fpm/php.ini'.format("php/5.6" if EEVariables.ee_platform_codename == 'trusty' else "php5")) |
|
|
|
expose_php = config['PHP']['expose_php'] |
|
|
|
memory_limit = config['PHP']['memory_limit'] |
|
|
|
post_max_size = config['PHP']['post_max_size'] |
|
|
|
upload_max_filesize = config['PHP']['upload_max_filesize'] |
|
|
|
max_execution_time = config['PHP']['max_execution_time'] |
|
|
|
|
|
|
|
config.read('/etc/php5/fpm/pool.d/www.conf') |
|
|
|
config.read('/etc/{0}/fpm/pool.d/www.conf'.format("php/5.6" if EEVariables.ee_platform_codename == 'trusty' else "php5")) |
|
|
|
www_listen = config['www']['listen'] |
|
|
|
www_ping_path = config['www']['ping.path'] |
|
|
|
www_pm_status_path = config['www']['pm.status_path'] |
|
|
@ -91,7 +95,81 @@ class EEInfoController(CementBaseController): |
|
|
|
except Exception as e: |
|
|
|
www_xdebug = 'off' |
|
|
|
|
|
|
|
config.read('/etc/php5/fpm/pool.d/debug.conf') |
|
|
|
config.read('/etc/{0}/fpm/pool.d/debug.conf'.format("php/5.6" if EEVariables.ee_platform_codename == 'trusty' else "php5")) |
|
|
|
debug_listen = config['debug']['listen'] |
|
|
|
debug_ping_path = config['debug']['ping.path'] |
|
|
|
debug_pm_status_path = config['debug']['pm.status_path'] |
|
|
|
debug_pm = config['debug']['pm'] |
|
|
|
debug_pm_max_requests = config['debug']['pm.max_requests'] |
|
|
|
debug_pm_max_children = config['debug']['pm.max_children'] |
|
|
|
debug_pm_start_servers = config['debug']['pm.start_servers'] |
|
|
|
debug_pm_min_spare_servers = config['debug']['pm.min_spare_servers'] |
|
|
|
debug_pm_max_spare_servers = config['debug']['pm.max_spare_servers'] |
|
|
|
debug_request_terminate = (config['debug'] |
|
|
|
['request_terminate_timeout']) |
|
|
|
try: |
|
|
|
debug_xdebug = (config['debug']['php_admin_flag[xdebug.profiler_' |
|
|
|
'enable_trigger]']) |
|
|
|
except Exception as e: |
|
|
|
debug_xdebug = 'off' |
|
|
|
|
|
|
|
data = dict(version=version, expose_php=expose_php, |
|
|
|
memory_limit=memory_limit, post_max_size=post_max_size, |
|
|
|
upload_max_filesize=upload_max_filesize, |
|
|
|
max_execution_time=max_execution_time, |
|
|
|
www_listen=www_listen, www_ping_path=www_ping_path, |
|
|
|
www_pm_status_path=www_pm_status_path, www_pm=www_pm, |
|
|
|
www_pm_max_requests=www_pm_max_requests, |
|
|
|
www_pm_max_children=www_pm_max_children, |
|
|
|
www_pm_start_servers=www_pm_start_servers, |
|
|
|
www_pm_min_spare_servers=www_pm_min_spare_servers, |
|
|
|
www_pm_max_spare_servers=www_pm_max_spare_servers, |
|
|
|
www_request_terminate_timeout=www_request_terminate_time, |
|
|
|
www_xdebug_profiler_enable_trigger=www_xdebug, |
|
|
|
debug_listen=debug_listen, debug_ping_path=debug_ping_path, |
|
|
|
debug_pm_status_path=debug_pm_status_path, |
|
|
|
debug_pm=debug_pm, |
|
|
|
debug_pm_max_requests=debug_pm_max_requests, |
|
|
|
debug_pm_max_children=debug_pm_max_children, |
|
|
|
debug_pm_start_servers=debug_pm_start_servers, |
|
|
|
debug_pm_min_spare_servers=debug_pm_min_spare_servers, |
|
|
|
debug_pm_max_spare_servers=debug_pm_max_spare_servers, |
|
|
|
debug_request_terminate_timeout=debug_request_terminate, |
|
|
|
debug_xdebug_profiler_enable_trigger=debug_xdebug) |
|
|
|
self.app.render((data), 'info_php.mustache') |
|
|
|
|
|
|
|
@expose(hide=True) |
|
|
|
def info_php7(self): |
|
|
|
"""Display PHP information""" |
|
|
|
version = os.popen("php -v | head -n1 | cut -d' ' -f2 |" |
|
|
|
" cut -d'+' -f1 | tr -d '\n'").read |
|
|
|
config = configparser.ConfigParser() |
|
|
|
config.read('/etc/php/7.0/fpm/php.ini') |
|
|
|
expose_php = config['PHP']['expose_php'] |
|
|
|
memory_limit = config['PHP']['memory_limit'] |
|
|
|
post_max_size = config['PHP']['post_max_size'] |
|
|
|
upload_max_filesize = config['PHP']['upload_max_filesize'] |
|
|
|
max_execution_time = config['PHP']['max_execution_time'] |
|
|
|
|
|
|
|
config.read('/etc/php/7.0/fpm/pool.d/www.conf') |
|
|
|
www_listen = config['www']['listen'] |
|
|
|
www_ping_path = config['www']['ping.path'] |
|
|
|
www_pm_status_path = config['www']['pm.status_path'] |
|
|
|
www_pm = config['www']['pm'] |
|
|
|
www_pm_max_requests = config['www']['pm.max_requests'] |
|
|
|
www_pm_max_children = config['www']['pm.max_children'] |
|
|
|
www_pm_start_servers = config['www']['pm.start_servers'] |
|
|
|
www_pm_min_spare_servers = config['www']['pm.min_spare_servers'] |
|
|
|
www_pm_max_spare_servers = config['www']['pm.max_spare_servers'] |
|
|
|
www_request_terminate_time = (config['www'] |
|
|
|
['request_terminate_timeout']) |
|
|
|
try: |
|
|
|
www_xdebug = (config['www']['php_admin_flag[xdebug.profiler_enable' |
|
|
|
'_trigger]']) |
|
|
|
except Exception as e: |
|
|
|
www_xdebug = 'off' |
|
|
|
|
|
|
|
config.read('/etc/php/7.0/fpm/pool.d/debug.conf') |
|
|
|
debug_listen = config['debug']['listen'] |
|
|
|
debug_ping_path = config['debug']['ping.path'] |
|
|
|
debug_pm_status_path = config['debug']['pm.status_path'] |
|
|
@ -183,6 +261,12 @@ class EEInfoController(CementBaseController): |
|
|
|
else: |
|
|
|
Log.error(self, "PHP5 is not installed") |
|
|
|
|
|
|
|
if self.app.pargs.php7: |
|
|
|
if EEAptGet.is_installed(self, 'php7.0-fpm'): |
|
|
|
self.info_php7() |
|
|
|
else: |
|
|
|
Log.error(self, "PHP 7.0 is not installed") |
|
|
|
|
|
|
|
if self.app.pargs.mysql: |
|
|
|
if EEShellExec.cmd_exec(self, "mysqladmin ping"): |
|
|
|
self.info_mysql() |
|
|
|