]> git.mjollnir.org Git - moodle.git/commitdiff
Now stamp and version are fully supported in backup/restore.
authorstronk7 <stronk7>
Sat, 23 Aug 2003 15:21:58 +0000 (15:21 +0000)
committerstronk7 <stronk7>
Sat, 23 Aug 2003 15:21:58 +0000 (15:21 +0000)
The process look for category, stamp and version to calculate
when to create a question or use a existing one.
This avoid duplicates in RANDOM and RANDOMSAMATCH qtypes.

backup/version.php
mod/quiz/backuplib.php
mod/quiz/restorelib.php

index 2807f4815577c19b2fca7bd9f6fc558f8b777b26..8bbe3f2cc3d519d808c9db052cca362c3f7cf9fe 100644 (file)
@@ -5,6 +5,6 @@
 // database (backup_version) to determine whether upgrades should
 // be performed (see db/backup_*.php)
 
-$backup_version = 2003082300;   // The current version is a date (YYYYMMDDXX)
+$backup_version = 2003082301;   // The current version is a date (YYYYMMDDXX)
 
-$backup_release = "0.8.9 alpha";  // User-friendly version number
+$backup_release = "0.8.10 alpha";  // User-friendly version number
index a2ee252461deefefc966604004f8d91332123080..1f6cc1b55688d20568a704ed1b8e8f814693013f 100644 (file)
                 fwrite ($bf,full_tag("IMAGE",6,false,$question->image));
                 fwrite ($bf,full_tag("DEFAULTGRADE",6,false,$question->defaultgrade));
                 fwrite ($bf,full_tag("QTYPE",6,false,$question->qtype));
+                fwrite ($bf,full_tag("STAMP",6,false,$question->stamp));
+                fwrite ($bf,full_tag("VERSION",6,false,$question->version));
                 //Now, depending of the qtype, call one function or other
                 if ($question->qtype == "1") {
                     $status = quiz_backup_shortanswer($bf,$preferences,$question->id);
index ca437f6e246c69ed039f285d61af9425d49006b5..5371a36e45e59a39052458da13276de76f1f9635 100644 (file)
             $question->image = backup_todb($que_info['#']['IMAGE']['0']['#']);
             $question->defaultgrade = backup_todb($que_info['#']['DEFAULTGRADE']['0']['#']);
             $question->qtype = backup_todb($que_info['#']['QTYPE']['0']['#']);
+            $question->stamp = backup_todb($que_info['#']['STAMP']['0']['#']);
+            $question->version = backup_todb($que_info['#']['VERSION']['0']['#']);
 
             //Check if the question exists
-            //by category,questiontext and qtype
-            //But do it only if the question type isn't RANDOM (4) or RANDOMSAMATCH (6), because this
-            //types can have duplicates in the fields I'm searching !!
-            //I think that some modifications should be done here !!
-            //Detected by scott dot elliott at mchsi dot com in Bug 84 
-            if ($question->qtype != 4 and $question->qtype != 6) {
-                $question_exists = get_record ("quiz_questions","category",$question->category,
-                                                                "questiontext",$question->questiontext,
-                                                                "qtype",$question->qtype);
-            } else {
-                $question_exists = false;
-            }
+            //by category,stamp and version
+            $question_exists = get_record ("quiz_questions","category",$question->category,
+                                                            "stamp",$question->stamp,
+                                                            "version",$question->version);
             //If the question exists, only record its id
             if ($question_exists) {
                 $newid = $question_exists->id;