##// END OF EJS Templates
scm: git: performance improvements in fetching revisions (#8857, #9472)...
scm: git: performance improvements in fetching revisions (#8857, #9472) Parse a revision for a given branch, just if we haven't parsed it for any branches before. Moved the db check to for existing revisions into a grouped search. Search for many revisions at once: this reduces db load. Revisions are grouped into sets of 100. This is to improve memory consumption. There will be just one query instead of each 100. The above two methods significantly increase parsing speed. Test case was a git repo with 6000+ commits on a master branch, and several other branches originating for master. Speed improved from 1.4h to 18min. Contributed by Gergely Fábián. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9144 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r8024:b127f9157d45
r9024:999a4ba30d7b
Show More
custom_fields_controller.rb
78 lines | 2.4 KiB | text/x-ruby | RubyLexer
/ app / controllers / custom_fields_controller.rb
Jean-Philippe Lang
CustomFieldsController#list moved to #index....
r2272 # Redmine - project management software
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/custom_fields_controller.rb....
r6781 # Copyright (C) 2006-2011 Jean-Philippe Lang
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 #
# 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.
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/custom_fields_controller.rb....
r6781 #
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 # 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.
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/custom_fields_controller.rb....
r6781 #
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 # 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 CustomFieldsController < ApplicationController
Jean-Philippe Lang
Adds an admin layout that displays the admin menu in the sidebar....
r3062 layout 'admin'
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/custom_fields_controller.rb....
r6781
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 before_filter :require_admin
Jean-Philippe Lang
Resourcified custom fields....
r8024 before_filter :build_new_custom_field, :only => [:new, :create]
before_filter :find_custom_field, :only => [:edit, :update, :destroy]
Jean-Philippe Lang
0.3 unstable...
r10
Jean-Philippe Lang
Initial commit...
r2 def index
Jean-Philippe Lang
Removed deprecated Object#type in CustomFieldsController....
r612 @custom_fields_by_type = CustomField.find(:all).group_by {|f| f.class.name }
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 @tab = params[:tab] || 'IssueCustomField'
Jean-Philippe Lang
Initial commit...
r2 end
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/custom_fields_controller.rb....
r6781
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 def new
Jean-Philippe Lang
Resourcified custom fields....
r8024 end
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/custom_fields_controller.rb....
r6781
Jean-Philippe Lang
Resourcified custom fields....
r8024 def create
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 if request.post? and @custom_field.save
flash[:notice] = l(:notice_successful_create)
Eric Davis
Added several more plugin hooks:...
r2535 call_hook(:controller_custom_fields_new_after_save, :params => params, :custom_field => @custom_field)
Jean-Philippe Lang
CustomFieldsController#list moved to #index....
r2272 redirect_to :action => 'index', :tab => @custom_field.class.name
Toshi MARUYAMA
Fix potential Execution After Redirect bugs....
r5491 else
Jean-Philippe Lang
Resourcified custom fields....
r8024 render :action => 'new'
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 end
end
def edit
Jean-Philippe Lang
Resourcified custom fields....
r8024 end
def update
if request.put? and @custom_field.update_attributes(params[:custom_field])
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 flash[:notice] = l(:notice_successful_update)
Eric Davis
Added several more plugin hooks:...
r2535 call_hook(:controller_custom_fields_edit_after_save, :params => params, :custom_field => @custom_field)
Jean-Philippe Lang
CustomFieldsController#list moved to #index....
r2272 redirect_to :action => 'index', :tab => @custom_field.class.name
Toshi MARUYAMA
Fix potential Execution After Redirect bugs....
r5491 else
Jean-Philippe Lang
Resourcified custom fields....
r8024 render :action => 'edit'
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 end
end
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/custom_fields_controller.rb....
r6781
Jean-Philippe Lang
Initial commit...
r2 def destroy
Jean-Philippe Lang
Resourcified custom fields....
r8024 @custom_field.destroy
Jean-Philippe Lang
CustomFieldsController#list moved to #index....
r2272 redirect_to :action => 'index', :tab => @custom_field.class.name
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 rescue
Azamat Hackimov
New strings to localization (#5225)...
r3513 flash[:error] = l(:error_can_not_delete_custom_field)
Jean-Philippe Lang
CustomFieldsController#list moved to #index....
r2272 redirect_to :action => 'index'
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 end
Jean-Philippe Lang
Resourcified custom fields....
r8024
private
def build_new_custom_field
@custom_field = CustomField.new_subclass_instance(params[:type], params[:custom_field])
if @custom_field.nil?
render_404
end
end
def find_custom_field
@custom_field = CustomField.find(params[:id])
rescue ActiveRecord::RecordNotFound
render_404
end
Jean-Philippe Lang
Initial commit...
r2 end