From 5cb2aefbbce5e79ae1a85c9446ceeae740e4e68a Mon Sep 17 00:00:00 2001 From: midoks Date: Sun, 9 Oct 2022 01:25:53 +0800 Subject: [PATCH] up --- plugins/op_waf/index.py | 8 +++++++- plugins/op_waf/waf/lua/init.lua | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/plugins/op_waf/index.py b/plugins/op_waf/index.py index 2577aebec..3e729405f 100755 --- a/plugins/op_waf/index.py +++ b/plugins/op_waf/index.py @@ -186,10 +186,12 @@ def status(): def contentReplace(content): service_path = mw.getServerDir() - waf_path = getServerDir() + "/waf" + waf_root = getServerDir() + waf_path = waf_root + "/waf" content = content.replace('{$ROOT_PATH}', mw.getRootDir()) content = content.replace('{$SERVER_PATH}', service_path) content = content.replace('{$WAF_PATH}', waf_path) + content = content.replace('{$WAF_ROOT}', waf_root) return content @@ -201,6 +203,10 @@ def initDreplace(): cmd = 'cp -rf ' + sdir + ' ' + path mw.execShell(cmd) + logs_path = path + '/logs' + if not os.path.exists(logs_path): + mw.execShell('mkdir -p ' + logs_path) + config = path + '/waf/config.json' content = mw.readFile(config) content = json.loads(content) diff --git a/plugins/op_waf/waf/lua/init.lua b/plugins/op_waf/waf/lua/init.lua index 342ab7d03..d722843c9 100644 --- a/plugins/op_waf/waf/lua/init.lua +++ b/plugins/op_waf/waf/lua/init.lua @@ -1,7 +1,7 @@ local cpath = "{$WAF_PATH}/" local rpath = "{$WAF_PATH}/rule/" -local logdir = "{$ROOT_PATH}/wwwlogs/waf/" +local logdir = "{$WAF_ROOT}/logs/" local json = require "cjson" local ngx_match = ngx.re.find