]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-2727 Display a warning message in the footer when the Derby engine is used
authorSimon Brandhof <simon.brandhof@gmail.com>
Tue, 27 Sep 2011 16:28:20 +0000 (18:28 +0200)
committerSimon Brandhof <simon.brandhof@gmail.com>
Tue, 27 Sep 2011 16:28:20 +0000 (18:28 +0200)
plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties
sonar-server/src/main/webapp/WEB-INF/app/controllers/api/server_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/controllers/setup_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb
sonar-server/src/main/webapp/WEB-INF/lib/database_version.rb
sonar-server/src/main/webapp/stylesheets/style.css

index 39bb4e1b10a03be470717b08e411adcb3f00e54e..73e9f58573e40aba63885b004147a62c1c5dda4c 100644 (file)
@@ -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
index c777559cfc05723986b85a595185e10c85ba83e1..4ec1eab15ba7005573a754bd583149210f4c19f9 100644 (file)
@@ -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
 
index 7f1eb4d9ef8244042377a0e1f0900af415d8917d..381e908e0cf310a96e18953627575f0339c60960 100644 (file)
@@ -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)
index d196fb6cb0c58da1b046103615d914e369c56850..8832d05aec2b35aab6a3dbc0ff7c8b331c9c2edf 100644 (file)
 <% end %>
 <div id="ftlinks">
   <%= message('layout.powered_by') -%> <a href="http://www.sonarsource.com" target="SonarSource" class="external">SonarSource</a> - Open Source <a href="http://www.sonarsource.org/documentation/license/" target="license" class="external">LGPL</a> - v.<%= sonar_version -%> - <a href="http://sonar-plugins.codehaus.org" class="external" target="plugins"><%= message('layout.plugins') -%></a> - <a href="http://sonar.codehaus.org/documentation" class="external" target="sonar_doc" class="external"><%= message('layout.documentation') -%></a> - <a href="http://sonar.codehaus.org/support/" target="support" class="external"><%= message('layout.ask_a_questions') -%></a>
+  <% unless DatabaseVersion.production? %><br/><span class="yellowHighlight" id="evaluation_warning"><%= message('layout.evaluation') -%></span><% end %>
   </div>
 </div>
 <% end %>
index e40d012dda04acd7e47a19aa0468f01a46156304..b4f518ec9c45b83b30d54f7b66774751228514f7 100644 (file)
@@ -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
index 6ebe37498805b3b1f391ea3a6f10d845c07e5732..8b8ebd6585de969300a125403b70f2198f4c3071 100644 (file)
@@ -1936,3 +1936,6 @@ table.nowrap td, td.nowrap {
 .diffParam {
   font-family: 'Bitstream Vera Sans Mono','Courier',monospace;
 }
+.yellowHighlight {
+  background:#FFFBCC;
+}