From 59a49a6ef5e5f0e287a1974b1abecc96e4b13709 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Thu, 23 Jun 2011 08:30:44 +0100 Subject: [PATCH 1/1] Fix problems with database offline mode --- app/controllers/application_controller.rb | 3 +++ app/controllers/diary_entry_controller.rb | 2 +- app/controllers/trace_controller.rb | 4 ++-- app/controllers/user_controller.rb | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 619ef981a..655017847 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -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 diff --git a/app/controllers/diary_entry_controller.rb b/app/controllers/diary_entry_controller.rb index 73e9629e0..52ce742bf 100644 --- a/app/controllers/diary_entry_controller.rb +++ b/app/controllers/diary_entry_controller.rb @@ -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' diff --git a/app/controllers/trace_controller.rb b/app/controllers/trace_controller.rb index 2cd3117dd..52392fddd 100644 --- a/app/controllers/trace_controller.rb +++ b/app/controllers/trace_controller.rb @@ -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 diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index b337dc04c..70328f5a5 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -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 -- 2.43.2