From bc668fb7f2cc9e9f9d10125f64e740dc7af499c6 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Tue, 27 Sep 2011 18:28:20 +0200 Subject: [PATCH] SONAR-2727 Display a warning message in the footer when the Derby engine is used --- .../main/resources/org/sonar/l10n/core.properties | 1 + .../WEB-INF/app/controllers/api/server_controller.rb | 2 +- .../WEB-INF/app/controllers/setup_controller.rb | 4 ++-- .../WEB-INF/app/views/layouts/_layout.html.erb | 1 + .../src/main/webapp/WEB-INF/lib/database_version.rb | 12 +++++++++--- sonar-server/src/main/webapp/stylesheets/style.css | 3 +++ 6 files changed, 17 insertions(+), 6 deletions(-) diff --git a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties index 39bb4e1b10a..73e9f58573e 100644 --- a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties +++ b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties @@ -251,6 +251,7 @@ layout.powered_by=Powered by layout.documentation=Documentation layout.ask_a_questions=Ask a question layout.plugins=Plugins +layout.evaluation=Embedded database should be used for evaluation purpose only sidebar.project_settings=Configuration sidebar.security=Security diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/server_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/server_controller.rb index c777559cfc0..4ec1eab15ba 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/server_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/server_controller.rb @@ -66,7 +66,7 @@ class Api::ServerController < Api::ApiController def setup begin - if !DatabaseVersion.upgradable? + if !DatabaseVersion.production? raise "Upgrade is not supported. Please use a production-ready database." end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/setup_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/setup_controller.rb index 7f1eb4d9ef8..381e908e0cf 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/setup_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/setup_controller.rb @@ -28,7 +28,7 @@ class SetupController < ApplicationController if DatabaseVersion.uptodate? redirect_to home_path elsif ActiveRecord::Base.connected? - render :template => (DatabaseVersion.upgradable? ? 'setup/form' : 'setup/not_upgradable'), :layout => 'nonav' + render :template => (DatabaseVersion.production? ? 'setup/form' : 'setup/not_upgradable'), :layout => 'nonav' else render :template => 'setup/dbdown', :layout => 'nonav' end @@ -39,7 +39,7 @@ class SetupController < ApplicationController end def setup_database - if !DatabaseVersion.upgradable? + if !DatabaseVersion.production? render :text => 'Upgrade is not supported. Please use a production-ready database.', :status => 500 else # do not forget that this code is also in /api/server/setup (see api/server_controller.rb) 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 d196fb6cb0c..8832d05aec2 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 @@ -125,6 +125,7 @@ <% end %> <% end %> diff --git a/sonar-server/src/main/webapp/WEB-INF/lib/database_version.rb b/sonar-server/src/main/webapp/WEB-INF/lib/database_version.rb index e40d012dda0..b4f518ec9c4 100644 --- a/sonar-server/src/main/webapp/WEB-INF/lib/database_version.rb +++ b/sonar-server/src/main/webapp/WEB-INF/lib/database_version.rb @@ -70,6 +70,9 @@ class DatabaseVersion end def self.automatic_setup + if !production? + puts 'Derby database should be used for evaluation purpose only' + end if current_version<=0 try_restore_structure_dump() if use_structure_dump? upgrade_and_start() @@ -77,7 +80,7 @@ class DatabaseVersion if uptodate? load_plugin_webservices() else - puts "Server must be upgraded. Please browse /setup" + puts 'Server must be upgraded. Please browse /setup' end uptodate? end @@ -120,7 +123,10 @@ class DatabaseVersion ::Java::OrgSonarServerUi::JRubyFacade.getInstance().getConfigurationValue('sonar.useStructureDump')!='false' end - def self.upgradable? - dialect()!='derby' + def self.production? + @@production ||= + begin + dialect()!='derby' + end end end \ No newline at end of file diff --git a/sonar-server/src/main/webapp/stylesheets/style.css b/sonar-server/src/main/webapp/stylesheets/style.css index 6ebe3749880..8b8ebd6585d 100644 --- a/sonar-server/src/main/webapp/stylesheets/style.css +++ b/sonar-server/src/main/webapp/stylesheets/style.css @@ -1936,3 +1936,6 @@ table.nowrap td, td.nowrap { .diffParam { font-family: 'Bitstream Vera Sans Mono','Courier',monospace; } +.yellowHighlight { + background:#FFFBCC; +} -- 2.39.5