MDL-39910 SCORM: set correct site level defaults.
authorDan Marsden <dan@danmarsden.com>
Thu, 26 Sep 2013 09:03:00 +0000 (21:03 +1200)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Thu, 26 Sep 2013 09:36:44 +0000 (11:36 +0200)
mod/scorm/db/upgrade.php

index 13ac724..ca0fb75 100644 (file)
@@ -160,14 +160,16 @@ function xmldb_scorm_upgrade($oldversion) {
             $dbman->drop_field($table, $field);
         }
 
-        $params = array('plugin' => 'scorm', 'name' => 'hidenav');
-        if ($DB->record_exists('config_plugins', $params)) {
-            $DB->delete_records('config_plugins', $params);
-        }
-        $params = array('plugin' => 'scorm', 'name' => 'hidenav_adv');
-        if ($DB->record_exists('config_plugins', $params)) {
-            $DB->delete_records('config_plugins', $params);
+        $hide = get_config('hidenav', 'scorm');
+        unset_config('hidenav', 'mod_scorm');
+        if (!empty($hide)) {
+            set_config('nav', SCORM_NAV_DISABLED, 'mod_scorm');
         }
+
+        $hideadv = get_config('hidenav_adv', 'scorm');
+        unset_config('hidenav_adv', 'mod_scorm');
+        set_config('nav_adv', $hideadv, 'mod_scorm');
+
         upgrade_mod_savepoint(true, 2013090100, 'scorm');
     }