Update index.py

pull/109/head
midoks 3 years ago
parent 3301c68b27
commit 2f2ab82a7d
  1. 23
      plugins/php/index.py

@ -521,9 +521,10 @@ def setFpmConfig(version):
def checkFpmStatusFile(version):
if mw.isInstalledWeb():
sdir = mw.getServerDir()
dfile = sdir + '/openresty/nginx/conf/php_status/phpfpm_status_' + version + '.conf'
if not mw.isInstalledWeb():
return False
dfile = getServerDir() + '/nginx/conf/php_status/phpfpm_status_' + version + '.conf'
if not os.path.exists(dfile):
tpl = getPluginDir() + '/conf/phpfpm_status.conf'
content = mw.readFile(tpl)
@ -538,19 +539,19 @@ def getFpmStatus(version):
try:
url = 'http://' + mw.getHostAddr() + '/phpfpm_status_' + version + '?json'
result = mw.httpGet(url)
tmp = json.loads(result)
fTime = time.localtime(int(tmp['start time']))
tmp['start time'] = time.strftime('%Y-%m-%d %H:%M:%S', fTime)
data = json.loads(result)
fTime = time.localtime(int(data['start time']))
data['start time'] = time.strftime('%Y-%m-%d %H:%M:%S', fTime)
except Exception as e:
url = 'http://127.0.0.1/phpfpm_status_' + version + '?json'
result = mw.httpGet(url)
tmp = json.loads(result)
fTime = time.localtime(int(tmp['start time']))
tmp['start time'] = time.strftime('%Y-%m-%d %H:%M:%S', fTime)
data = json.loads(result)
fTime = time.localtime(int(data['start time']))
data['start time'] = time.strftime('%Y-%m-%d %H:%M:%S', fTime)
else:
tmp = {}
data = {}
return mw.getJson(tmp)
return mw.getJson(data)
def getDisableFunc(version):

Loading…
Cancel
Save