mod-scorm MDL-25792 Changed forcecompleted to have lenght 1 and bumbed version number
authorSam Hemelryk <sam@moodle.com>
Fri, 14 Jan 2011 03:09:59 +0000 (11:09 +0800)
committerSam Hemelryk <sam@moodle.com>
Fri, 14 Jan 2011 03:09:59 +0000 (11:09 +0800)
mod/scorm/db/install.xml
mod/scorm/db/upgrade.php
mod/scorm/version.php

index d255b24..ab1d6e1 100644 (file)
@@ -18,7 +18,7 @@
         <FIELD NAME="grademethod" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" PREVIOUS="maxgrade" NEXT="whatgrade"/>
         <FIELD NAME="whatgrade" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" PREVIOUS="grademethod" NEXT="maxattempt"/>
         <FIELD NAME="maxattempt" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="1" SEQUENCE="false" PREVIOUS="whatgrade" NEXT="forcecompleted"/>
-        <FIELD NAME="forcecompleted" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="1" SEQUENCE="false" PREVIOUS="maxattempt" NEXT="forcenewattempt"/>
+        <FIELD NAME="forcecompleted" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="false" DEFAULT="1" SEQUENCE="false" PREVIOUS="maxattempt" NEXT="forcenewattempt"/>
         <FIELD NAME="forcenewattempt" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" PREVIOUS="forcecompleted" NEXT="lastattemptlock"/>
         <FIELD NAME="lastattemptlock" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" PREVIOUS="forcenewattempt" NEXT="displayattemptstatus"/>
         <FIELD NAME="displayattemptstatus" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="false" DEFAULT="1" SEQUENCE="false" PREVIOUS="lastattemptlock" NEXT="displaycoursestructure"/>
       </KEYS>
     </TABLE>
   </TABLES>
-</XMLDB>
\ No newline at end of file
+</XMLDB>
index e68ec41..ba04865 100644 (file)
@@ -225,7 +225,7 @@ function xmldb_scorm_upgrade($oldversion) {
 
     /// Define new fields forcecompleted, forcenewattempt, displayattemptstatus, and displaycoursestructure to be added to scorm
         $table = new xmldb_table('scorm');
-        $field = new xmldb_field('forcecompleted', XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL, null, 1, 'maxattempt');
+        $field = new xmldb_field('forcecompleted', XMLDB_TYPE_INTEGER, 1, null, XMLDB_NOTNULL, null, 1, 'maxattempt');
         if (!$dbman->field_exists($table,$field)) {
             $dbman->add_field($table, $field);
         }
@@ -478,18 +478,16 @@ function xmldb_scorm_upgrade($oldversion) {
         upgrade_mod_savepoint(true, 2010092400, 'scorm');
     }
     
-    if ($oldversion < 2010122300) {
+    if ($oldversion < 2011011400) {
         // Fix scorm in the post table after upgrade from 1.9
         $table = new xmldb_table('scorm');
         $columns = $DB->get_columns('scorm');
 
-        if (array_key_exists('forcecompleted', $columns) && empty($columns['forcecompleted']->not_null)) {
-            // forcecompleted should be bigint(10) NOT NULL DEFAULT '1'
-            // Fixed in earlier upgrade code
-            $field = new xmldb_field('forcecompleted', XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL, null, 1, 'maxattempt');
-            if ($dbman->field_exists($table, $field)) {
-                $dbman->change_field_precision($table, $field);
-            }
+        // forcecompleted should be bigint(1) NOT NULL DEFAULT '1'
+        // Fixed in earlier upgrade code
+        $field = new xmldb_field('forcecompleted', XMLDB_TYPE_INTEGER, 1, null, XMLDB_NOTNULL, null, 1, 'maxattempt');
+        if ($dbman->field_exists($table, $field)) {
+            $dbman->change_field_precision($table, $field);
         }
 
         if (array_key_exists('forcenewattempt', $columns) && empty($columns['forcenewattempt']->not_null)) {
@@ -528,9 +526,9 @@ function xmldb_scorm_upgrade($oldversion) {
             }
         }
 
-        upgrade_mod_savepoint(true, 2010122300, 'scorm');
+        upgrade_mod_savepoint(true, 2011011400, 'scorm');
     }
-    
+
     return true;
 }
 
index 9627651..9cb06b0 100644 (file)
@@ -6,7 +6,7 @@
 /////////////////////////////////////////////////////////////////////////////////
 
 
-$module->version  = 2010122300;   // The (date) version of this module
+$module->version  = 2011011400;   // The (date) version of this module
 $module->requires = 2010080300;   // The version of Moodle that is required
 $module->cron     = 300;            // How often should cron check this module (seconds)?