网站统计 x20

This commit is contained in:
midoks
2022-07-26 15:20:16 +08:00
parent 8c3f424cbb
commit 92654b6e3f
2 changed files with 12 additions and 3 deletions
+1 -3
View File
@@ -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')
+11
View File
@@ -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"