Update index.py

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

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

Loading…
Cancel
Save