]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3876 fail to rename a profile containing quotes on postgresql
authorSimon Brandhof <simon.brandhof@gmail.com>
Fri, 19 Oct 2012 13:04:44 +0000 (15:04 +0200)
committerSimon Brandhof <simon.brandhof@gmail.com>
Fri, 19 Oct 2012 13:05:15 +0000 (15:05 +0200)
sonar-server/src/main/webapp/WEB-INF/app/models/profile.rb
sonar-server/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb

index ca469daa5e0e6c21230d27f39e632b97737f3347..a9eb887503ff41cacb1d0f75946fa12c07fb3aaa 100644 (file)
@@ -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
index 0a650cc918730278fb2bbf2a2c8d80a3c4b5faa2..be5d8b4acbdc21382cd67571b5b4701fe76e21f7 100644 (file)
@@ -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>