Merge branch 'master_MDL-44938' of git://github.com/danmarsden/moodle
[moodle.git] / mod / scorm / db / upgrade.php
index 37f3b20..62321c6 100644 (file)
@@ -203,7 +203,30 @@ function xmldb_scorm_upgrade($oldversion) {
         upgrade_mod_savepoint(true, 2013110501, 'scorm');
     }
 
-    if ($oldversion < 2014021700) {
+    if ($oldversion < 2014031700) {
+        // Define field displayactivityname to be added to scorm.
+        $table = new xmldb_table('scorm');
+        $field = new xmldb_field(
+            'displayactivityname',
+            XMLDB_TYPE_INTEGER,
+            '4',
+            null,
+            XMLDB_NOTNULL,
+            null,
+            '1',
+            'completionscorerequired'
+        );
+
+        // Conditionally launch add field displayactivityname.
+        if (!$dbman->field_exists($table, $field)) {
+            $dbman->add_field($table, $field);
+        }
+
+        // Scorm savepoint reached.
+        upgrade_mod_savepoint(true, 2014031700, 'scorm');
+    }
+
+    if ($oldversion < 2014040200) {
         // Fix invalid $scorm->launch records that launch an org sco instead of a real sco.
         $sql = "SELECT s.*, c.identifier
                  FROM {scorm} s
@@ -250,30 +273,7 @@ function xmldb_scorm_upgrade($oldversion) {
         }
         $scorms->close();
 
-        upgrade_mod_savepoint(true, 2014021700, 'scorm');
-    }
-
-    if ($oldversion < 2014031700) {
-        // Define field displayactivityname to be added to scorm.
-        $table = new xmldb_table('scorm');
-        $field = new xmldb_field(
-            'displayactivityname',
-            XMLDB_TYPE_INTEGER,
-            '4',
-            null,
-            XMLDB_NOTNULL,
-            null,
-            '1',
-            'completionscorerequired'
-        );
-
-        // Conditionally launch add field displayactivityname.
-        if (!$dbman->field_exists($table, $field)) {
-            $dbman->add_field($table, $field);
-        }
-
-        // Scorm savepoint reached.
-        upgrade_mod_savepoint(true, 2014031700, 'scorm');
+        upgrade_mod_savepoint(true, 2014040200, 'scorm');
     }
 
     return true;