]> git.mjollnir.org Git - moodle.git/commitdiff
Corrected the stamp I just added and added a separate version field instead
authormoodler <moodler>
Sat, 23 Aug 2003 14:18:44 +0000 (14:18 +0000)
committermoodler <moodler>
Sat, 23 Aug 2003 14:18:44 +0000 (14:18 +0000)
lib/moodlelib.php
mod/quiz/db/mysql.php
mod/quiz/db/mysql.sql
mod/quiz/db/postgres7.php
mod/quiz/db/postgres7.sql
mod/quiz/version.php

index 0906f7f6e576d937ba681a0d2d78b8b7a396ed05..8668be57c0247ea714aa6a914c9be68238540d1e 100644 (file)
@@ -1685,7 +1685,7 @@ function make_grades_menu($gradingtype) {
     return $grades;
 }
 
-function make_unique_id_code($version=1) {
+function make_unique_id_code($extra="") {
 
     $hostname = "unknownhost";
     if (!empty($_SERVER["HTTP_HOST"])) {
@@ -1702,8 +1702,11 @@ function make_unique_id_code($version=1) {
 
     $random =  random_string(6);
 
-    return "$hostname+$date+$random+$version";
-    
+    if ($extra) {
+        return "$hostname+$date+$random+$extra";
+    } else {
+        return "$hostname+$date+$random";
+    }
 }
 
 
index 322662541390ffdad07cb94804b414ac0b5fdcfb..c6719e3cf0b23b2d02331c55326af79490d3c279 100644 (file)
@@ -131,8 +131,12 @@ function quiz_upgrade($oldversion) {
     }
 
     if ($oldversion < 2003082300) {
-        table_column("quiz_questions", "", "stamp", "varchar", "255", "", "qtype");
+        table_column("quiz_questions", "", "stamp", "varchar", "255", "", "", "not null", "qtype");
+    }
 
+    if ($oldversion < 2003082301) {
+        table_column("quiz_questions", "stamp", "stamp", "varchar", "255", "", "", "not null");
+        table_column("quiz_questions", "", "version", "integer", "10", "", "1", "not null", "stamp");
         if ($questions = get_records("quiz_questions")) {
             foreach ($questions as $question) {
                 $stamp = make_unique_id_code();
index d4d5faff59c0b18859399b78369a01593660a1dd..9c98f75421bedc1e781baabe5a9403b9d54373bf 100644 (file)
@@ -171,6 +171,7 @@ CREATE TABLE `prefix_quiz_questions` (
   `defaultgrade` INT UNSIGNED DEFAULT '1' NOT NULL,
   `qtype` smallint(6) NOT NULL default '0',
   `stamp` varchar(255) NOT NULL default '',
+  `version` int(10) NOT NULL default '1',
   PRIMARY KEY  (`id`)
 ) TYPE=MyISAM COMMENT='The quiz questions themselves';
 # --------------------------------------------------------
index 7c852328f73674f2062ccd5b218a6adbb92b0c9d..16c16d34f1e8b1747be604bb4a8c5b5c94687a8b 100644 (file)
@@ -88,7 +88,10 @@ function quiz_upgrade($oldversion) {
         table_column("quiz", "", "attemptonlast", "INTEGER", "10", "UNSIGNED", "0", "NOT NULL", "attempts");
 
         table_column("quiz_questions", "", "stamp", "varchar", "255", "", "qtype");
+    }
 
+    if ($oldversion < 2003082301) {
+        table_column("quiz_questions", "", "version", "integer", "10", "", "1", "not null", "stamp");
         if ($questions = get_records("quiz_questions")) {
             foreach ($questions as $question) {
                 $stamp = make_unique_id_code();
index d9d0a9e51d173e980e80e66804c29fffea8be42e..4ecd1afddb9dabc96e81b60b5fb5c0d69537e566 100644 (file)
@@ -183,7 +183,8 @@ CREATE TABLE prefix_quiz_questions (
   image varchar(255) NOT NULL default '',
   defaultgrade integer NOT NULL default '1',
   qtype integer NOT NULL default '0',
-  stamp varchar(255) NOT NULL default ''
+  stamp varchar(255) NOT NULL default '',
+  version integer NOT NULL default '1'
 );
 # --------------------------------------------------------
 
index 65eb0a91071ea7ad29083cbe57ac06495ceb1a80..f81de0536804bd3015e45938af39903da1ce2fd5 100644 (file)
@@ -5,7 +5,7 @@
 //  This fragment is called by moodle_needs_upgrading() and /admin/index.php
 ////////////////////////////////////////////////////////////////////////////////
 
-$module->version  = 2003082300;   // The (date) version of this module
+$module->version  = 2003082301;   // The (date) version of this module
 $module->cron     = 0;            // How often should cron check this module (seconds)?
 
 ?>