summaryrefslogtreecommitdiffstats
path: root/app/controllers/sys_controller.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-11-28 16:50:26 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-11-28 16:50:26 +0000
commit3d317a435bb435b2ec8d2c6bc6ef3791dfcc080b (patch)
treea79efd76aa33eb06520f68ae2d984d38f934f4e7 /app/controllers/sys_controller.rb
parent4c2264ee42eceeedc4787b9f3736b0bd19880d7a (diff)
downloadredmine-3d317a435bb435b2ec8d2c6bc6ef3791dfcc080b.tar.gz
redmine-3d317a435bb435b2ec8d2c6bc6ef3791dfcc080b.zip
Adds an action to SysController to fetch changesets of one or all projects (#2925).
Exemples: * /sys/fetch_changesets (=> fetches changesets for all active projects) * /sys/fetch_changeseys?id=foo (=> fetches changesets for project foo only) git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3107 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/sys_controller.rb')
-rw-r--r--app/controllers/sys_controller.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/controllers/sys_controller.rb b/app/controllers/sys_controller.rb
index da4b119a7..5e74192a9 100644
--- a/app/controllers/sys_controller.rb
+++ b/app/controllers/sys_controller.rb
@@ -37,6 +37,23 @@ class SysController < ActionController::Base
end
end
end
+
+ def fetch_changesets
+ projects = []
+ if params[:id]
+ projects << Project.active.has_module(:repository).find(params[:id])
+ else
+ projects = Project.active.has_module(:repository).find(:all, :include => :repository)
+ end
+ projects.each do |project|
+ if project.repository
+ project.repository.fetch_changesets
+ end
+ end
+ render :nothing => true, :status => 200
+ rescue ActiveRecord::RecordNotFound
+ render :nothing => true, :status => 404
+ end
protected