From e3ecdfb2b3caef08588936f02df09337909ceb3f Mon Sep 17 00:00:00 2001 From: midoks Date: Sat, 11 Feb 2023 23:43:51 +0800 Subject: [PATCH] Update index.py --- plugins/webstats/index.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/plugins/webstats/index.py b/plugins/webstats/index.py index 7cfd5a3e3..1487ba900 100755 --- a/plugins/webstats/index.py +++ b/plugins/webstats/index.py @@ -254,21 +254,23 @@ def initDreplace(): file_list = [ 'webstats_common.lua', 'webstats_log.lua', - 'webstats_worker.lua', ] for fl in file_list: loadLuaFile(fl) root_worker_dir = mw.getServerDir() + '/web_conf/nginx/lua/init_worker_by_lua_file' - webstats_worker_src_file = lua_dir = getServerDir() + "/lua/webstats_worker.lua" webstats_worker_dst_file = root_worker_dir + '/webstats_worker.lua' - content = mw.readFile(webstats_worker_src_file) - content = content.replace('{$SERVER_APP}', getServerDir()) - content = content.replace('{$ROOT_PATH}', mw.getServerDir()) - mw.writeFile(webstats_worker_dst_file, content) - mw.opLuaInitWorkerFile() + if not os.path.exists(webstats_worker_src_file): + loadLuaFile('webstats_worker.lua') + webstats_worker_src_file = lua_dir = getServerDir() + "/lua/webstats_worker.lua" + content = mw.readFile(webstats_worker_src_file) + content = content.replace('{$SERVER_APP}', getServerDir()) + content = content.replace('{$ROOT_PATH}', mw.getServerDir()) + mw.writeFile(webstats_worker_dst_file, content) + mw.opLuaInitWorkerFile() + os.remove(webstats_worker_src_file) loadConfigFile() loadLuaSiteFile()