diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2012-10-19 15:04:44 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2012-10-19 15:04:44 +0200 |
commit | 57cd995070325b9efef7956b5d2c568d4b663b92 (patch) | |
tree | a0e61d7f8a6c84e63ecd07463b4d92267c453abb /sonar-server | |
parent | adacc6073e309ab22991f0185ccd4055bceb6b2f (diff) | |
download | sonarqube-57cd995070325b9efef7956b5d2c568d4b663b92.tar.gz sonarqube-57cd995070325b9efef7956b5d2c568d4b663b92.zip |
SONAR-3876 fail to rename a profile containing quotes on postgresql
Diffstat (limited to 'sonar-server')
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/app/models/profile.rb | 9 | ||||
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb | 2 |
2 files changed, 7 insertions, 4 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/profile.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/profile.rb index ca469daa5e0..a9eb887503f 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/profile.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/profile.rb @@ -169,9 +169,12 @@ class Profile < ActiveRecord::Base child.parent_name=new_name child.save end - # PROPERTIES.TEXT_VALUE is CLOB but not VARCHAR. The operator '=' is supported by all the databases except Oracle. For this reason 'like' must be used. - # Repeat avec me : Oracle rocks. - Property.update_all({:text_value => new_name}, ['prop_key=? and text_value like ?', "sonar.profile.#{language}", old_name]) + Property.with_key("sonar.profile.#{language}").each do |prop| + if prop.text_value==old_name + prop.text_value=new_name + prop.save + end + end end end self diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb index 1189d89009f..0bd3305bdf9 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb @@ -49,7 +49,7 @@ </td> <td align="right" width="10%"> - <span id="activated_rules_<%= u profile.key -%>"><%= profile.active_rules.count -%></span> + <span id="activated_rules_<%= u profile.key -%>"><%= profile.count_active_rules -%></span> </td> <td align="right" width="10%"><span id="alerts_<%= u profile.key -%>"><%= profile.alerts.size -%></span></td> |