pull/109/head
Mr Chen 6 years ago
parent 842927168e
commit 47f2b9fc43
  1. 4
      plugins/php/conf/phpinfo.conf
  2. 2
      plugins/php/index.html
  3. 26
      plugins/php/index.py
  4. 43
      plugins/php/js/php.js

@ -0,0 +1,4 @@
location /{$PHP_VERSION} {
root {$ROOT_PATH}/phpinfo;
include enable-php-{$PHP_VERSION}.conf;
}

@ -13,7 +13,7 @@
<p onclick="getFpmStatus($('.plugin_version').attr('version'));">负载状况</p>
<p onclick="pluginLogs('php',$('.plugin_version').attr('version'),'fpm_log');">FPM日志</p>
<p onclick="pluginLogs('php',$('.plugin_version').attr('version'),'fpm_slow_log');">慢日志</p>
<p onclick="redisStatus();">PHPIFNO</p>
<p onclick="getPhpinfo($('.plugin_version').attr('version'));">PHPIFNO</p>
</div>
<div class="bt-w-con pd15">
<div class="soft-man-con"></div>

@ -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', '<?php phpinfo(); ?>')
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:

@ -359,6 +359,27 @@ function setDisableFunc(version, act, fs) {
}
//phpinfo
function getPhpinfo(version) {
var con = '<button class="btn btn-default btn-sm" onclick="getPHPInfo(\'' + version + '\')">' + lan.soft.phpinfo + '</button>';
$(".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){
}
@ -480,25 +501,3 @@ function UninstallPHPLib(version, name, title, pathinfo) {
});
});
}
//phpinfo
function BtPhpinfo(version) {
var con = '<button class="btn btn-default btn-sm" onclick="GetPHPInfo(\'' + version + '\')">' + lan.soft.phpinfo + '</button>';
$(".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;}', '')
});
});
}
Loading…
Cancel
Save