]> git.openstreetmap.org Git - rails.git/commitdiff
Fix problems with database offline mode
authorTom Hughes <tom@compton.nu>
Thu, 23 Jun 2011 07:30:44 +0000 (08:30 +0100)
committerTom Hughes <tom@compton.nu>
Thu, 23 Jun 2011 07:30:44 +0000 (08:30 +0100)
app/controllers/application_controller.rb
app/controllers/diary_entry_controller.rb
app/controllers/trace_controller.rb
app/controllers/user_controller.rb

index 619ef981a61ba8260248368f681b04a6136e246a..655017847b81c34d200aac05d707d204de0c017e 100644 (file)
@@ -4,6 +4,9 @@ class ApplicationController < ActionController::Base
 
   if STATUS == :database_readonly or STATUS == :database_offline
     session :off
+
+    def self.cache_sweeper(*sweepers)
+    end
   end
 
   def authorize_web
index 73e9629e0c43d93be8ab29be411a08df78b2b25a..52ce742bfddf08870ae441e653e7855adb2e9458 100644 (file)
@@ -10,7 +10,7 @@ class DiaryEntryController < ApplicationController
 
   caches_action :list, :view, :layout => false
   caches_action :rss, :layout => true
-  cache_sweeper :diary_sweeper, :only => [:new, :edit, :comment, :hide, :hidecomment], :unless => STATUS == :database_offline
+  cache_sweeper :diary_sweeper, :only => [:new, :edit, :comment, :hide, :hidecomment]
 
   def new
     @title = t 'diary_entry.new.title'
index 2cd3117ddbbe0c9456d46e4d0359544a3d75caaf..52392fdddaa0cdb75cd534064c727a17a92ae805 100644 (file)
@@ -18,8 +18,8 @@ class TraceController < ApplicationController
   caches_action :list, :unless => :logged_in?, :layout => false
   caches_action :view, :layout => false
   caches_action :georss, :layout => true
-  cache_sweeper :trace_sweeper, :only => [:create, :edit, :delete, :api_create, :api_update, :api_delete], :unless => STATUS == :database_offline
-  cache_sweeper :tracetag_sweeper, :only => [:create, :edit, :delete, :api_create, :api_update, :api_delete], :unless => STATUS == :database_offline
+  cache_sweeper :trace_sweeper, :only => [:create, :edit, :delete, :api_create, :api_update, :api_delete]
+  cache_sweeper :tracetag_sweeper, :only => [:create, :edit, :delete, :api_create, :api_update, :api_delete]
 
   # Counts and selects pages of GPX traces for various criteria (by user, tags, public etc.).
   #  target_user - if set, specifies the user to fetch traces for.  if not set will fetch all traces
index b337dc04c6cd8fd50014344c8ec4ae5fdb1b3a73..70328f5a5d637f3f1b6b2116d697692e28caf0c3 100644 (file)
@@ -17,7 +17,7 @@ class UserController < ApplicationController
 
   filter_parameter_logging :password, :pass_crypt, :pass_crypt_confirmation
 
-  cache_sweeper :user_sweeper, :only => [:account, :set_status, :delete], :unless => STATUS == :database_offline
+  cache_sweeper :user_sweeper, :only => [:account, :set_status, :delete]
 
   def terms
     @legale = params[:legale] || OSM.IPToCountry(request.remote_ip) || DEFAULT_LEGALE