找到问题,待解决

pull/109/head
Mr Chen 6 years ago
parent 99f06f9c47
commit b414ce369f
  1. 6
      class/core/plugins_api.py
  2. 5
      class/core/public.py
  3. 2
      class/core/site_api.py
  4. 23
      plugins/php/index.py
  5. 16
      plugins/php/js/php.js
  6. 3
      setting.py

@ -251,6 +251,12 @@ class plugins_api:
return public.returnJson(True, '安装成功!') return public.returnJson(True, '安装成功!')
public.execShell("rm -rf " + plugin_path) public.execShell("rm -rf " + plugin_path)
return public.returnJson(False, '安装失败!') return public.returnJson(False, '安装失败!')
def phpinfoApi(self):
version = request.form.get('version', '')
phpinfo = public.httpGet(
'http://127.0.0.1/' + version + '/phpinfo.php')
return phpinfo
##### ----- end ----- ### ##### ----- end ----- ###
# 进程是否存在 # 进程是否存在

@ -355,14 +355,17 @@ def HttpGet(url, timeout=10):
def HttpGet2(url, timeout): def HttpGet2(url, timeout):
import urllib
import urllib2 import urllib2
try:
req = urllib2.Request(url) req = urllib2.Request(url)
res = urllib2.urlopen(req, timeout=timeout) res = urllib2.urlopen(req, timeout=timeout)
result = res.read() result = res.read()
return result return result
except Exception as e:
return str(e)
def httpGet(url, timeout=10): def httpGet(url, timeout=10):
return HttpGet2(url, timeout) return HttpGet2(url, timeout)

@ -611,7 +611,7 @@ class site_api:
# print home_cert # print home_cert
cmd = 'export ACCOUNT_EMAIL=' + email + ' && ' + execStr cmd = 'export ACCOUNT_EMAIL=' + email + ' && ' + execStr
print cmd # print cmd
result = public.execShell(cmd) result = public.execShell(cmd)
if not os.path.exists(home_cert.replace("\*", "*")): if not os.path.exists(home_cert.replace("\*", "*")):

@ -12,6 +12,8 @@ reload(sys)
sys.setdefaultencoding('utf8') sys.setdefaultencoding('utf8')
sys.path.append(os.getcwd() + "/class/core") sys.path.append(os.getcwd() + "/class/core")
sys.path.append("/usr/local/lib/python2.7/site-packages")
import public import public
app_debug = False app_debug = False
@ -480,28 +482,29 @@ def setDisableFunc(version):
return public.returnJson(True, '设置成功!') return public.returnJson(True, '设置成功!')
def checkPhpinfoFile(version): def checkPhpinfoFile(v):
if public.isInstalledWeb(): if public.isInstalledWeb():
desc_file = public.getServerDir( desc_file = public.getServerDir() + '/openresty/nginx/conf/php_status/phpinfo_' + \
) + '/openresty/nginx/conf/php_status/phpinfo_' + version + '.conf' str(v) + '.conf'
if not os.path.exists(desc_file): if not os.path.exists(desc_file):
tpl = getPluginDir() + '/conf/phpinfo.conf' tpl = getPluginDir() + '/conf/phpinfo.conf'
content = public.readFile(tpl) content = public.readFile(tpl)
content = contentReplace(content, version) content = contentReplace(content, v)
public.writeFile(desc_file, content) public.writeFile(desc_file, content)
public.restartWeb() public.restartWeb()
def getPhpinfo(version): def getPhpinfo(v):
checkPhpinfoFile(version) checkPhpinfoFile(v)
sPath = public.getRootDir() + '/phpinfo/' + version sPath = public.getRootDir() + '/phpinfo/' + str(v)
# public.execShell("rm -rf " + public.getRootDir() + '/phpinfo') # public.execShell("rm -rf " + public.getRootDir() + '/phpinfo')
public.execShell("mkdir -p " + sPath) public.execShell("mkdir -p " + sPath)
public.writeFile(sPath + '/phpinfo.php', '<?php phpinfo(); ?>') public.writeFile(sPath + '/phpinfo.php', '<?php phpinfo(); ?>')
# print 'http://127.0.0.1/' + version + '/phpinfo.php' # print 'http://127.0.0.1/' + str(v) + '/phpinfo.php'
phpinfo = public.httpGet('http://127.0.0.1/' + version + '/phpinfo.php', 3) phpinfo = public.httpGet('http://127.0.0.1/' + str(v) + '/phpinfo.php')
public.writeFile('/tmp/phpinfo.txt', phpinfo)
# os.system("rm -rf " + public.getRootDir() + '/phpinfo') # os.system("rm -rf " + public.getRootDir() + '/phpinfo')
return phpinfo return ''
def getLibConf(version): def getLibConf(version):

@ -373,7 +373,7 @@ function setDisableFunc(version, act, fs) {
//phpinfo //phpinfo
function getPhpinfo(version) { function getPhpinfo(version) {
var con = '<button class="btn btn-default btn-sm" onclick="getPHPInfo(\'' + version + '\')">' + lan.soft.phpinfo + '</button>'; var con = '<button class="btn btn-default btn-sm" onclick="getPHPInfo(\'' + version + '\')">查看phpinfo()</button>';
$(".soft-man-con").html(con); $(".soft-man-con").html(con);
} }
@ -392,6 +392,20 @@ function getPHPInfo(version) {
}); });
} }
//获取PHPInfo
function getPHPInfo_new(version) {
$.post('/plugins/phpinfo', {v:version}, function(data) {
layer.open({
type: 1,
title: "PHP-" + version + "-PHPINFO",
area: ['90%', '90%'],
closeBtn: 2,
shadeClose: true,
content: data
});
});
}
function phpLibConfig(version){ function phpLibConfig(version){
phpPost('get_lib_conf', version, '', function(data){ phpPost('get_lib_conf', version, '', function(data){

@ -6,10 +6,9 @@ import sys
import os import os
chdir = os.getcwd() chdir = os.getcwd()
sys.path.append(chdir + '/class/core') sys.path.append(chdir + '/class/core')
sys.path.append("/usr/local/lib/python2.7/site-packages") # sys.path.append("/usr/local/lib/python2.7/site-packages")
import public import public
import system_api import system_api
# cpu_info = system_api.system_api().getCpuInfo() # cpu_info = system_api.system_api().getCpuInfo()
# workers = cpu_info[1] + 1 # workers = cpu_info[1] + 1

Loading…
Cancel
Save