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()