mirror of
https://github.com/SonarSource/sonarqube.git
synced 2024-09-13 23:58:00 +02:00
Automatic merge from branch-5.2
* origin/branch-5.2: SONAR-5851 Add back the WS /profiles/export web page
This commit is contained in:
commit
787da65b0d
@ -36,4 +36,25 @@ class ProfilesController < ApplicationController
|
||||
render :action => 'index'
|
||||
end
|
||||
|
||||
# GET /profiles/export?name=<profile name>&language=<language>&format=<exporter key>
|
||||
def export
|
||||
language = params[:language]
|
||||
if params[:name].blank?
|
||||
profile = Internal.qprofile_service.getDefault(language)
|
||||
else
|
||||
profile = Internal.qprofile_loader.getByLangAndName(language, CGI::unescape(params[:name]))
|
||||
end
|
||||
not_found('Profile not found') unless profile
|
||||
|
||||
if params[:format].blank?
|
||||
# standard sonar format
|
||||
result = Internal.qprofile_service.backup(profile.getKee())
|
||||
send_data(result, :type => 'text/xml', :disposition => 'inline')
|
||||
else
|
||||
exporter_key = params[:format]
|
||||
result = Internal.qprofile_exporters.export(profile.getKee(), exporter_key)
|
||||
send_data(result, :type => Internal.qprofile_exporters.mimeType(exporter_key), :disposition => 'inline')
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user