From ec21fd5aab9c50e19186457398da89b996388f02 Mon Sep 17 00:00:00 2001 From: midoks Date: Sun, 12 Jul 2020 23:43:34 +0800 Subject: [PATCH] Update index.py --- plugins/xhprof/index.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/plugins/xhprof/index.py b/plugins/xhprof/index.py index a6aa10fa3..06b5a231e 100755 --- a/plugins/xhprof/index.py +++ b/plugins/xhprof/index.py @@ -100,6 +100,15 @@ def contentReplace(content): return content +def contentReplacePHP(content, version): + service_path = mw.getServerDir() + # print php_ver + content = content.replace('{$ROOT_PATH}', mw.getRootDir()) + content = content.replace('{$SERVER_PATH}', service_path) + content = content.replace('{$PHP_VER}', version) + return content + + def status(): conf = getConf() if os.path.exists(conf): @@ -144,6 +153,17 @@ def setPhpVer(): cacheFile = getServerDir() + '/php.pl' mw.writeFile(cacheFile, args['phpver']) + + file_tpl = getPluginDir() + '/conf/xhprof.conf' + file_run = getConf() + + if not os.path.exists(file_run): + centent = mw.readFile(file_tpl) + centent = contentReplace(centent, args['phpver']) + mw.writeFile(file_run, centent) + + mw.restartWeb() + restart() return 'ok'