]> git.mjollnir.org Git - moodle.git/commitdiff
No restoring categories, but working again.
authorstronk7 <stronk7>
Sun, 21 Sep 2003 22:43:07 +0000 (22:43 +0000)
committerstronk7 <stronk7>
Sun, 21 Sep 2003 22:43:07 +0000 (22:43 +0000)
mod/glossary/restorelib.php

index facf02c1c309e10d5b12381f6a317b5a83f08c93..4fa755fdff987d01351d46f302a0074681179704 100644 (file)
@@ -4,13 +4,13 @@
 
     //This is the "graphical" structure of the glossary mod:
     //
-    //                     glossary
-    //                    (CL,pk->id)
-    //                        |
-    //                        |
-    //                        |
-    //                  glossary_entries
-    //         (UL,pk->id, fk->glossaryid,files)
+    //                     glossary ---------------------- glossary_categories
+    //                    (CL,pk->id)                  (CL,pk->id,fk->glossaryid)
+    //                        |                                       |
+    //                        |                                       |
+    //                        |                                       |
+    //                  glossary_entries -------------- glossary_entries_categories
+    //         (UL,pk->id, fk->glossaryid, files)      (UL, [pk->categoryid,entryid]
     //
     // Meaning: pk->primary key field of the table
     //          fk->foreign key to link with parent
@@ -65,6 +65,7 @@
                 //Now check if want to restore user data and do it.
                 //Restore glossary_entries
                 $status = glossary_entries_restore_mods($mod->id,$newid,$info,$restore);
+                //Restore glossary_categories and glossary_category_entries
 //                $status = glossary_categories_restore_mods($mod->id,$newid,$info,$restore);
             } else {
                 $status = false;
 
         //Iterate over entries
         for($i = 0; $i < sizeof($categories); $i++) {
-               $cat_info = $categories[$i];
+            $cat_info = $categories[$i];
 
             //We'll need this later!!
-               $oldid = backup_todb($cat_info['#']['ID']['0']['#']);
+            $oldid = backup_todb($cat_info['#']['ID']['0']['#']);
 
             //Now, build the GLOSSARY_CATEGORIES record structure
-               $category->glossaryid = $new_glossary_id;
-               $category->name = backup_todb($cat_info['#']['NAME']['0']['#']);
+            $category->glossaryid = $new_glossary_id;
+            $category->name = backup_todb($cat_info['#']['NAME']['0']['#']);
 
-               $newid = insert_record ("glossary_categories",$category);
+            $newid = insert_record ("glossary_categories",$category);
 
-               //Do some output
-               if (($i+1) % 50 == 0) {
-                    echo ".";
-                    if (($i+1) % 1000 == 0) {
-                         echo "<br>";
-                    }
-                         backup_flush(300);
-                    }
-                    if ($newid) {
-                         //We have the newid, update backup_ids
-                         backup_putid($restore->backup_unique_code,"glossary_categories",$oldid,$newid);
-                         //Now copy moddata associated files if needed
-                    } else {
-                         $status = false;
-                    }
-
-               }
+            //Do some output
+            if (($i+1) % 50 == 0) {
+                echo ".";
+                if (($i+1) % 1000 == 0) {
+                    echo "<br>";
+                }
+                backup_flush(300);
+            }
+            if ($newid) {
+                //We have the newid, update backup_ids
+                backup_putid($restore->backup_unique_code,"glossary_categories",$oldid,$newid);
+                //Now copy moddata associated files if needed
+            } else {
+                $status = false;
+            }
         }
 
         return $status;