diff --git a/plugins/webstats/index.py b/plugins/webstats/index.py index 3a1f4cb82..97c00689e 100755 --- a/plugins/webstats/index.py +++ b/plugins/webstats/index.py @@ -137,15 +137,13 @@ def loadDebugLogFile(): mw.writeFile(debug_log, '') -def pSqliteDb(dbname='web_logs', site_name='unset'): +def pSqliteDb(dbname='web_logs', site_name='unset', name="logs"): db_dir = getServerDir() + '/logs/' + site_name if not os.path.exists(db_dir): mw.execShell('mkdir -p ' + db_dir) - name = 'logs' file = db_dir + '/' + name + '.db' - if not os.path.exists(file): conn = mw.M(dbname).dbPos(db_dir, name) sql = mw.readFile(getPluginDir() + '/conf/init.sql') diff --git a/plugins/webstats/lua/webstats_log.lua b/plugins/webstats/lua/webstats_log.lua index 3a200c298..0d1f89640 100644 --- a/plugins/webstats/lua/webstats_log.lua +++ b/plugins/webstats/lua/webstats_log.lua @@ -202,6 +202,13 @@ log_by_lua_block { return json.encode(headers) end + local function is_migrating(input_server_name) + local file = io.open("{$SERVER_APP}/migrating", "rb") + if file then return true end + local file = io.open("{$SERVER_APP}/logs/"..input_server_name.."/migrating", "rb") + if file then return true end + return false + end local function is_working(name) @@ -837,6 +844,10 @@ log_by_lua_block { end local function store_logs(input_server_name) + if is_migrating(input_server_name) == true then + -- D("migrating...") + return + end local last_insert_id_key = input_server_name.."_last_id" local store_start_id_key = input_server_name.."_store_start"