mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 09:42:36 +02:00
that was definitely what was wrong with the stats
This commit is contained in:
parent
987d9789be
commit
781ea9c170
1 changed files with 2 additions and 11 deletions
|
@ -78,11 +78,11 @@ class Stat < Sequel::Model
|
||||||
DB[:stats].lock('EXCLUSIVE') { stat = Stat.create opts } if stat.nil?
|
DB[:stats].lock('EXCLUSIVE') { stat = Stat.create opts } if stat.nil?
|
||||||
|
|
||||||
DB[
|
DB[
|
||||||
'update stats set hits=hits+?, views=views+?, bandwidth=bandwidth+? where site_id=?',
|
'update stats set hits=hits+?, views=views+?, bandwidth=bandwidth+? where id=?',
|
||||||
site_log[:hits],
|
site_log[:hits],
|
||||||
site_log[:views],
|
site_log[:views],
|
||||||
site_log[:bandwidth],
|
site_log[:bandwidth],
|
||||||
site_log[:id]
|
stat.id
|
||||||
].first
|
].first
|
||||||
|
|
||||||
site_log[:referrers].each do |referrer, views|
|
site_log[:referrers].each do |referrer, views|
|
||||||
|
@ -107,15 +107,6 @@ class Stat < Sequel::Model
|
||||||
FileUtils.rm log_path
|
FileUtils.rm log_path
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_or_create
|
|
||||||
DB[:stats].lock 'EXCLUSIVE' do
|
|
||||||
stat = Stat.where(opts).first
|
|
||||||
stat ||= Stat.new opts
|
|
||||||
stat.hits += site_log[:hits]
|
|
||||||
stat.views += site_log[:views]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue