From 0c9281e82140f3a69e4473b3bcefd5ccebd79e2d Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Sun, 8 Jun 2008 22:11:08 -0500 Subject: Drop ActionController::Base.allow_concurrency flag --- actionpack/lib/action_controller/base.rb | 7 ------- 1 file changed, 7 deletions(-) (limited to 'actionpack/lib/action_controller') diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index a036600c2b..44269fc735 100755 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -283,13 +283,6 @@ module ActionController #:nodoc: @@debug_routes = true cattr_accessor :debug_routes - # Indicates to Mongrel or Webrick whether to allow concurrent action - # processing. Your controller actions and any other code they call must - # also behave well when called from concurrent threads. Turned off by - # default. - @@allow_concurrency = false - cattr_accessor :allow_concurrency - # Modern REST web services often need to submit complex data to the web application. # The @@param_parsers hash lets you register handlers which will process the HTTP body and add parameters to the # params hash. These handlers are invoked for POST and PUT requests. -- cgit v1.2.3 From df44df945d6315238e7d94d9bdef82e435dc9b24 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Sun, 8 Jun 2008 22:31:54 -0500 Subject: Ensure ActionView::TemplateFinder view cache is rebuilt on initialize. --- actionpack/lib/action_controller/dispatcher.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'actionpack/lib/action_controller') diff --git a/actionpack/lib/action_controller/dispatcher.rb b/actionpack/lib/action_controller/dispatcher.rb index fe4f6b4a7e..64553fb25d 100644 --- a/actionpack/lib/action_controller/dispatcher.rb +++ b/actionpack/lib/action_controller/dispatcher.rb @@ -10,6 +10,10 @@ module ActionController # Development mode callbacks before_dispatch :reload_application after_dispatch :cleanup_application + + to_prepare :reload_view_path_cache do + ActionView::TemplateFinder.reload! unless ActionView::Base.cache_template_loading + end end # Common callbacks @@ -134,7 +138,6 @@ module ActionController run_callbacks :prepare_dispatch Routing::Routes.reload - ActionView::TemplateFinder.reload! unless ActionView::Base.cache_template_loading end # Cleanup the application by clearing out loaded classes so they can -- cgit v1.2.3 From 19895f087c338d8385dff9d272d30fb87cb10330 Mon Sep 17 00:00:00 2001 From: Pratik Naik Date: Tue, 10 Jun 2008 10:29:25 +0100 Subject: Lazy load cache and session stores --- actionpack/lib/action_controller/session_management.rb | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'actionpack/lib/action_controller') diff --git a/actionpack/lib/action_controller/session_management.rb b/actionpack/lib/action_controller/session_management.rb index 80a3ddd2c5..ad1013b379 100644 --- a/actionpack/lib/action_controller/session_management.rb +++ b/actionpack/lib/action_controller/session_management.rb @@ -1,10 +1,3 @@ -require 'action_controller/session/cookie_store' -require 'action_controller/session/drb_store' -require 'action_controller/session/mem_cache_store' -if Object.const_defined?(:ActiveRecord) - require 'action_controller/session/active_record_store' -end - module ActionController #:nodoc: module SessionManagement #:nodoc: def self.included(base) @@ -22,6 +15,8 @@ module ActionController #:nodoc: # :p_store, :drb_store, :mem_cache_store, or # :memory_store) or your own custom class. def session_store=(store) + require "action_controller/session/#{store.to_s}" if [:active_record_store, :drb_store, :mem_cache_store].include?(store) + ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS[:database_manager] = store.is_a?(Symbol) ? CGI::Session.const_get(store == :drb_store ? "DRbStore" : store.to_s.camelize) : store end -- cgit v1.2.3 From e8a0ba4c93e2f0f811675bc6a6720725c866d1a5 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Tue, 10 Jun 2008 20:38:18 -0500 Subject: Ensure view path cache is rebuilt in production mode which was broke by df44df9. --- actionpack/lib/action_controller/dispatcher.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'actionpack/lib/action_controller') diff --git a/actionpack/lib/action_controller/dispatcher.rb b/actionpack/lib/action_controller/dispatcher.rb index 64553fb25d..f20d9cc40f 100644 --- a/actionpack/lib/action_controller/dispatcher.rb +++ b/actionpack/lib/action_controller/dispatcher.rb @@ -10,10 +10,6 @@ module ActionController # Development mode callbacks before_dispatch :reload_application after_dispatch :cleanup_application - - to_prepare :reload_view_path_cache do - ActionView::TemplateFinder.reload! unless ActionView::Base.cache_template_loading - end end # Common callbacks @@ -25,6 +21,10 @@ module ActionController end end + to_prepare :reload_view_path_cache do + ActionView::TemplateFinder.reload! + end + if defined?(ActiveRecord) before_dispatch { ActiveRecord::Base.verify_active_connections! } to_prepare(:activerecord_instantiate_observers) { ActiveRecord::Base.instantiate_observers } -- cgit v1.2.3 From f728e57d2204a429f5282856ec89d4e047e72957 Mon Sep 17 00:00:00 2001 From: Pratik Naik Date: Wed, 11 Jun 2008 09:11:08 +0100 Subject: Make sure cache_template_loading works and don't use to_prepare callback --- actionpack/lib/action_controller/dispatcher.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'actionpack/lib/action_controller') diff --git a/actionpack/lib/action_controller/dispatcher.rb b/actionpack/lib/action_controller/dispatcher.rb index f20d9cc40f..fe4f6b4a7e 100644 --- a/actionpack/lib/action_controller/dispatcher.rb +++ b/actionpack/lib/action_controller/dispatcher.rb @@ -21,10 +21,6 @@ module ActionController end end - to_prepare :reload_view_path_cache do - ActionView::TemplateFinder.reload! - end - if defined?(ActiveRecord) before_dispatch { ActiveRecord::Base.verify_active_connections! } to_prepare(:activerecord_instantiate_observers) { ActiveRecord::Base.instantiate_observers } @@ -138,6 +134,7 @@ module ActionController run_callbacks :prepare_dispatch Routing::Routes.reload + ActionView::TemplateFinder.reload! unless ActionView::Base.cache_template_loading end # Cleanup the application by clearing out loaded classes so they can -- cgit v1.2.3 From 3e07f320c10b53ec21b947d949d0063e724c5fd8 Mon Sep 17 00:00:00 2001 From: Jonathan del Strother Date: Thu, 6 Mar 2008 11:50:44 +0000 Subject: Improve ActionCaching's format-handling Make ActionCaching more aware of different mimetype formats. It will now use request.format to look up the cache type, in addition to the path extension. When expiring caches, the request format no longer affects which cache is expired. Signed-off-by: Pratik Naik --- .../lib/action_controller/caching/actions.rb | 41 +++++++++++++++------- 1 file changed, 29 insertions(+), 12 deletions(-) (limited to 'actionpack/lib/action_controller') diff --git a/actionpack/lib/action_controller/caching/actions.rb b/actionpack/lib/action_controller/caching/actions.rb index c4b0a97a33..65a36f7f98 100644 --- a/actionpack/lib/action_controller/caching/actions.rb +++ b/actionpack/lib/action_controller/caching/actions.rb @@ -67,10 +67,10 @@ module ActionController #:nodoc: if options[:action].is_a?(Array) options[:action].dup.each do |action| - expire_fragment(ActionCachePath.path_for(self, options.merge({ :action => action }))) + expire_fragment(ActionCachePath.path_for(self, options.merge({ :action => action }), false)) end else - expire_fragment(ActionCachePath.path_for(self, options)) + expire_fragment(ActionCachePath.path_for(self, options, false)) end end @@ -125,16 +125,24 @@ module ActionController #:nodoc: attr_reader :path, :extension class << self - def path_for(controller, options) - new(controller, options).path + def path_for(controller, options, infer_extension=true) + new(controller, options, infer_extension).path end end - - def initialize(controller, options = {}) - @extension = extract_extension(controller.request.path) + + # When true, infer_extension will look up the cache path extension from the request's path & format. + # This is desirable when reading and writing the cache, but not when expiring the cache - expire_action should expire the same files regardless of the request format. + def initialize(controller, options = {}, infer_extension=true) + if infer_extension and options.is_a? Hash + request_extension = extract_extension(controller.request) + options = options.reverse_merge(:format => request_extension) + end path = controller.url_for(options).split('://').last normalize!(path) - add_extension!(path, @extension) + if infer_extension + @extension = request_extension + add_extension!(path, @extension) + end @path = URI.unescape(path) end @@ -144,13 +152,22 @@ module ActionController #:nodoc: end def add_extension!(path, extension) - path << ".#{extension}" if extension + path << ".#{extension}" if extension and !path.ends_with?(extension) end - - def extract_extension(file_path) + + def extract_extension(request) # Don't want just what comes after the last '.' to accommodate multi part extensions # such as tar.gz. - file_path[/^[^.]+\.(.+)$/, 1] + extension = request.path[/^[^.]+\.(.+)$/, 1] + + # If there's no extension in the path, check request.format + if extension.nil? + extension = request.format.to_sym.to_s + if extension=='all' + extension = nil + end + end + extension end end end -- cgit v1.2.3 From 6573f6a4bc1c2ebd26e0b4b3ef9fe1cde3219354 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Thu, 12 Jun 2008 19:52:33 -0500 Subject: Revert "Lazy load cache and session stores" This reverts commit 19895f087c338d8385dff9d272d30fb87cb10330. --- actionpack/lib/action_controller/session_management.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'actionpack/lib/action_controller') diff --git a/actionpack/lib/action_controller/session_management.rb b/actionpack/lib/action_controller/session_management.rb index ad1013b379..80a3ddd2c5 100644 --- a/actionpack/lib/action_controller/session_management.rb +++ b/actionpack/lib/action_controller/session_management.rb @@ -1,3 +1,10 @@ +require 'action_controller/session/cookie_store' +require 'action_controller/session/drb_store' +require 'action_controller/session/mem_cache_store' +if Object.const_defined?(:ActiveRecord) + require 'action_controller/session/active_record_store' +end + module ActionController #:nodoc: module SessionManagement #:nodoc: def self.included(base) @@ -15,8 +22,6 @@ module ActionController #:nodoc: # :p_store, :drb_store, :mem_cache_store, or # :memory_store) or your own custom class. def session_store=(store) - require "action_controller/session/#{store.to_s}" if [:active_record_store, :drb_store, :mem_cache_store].include?(store) - ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS[:database_manager] = store.is_a?(Symbol) ? CGI::Session.const_get(store == :drb_store ? "DRbStore" : store.to_s.camelize) : store end -- cgit v1.2.3 From eea4fe4c902e71249d77b3103eade3dec905f98a Mon Sep 17 00:00:00 2001 From: Pratik Naik Date: Fri, 13 Jun 2008 23:23:44 +0100 Subject: Make rescue template xhtml compatible [Sam Ruby] [#415 status:resolved] --- actionpack/lib/action_controller/templates/rescues/layout.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack/lib/action_controller') diff --git a/actionpack/lib/action_controller/templates/rescues/layout.erb b/actionpack/lib/action_controller/templates/rescues/layout.erb index d38f3e67f9..4a04742e40 100644 --- a/actionpack/lib/action_controller/templates/rescues/layout.erb +++ b/actionpack/lib/action_controller/templates/rescues/layout.erb @@ -1,4 +1,4 @@ - + Action Controller: Exception caught