MDL-24960 emoticon admin settings: fixed a bug in the upgrade path
authorDavid Mudrak <david.mudrak@gmail.com>
Mon, 1 Nov 2010 09:35:57 +0000 (09:35 +0000)
committerDavid Mudrak <david.mudrak@gmail.com>
Mon, 1 Nov 2010 09:35:57 +0000 (09:35 +0000)
I forgot to unset the $CFG->emoticon from the memory so the upgrade
process still had the old emoticons format loaded in the memory which
led to coding exception.

lib/adminlib.php
lib/db/upgrade.php

index 4d5806a..b8f2c4f 100644 (file)
@@ -3230,13 +3230,18 @@ class admin_setting_emoticons extends admin_setting {
         global $CFG;
 
         $manager = get_emoticon_manager();
+
         $config = $this->config_read($this->name);
+        if (is_null($config)) {
+            return null;
+        }
 
+        $config = $manager->decode_stored_config($config);
         if (is_null($config)) {
             return null;
         }
 
-        return $this->prepare_form_data($manager->decode_stored_config($config));
+        return $this->prepare_form_data($config);
     }
 
     /**
index 1befad6..bf2d1bd 100644 (file)
@@ -5312,6 +5312,7 @@ WHERE gradeitemid IS NOT NULL AND grademax IS NOT NULL");
 
     // new format of the emoticons setting
     if ($oldversion < 2010102300) {
+        unset($CFG->emoticons);
         $DB->delete_records('config', array('name' => 'emoticons'));
         $DB->delete_records('cache_text'); // changed md5 hash calculation
         upgrade_main_savepoint(true, 2010102300);