]> git.mjollnir.org Git - moodle.git/commitdiff
Library to every functions related with the backup/restore matter
authorstronk7 <stronk7>
Sat, 3 May 2003 23:20:38 +0000 (23:20 +0000)
committerstronk7 <stronk7>
Sat, 3 May 2003 23:20:38 +0000 (23:20 +0000)
backup/lib.php [new file with mode: 0644]

diff --git a/backup/lib.php b/backup/lib.php
new file mode 100644 (file)
index 0000000..f07ac6d
--- /dev/null
@@ -0,0 +1,31 @@
+<?PHP //$Id$
+    //This file contains all the function needed in the backup/restore utility
+    //except the mod-related funtions that are into every backuplib.php inside
+    //every mod directory
+
+    //Insert necessary category ids to backup_ids table
+    function insert_category_ids ($course,$backup_unique_code) {
+        global $CFG;
+        $status = true;
+        $status = execute_sql("INSERT INTO {$CFG->prefix}backup_ids
+                                   (backup_code, table_name, old_id)
+                               SELECT DISTINCT '$backup_unique_code','quiz_categories',t.category
+                               FROM {$CFG->prefix}quiz_questions t,
+                                    {$CFG->prefix}quiz_question_grades g,
+                                    {$CFG->prefix}quiz q
+                               WHERE q.course = '$course' AND
+                                     g.quiz = q.id AND
+                                     g.question = t.id",false);
+        return $status;
+    }
+    
+    //Delete category ids from backup_ids table
+    function delete_category_ids ($backup_unique_code) {
+        global $CFG;
+        $status = true;
+        $status = execute_sql("DELETE FROM {$CFG->prefix}backup_ids
+                               WHERE backup_code = '$backup_unique_code'",false);
+        return $status;
+    }
+
+?>