MDL-29406 fix greedy config settings cleanup
authorPetr Skoda <commits@skodak.org>
Sat, 17 Sep 2011 11:36:22 +0000 (13:36 +0200)
committerPetr Skoda <commits@skodak.org>
Sat, 17 Sep 2011 11:36:22 +0000 (13:36 +0200)
lib/moodlelib.php

index 52064ad..eb6be58 100644 (file)
@@ -1308,7 +1308,9 @@ function unset_config($name, $plugin=NULL) {
 function unset_all_config_for_plugin($plugin) {
     global $DB;
     $DB->delete_records('config_plugins', array('plugin' => $plugin));
-    $DB->delete_records_select('config', 'name LIKE ?', array($plugin . '_%'));
+    $like = $DB->sql_like('name', '?', true, true, false, '|');
+    $params = array($DB->sql_like_escape($plugin.'_', '|') . '%');
+    $DB->delete_records_select('config', $like, $params);
     return true;
 }