From a798a1ac4dc75f5fc64ea7a1e7808fb798f12f97 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 16 Feb 2008 18:28:46 +0000 Subject: [PATCH] Removed fragment caching on gantt and calendar. git-svn-id: http://redmine.rubyforge.org/svn/trunk@1157 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/issues_controller.rb | 2 -- app/controllers/projects_controller.rb | 3 -- app/controllers/versions_controller.rb | 2 -- app/sweepers/issue_sweeper.rb | 38 ------------------------ app/sweepers/project_sweeper.rb | 40 -------------------------- app/sweepers/version_sweeper.rb | 34 ---------------------- app/views/projects/calendar.rhtml | 2 -- app/views/projects/gantt.rhtml | 5 ---- 8 files changed, 126 deletions(-) delete mode 100644 app/sweepers/issue_sweeper.rb delete mode 100644 app/sweepers/project_sweeper.rb delete mode 100644 app/sweepers/version_sweeper.rb diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index b0e82d365..8b3cc339d 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -25,8 +25,6 @@ class IssuesController < ApplicationController before_filter :authorize, :except => [:index, :changes, :preview, :update_form, :context_menu] before_filter :find_optional_project, :only => [:index, :changes] accept_key_auth :index, :changes - - cache_sweeper :issue_sweeper, :only => [ :new, :edit, :bulk_edit, :destroy ] helper :journals helper :projects diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index cddfb6f81..a3eac71ab 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -29,9 +29,6 @@ class ProjectsController < ApplicationController before_filter :require_admin, :only => [ :add, :archive, :unarchive, :destroy ] accept_key_auth :activity, :calendar - cache_sweeper :project_sweeper, :only => [ :add, :edit, :archive, :unarchive, :destroy ] - cache_sweeper :version_sweeper, :only => [ :add_version ] - helper :sort include SortHelper helper :custom_fields diff --git a/app/controllers/versions_controller.rb b/app/controllers/versions_controller.rb index 55b3a7fce..aeb802ccb 100644 --- a/app/controllers/versions_controller.rb +++ b/app/controllers/versions_controller.rb @@ -20,8 +20,6 @@ class VersionsController < ApplicationController menu_item :roadmap before_filter :find_project, :authorize - cache_sweeper :version_sweeper, :only => [ :edit, :destroy ] - def show end diff --git a/app/sweepers/issue_sweeper.rb b/app/sweepers/issue_sweeper.rb deleted file mode 100644 index dc9020535..000000000 --- a/app/sweepers/issue_sweeper.rb +++ /dev/null @@ -1,38 +0,0 @@ -# redMine - project management software -# Copyright (C) 2006-2007 Jean-Philippe Lang -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -class IssueSweeper < ActionController::Caching::Sweeper - observe Issue - - def after_save(issue) - expire_cache_for(issue) - end - - def after_destroy(issue) - expire_cache_for(issue) - end - -private - def expire_cache_for(issue) - # fragments of the main project - expire_fragment(Regexp.new("projects/(calendar|gantt)/#{issue.project_id}\\.")) - # fragments of the root project that include subprojects issues - unless issue.project.parent_id.nil? - expire_fragment(Regexp.new("projects/(calendar|gantt)/#{issue.project.parent_id}\\..*subprojects")) - end - end -end diff --git a/app/sweepers/project_sweeper.rb b/app/sweepers/project_sweeper.rb deleted file mode 100644 index f64f6f564..000000000 --- a/app/sweepers/project_sweeper.rb +++ /dev/null @@ -1,40 +0,0 @@ -# redMine - project management software -# Copyright (C) 2006-2007 Jean-Philippe Lang -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -class ProjectSweeper < ActionController::Caching::Sweeper - observe Project - - def before_save(project) - if project.new_record? - expire_cache_for(project.parent) if project.parent - else - project_before_update = Project.find(project.id) - return if project_before_update.parent_id == project.parent_id && project_before_update.status == project.status - expire_cache_for(project.parent) if project.parent - expire_cache_for(project_before_update.parent) if project_before_update.parent - end - end - - def after_destroy(project) - expire_cache_for(project.parent) if project.parent - end - -private - def expire_cache_for(project) - expire_fragment(Regexp.new("projects/(calendar|gantt)/#{project.id}\\.")) - end -end diff --git a/app/sweepers/version_sweeper.rb b/app/sweepers/version_sweeper.rb deleted file mode 100644 index e1323e261..000000000 --- a/app/sweepers/version_sweeper.rb +++ /dev/null @@ -1,34 +0,0 @@ -# redMine - project management software -# Copyright (C) 2006-2007 Jean-Philippe Lang -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -class VersionSweeper < ActionController::Caching::Sweeper - observe Version - - def after_save(version) - expire_cache_for(version) - end - - def after_destroy(version) - expire_cache_for(version) - end - -private - def expire_cache_for(version) - # calendar and gantt fragments of the project - expire_fragment(Regexp.new("projects/(calendar|gantt)/#{version.project_id}\\.")) - end -end diff --git a/app/views/projects/calendar.rhtml b/app/views/projects/calendar.rhtml index 3214d7b06..a2af3e2bb 100644 --- a/app/views/projects/calendar.rhtml +++ b/app/views/projects/calendar.rhtml @@ -1,4 +1,3 @@ -<% cache(:year => @year, :month => @month, :tracker_ids => @selected_tracker_ids, :subprojects => params[:with_subprojects], :lang => current_language) do %>

<%= "#{month_name(@month)} #{@year}" %>

@@ -20,7 +19,6 @@ <%= image_tag 'arrow_from.png' %>  <%= l(:text_tip_task_begin_day) %>
<%= image_tag 'arrow_to.png' %>  <%= l(:text_tip_task_end_day) %>
<%= image_tag 'arrow_bw.png' %>  <%= l(:text_tip_task_begin_end_day) %>
-<% end %> <% content_for :sidebar do %>

<%= l(:label_calendar) %>

diff --git a/app/views/projects/gantt.rhtml b/app/views/projects/gantt.rhtml index 0e252aeae..ece776699 100644 --- a/app/views/projects/gantt.rhtml +++ b/app/views/projects/gantt.rhtml @@ -55,8 +55,6 @@ t_height = g_height + headers_height
<% end %> -<% cache(:year => @year_from, :month => @month_from, :months => @months, :zoom => @zoom, :tracker_ids => @selected_tracker_ids, :subprojects => params[:with_subprojects], :lang => current_language) do %> -
@@ -205,9 +203,6 @@ top = headers_height + 10 <% top = top + 20 end %> -<% end # cache -%> - <% # # Today red line (excluded from cache) -- 2.39.5