diff options
Diffstat (limited to 'sonar-server')
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/app/controllers/api/server_controller.rb | 12 |
1 files changed, 12 insertions, 0 deletions
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 65a4dbe41fb..f50ec79f4fa 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 @@ -32,6 +32,7 @@ class Api::ServerController < Api::ApiController def index hash={:id => Java::OrgSonarServerPlatform::Platform.getServer().getId(), :version => Java::OrgSonarServerPlatform::Platform.getServer().getVersion()} + complete_with_status(hash) respond_to do |format| format.json{ render :json => jsonp(hash) } format.xml { render :xml => hash.to_xml(:skip_types => true, :root => 'server') } @@ -67,4 +68,15 @@ class Api::ServerController < Api::ApiController end hash end + + def complete_with_status(hash) + if DatabaseVersion.uptodate? + hash[:status]='UP' + elsif ActiveRecord::Base.connected? + hash[:status]='SETUP' + else + hash[:status]='DOWN' + hash[:status_msg]='Not connected to database' + end + end end |