From 47f2b9fc437defceabedc8bd78e3c07d7994b43e Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Wed, 19 Dec 2018 17:17:07 +0800 Subject: [PATCH] phpinfo ok --- plugins/php/conf/phpinfo.conf | 4 ++++ plugins/php/index.html | 2 +- plugins/php/index.py | 26 +++++++++++++++++++++ plugins/php/js/php.js | 43 +++++++++++++++++------------------ 4 files changed, 52 insertions(+), 23 deletions(-) create mode 100644 plugins/php/conf/phpinfo.conf diff --git a/plugins/php/conf/phpinfo.conf b/plugins/php/conf/phpinfo.conf new file mode 100644 index 000000000..223441d3f --- /dev/null +++ b/plugins/php/conf/phpinfo.conf @@ -0,0 +1,4 @@ +location /{$PHP_VERSION} { + root {$ROOT_PATH}/phpinfo; + include enable-php-{$PHP_VERSION}.conf; +} \ No newline at end of file diff --git a/plugins/php/index.html b/plugins/php/index.html index 4b7608bd7..e7aa1d6db 100755 --- a/plugins/php/index.html +++ b/plugins/php/index.html @@ -13,7 +13,7 @@

负载状况

FPM日志

慢日志

-

PHPIFNO

+

PHPIFNO

diff --git a/plugins/php/index.py b/plugins/php/index.py index 1fd517ec0..a27bda582 100755 --- a/plugins/php/index.py +++ b/plugins/php/index.py @@ -70,6 +70,7 @@ def status(version): def contentReplace(content, version): service_path = public.getServerDir() + content = content.replace('{$ROOT_PATH}', public.getRootDir()) content = content.replace('{$SERVER_PATH}', service_path) content = content.replace('{$PHP_VERSION}', version) @@ -453,6 +454,29 @@ def setDisableFunc(version): return public.returnJson(True, '设置成功!') +def checkPhpinfoFile(version): + if public.isInstalledWeb(): + desc_file = public.getServerDir( + ) + '/openresty/nginx/conf/php_status/phpinfo_' + version + '.conf' + if not os.path.exists(desc_file): + tpl = getPluginDir() + '/conf/phpinfo.conf' + content = public.readFile(tpl) + content = contentReplace(content, version) + public.writeFile(desc_file, content) + public.restartWeb() + + +def getPhpinfo(version): + checkPhpinfoFile(version) + sPath = public.getRootDir() + '/phpinfo/' + version + public.execShell("rm -rf " + public.getRootDir() + '/phpinfo') + public.execShell("mkdir -p " + sPath) + public.writeFile(sPath + '/phpinfo.php', '') + phpinfo = public.httpGet('http://127.0.0.1/' + version + '/phpinfo.php') + os.system("rm -rf " + public.getRootDir() + '/phpinfo') + return phpinfo + + def getLibConf(version): fname = public.getServerDir() + '/php/' + version + '/etc/php.ini' if not os.path.exists(filename): @@ -520,6 +544,8 @@ if __name__ == "__main__": print getDisableFunc(version) elif func == 'set_disable_func': print setDisableFunc(version) + elif func == 'get_phpinfo': + print getPhpinfo(version) elif func == 'get_lib_conf': print getLibConf(version) else: diff --git a/plugins/php/js/php.js b/plugins/php/js/php.js index 512463229..6b1434cec 100755 --- a/plugins/php/js/php.js +++ b/plugins/php/js/php.js @@ -359,6 +359,27 @@ function setDisableFunc(version, act, fs) { } +//phpinfo +function getPhpinfo(version) { + var con = ''; + $(".soft-man-con").html(con); +} + +//获取PHPInfo +function getPHPInfo(version) { + phpPost('get_phpinfo', version, '', function(data){ + var rdata = data.data; + layer.open({ + type: 1, + title: "PHP-" + version + "-PHPINFO", + area: ['90%', '90%'], + closeBtn: 2, + shadeClose: true, + content: rdata + }); + }); +} + function phpLibConfig(version){ } @@ -479,26 +500,4 @@ function UninstallPHPLib(version, name, title, pathinfo) { SetPHPConfig(version, pathinfo, true); }); }); -} - -//phpinfo -function BtPhpinfo(version) { - var con = ''; - $(".soft-man-con").html(con); -} - -//获取PHPInfo -function GetPHPInfo(version) { - var loadT = layer.msg(lan.soft.get, { icon: 16, time: 0, shade: [0.3, '#000'] }); - $.get('/ajax?action=GetPHPInfo&version=' + version, function(rdata) { - layer.close(loadT); - layer.open({ - type: 1, - title: "PHP-" + version + "-PHPINFO", - area: ['70%', '90%'], - closeBtn: 2, - shadeClose: true, - content: rdata.replace('a:link {color: #009; text-decoration: none; background-color: #fff;}', '').replace('a:link {color: #000099; text-decoration: none; background-color: #ffffff;}', '') - }); - }); } \ No newline at end of file