aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGodin <mandrikov@gmail.com>2010-11-01 12:23:25 +0000
committerGodin <mandrikov@gmail.com>2010-11-01 12:23:25 +0000
commit1c0ac2bb59883dfde703e39459fd7eddd511d8cf (patch)
tree578b64d39e2ec1f977aa5728e6edc14a49a2768a
parentda5b28d212bd2baad3b32c2c2e0085920c438d72 (diff)
downloadsonarqube-1c0ac2bb59883dfde703e39459fd7eddd511d8cf.tar.gz
sonarqube-1c0ac2bb59883dfde703e39459fd7eddd511d8cf.zip
SONAR-1913: Add a property to deactivate Update Center
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/updatecenter_controller.rb8
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb5
2 files changed, 12 insertions, 1 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/updatecenter_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/updatecenter_controller.rb
index ecb22671e69..be17f0b9b4c 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/updatecenter_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/updatecenter_controller.rb
@@ -21,6 +21,7 @@ class UpdatecenterController < ApplicationController
SECTION=Navigation::SECTION_CONFIGURATION
before_filter :admin_required
+ before_filter :updatecenter_activated
verify :method => :post, :only => [:cancel, :install], :redirect_to => {:action => :index}
@@ -121,4 +122,11 @@ class UpdatecenterController < ApplicationController
def load_update_finder
@finder=java_facade.getUpdateFinder(params[:reload]=='true')
end
+
+ def updatecenter_activated
+ update_center_activated = java_facade.getConfigurationValue('sonar.updatecenter') || 'true';
+ if update_center_activated!='true'
+ redirect_to home_url
+ end
+ end
end
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb
index fdbe7690402..a617eaec873 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb
@@ -76,7 +76,10 @@
<li class="<%= 'selected' if request.request_uri.include?('/settings') -%>"><a href="<%= ApplicationController.root_context -%>/settings/index">Settings</a></li>
<li class="<%= 'selected' if controller.controller_path=='backup' -%>"><a href="<%= ApplicationController.root_context -%>/backup">Backup</a></li>
<li class="<%= 'selected' if controller.controller_path=='system' -%>"><a href="<%= ApplicationController.root_context -%>/system">System info</a></li>
- <li class="<%= 'selected' if controller.controller_path=='updatecenter' -%>"><a href="<%= ApplicationController.root_context -%>/updatecenter">Upgrades (BETA)</a></li>
+ <% update_center_activated = controller.java_facade.getConfigurationValue('sonar.updatecenter') || 'true';
+ if update_center_activated=='true' %>
+ <li class="<%= 'selected' if controller.controller_path=='updatecenter' -%>"><a href="<%= ApplicationController.root_context -%>/updatecenter">Upgrades (BETA)</a></li>
+ <% end %>
<% end %>
<% end %>