]> git.openstreetmap.org Git - rails.git/blob - script/cleanup
Add migration to add an index on node_id to way_nodes. This index was added
[rails.git] / script / cleanup
1 #!/usr/bin/env ruby
2
3 require File.dirname(__FILE__) + '/../config/environment'
4
5 Session.find(:all, :conditions => ["updated_at < ?", 1.week.ago]).each do |session|
6   begin
7     if session[:user] and User.find(session[:user])
8       session.destroy if session.updated_at < 1.month.ago
9     else
10       session.destroy
11     end
12   rescue Exception => ex
13     puts "Invalid session #{session.session_id}: #{ex.to_s}"
14     session.destroy
15   end
16 end
17
18 UserToken.delete_all("expiry < NOW()")