]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-10202 fixed locktime trouble
authorskodak <skodak>
Thu, 21 Jun 2007 07:30:30 +0000 (07:30 +0000)
committerskodak <skodak>
Thu, 21 Jun 2007 07:30:30 +0000 (07:30 +0000)
lib/db/upgrade.php
version.php

index dc980b767b5f804571ef7d6a7688694b01426a6f..7e63cf4844a972d3699832158c168b857f5004e6 100644 (file)
@@ -1288,15 +1288,6 @@ function xmldb_main_upgrade($oldversion=0) {
             $result = $result && create_table($table);
         }
 
-        $table  = new XMLDBTable('grade_items');
-        $field = new XMLDBField('locktime');
-
-        if (!field_exists($table, $field)) {
-            $locktime->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'locked');
-        /// Launch add field locktime
-            $result = $result && add_field($table, $field);
-        }
-
         /// Remove the obsoleted unitttests tables - they will be recreated automatically
         $tables = array('grade_categories',
                         'scale',
@@ -1358,6 +1349,19 @@ function xmldb_main_upgrade($oldversion=0) {
     }
 
 
+    /// add new locktime field if needed
+    if ($result && $oldversion < 2007062008) {
+
+        $table  = new XMLDBTable('grade_items');
+        $field = new XMLDBField('locktime');
+
+        if (!field_exists($table, $field)) {
+            $field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'locked');
+        /// Launch add field locktime
+            $result = $result && add_field($table, $field);
+        }
+    }
+
     return $result;
 }
 
index c562ebeb33937ab94d420cad0ed3263616ffd010..b005215a539dc3a90b328a3acc7ea82751f25bfd 100644 (file)
@@ -6,7 +6,7 @@
 // This is compared against the values stored in the database to determine
 // whether upgrades should be performed (see lib/db/*.php)
 
-   $version = 2007062007;  // YYYYMMDD = date
+   $version = 2007062008;  // YYYYMMDD = date
                            //       XY = increments within a single day
 
    $release = '1.9 dev';    // Human-friendly version name