Return info to know what modules process...
authorstronk7 <stronk7>
Fri, 30 May 2003 22:55:40 +0000 (22:55 +0000)
committerstronk7 <stronk7>
Fri, 30 May 2003 22:55:40 +0000 (22:55 +0000)
backup/STATUS.txt
backup/restorelib.php

index 5040934fbb76a467db509d226953594a64af70a5..92acc7f1ba423b430482ba24947bab725dbc5af9 100644 (file)
@@ -155,7 +155,7 @@ Restore Details:
               x separate every mod..............................DONE
               x xmlize (to array) and serialize it..............DONE
               x save to db (backup_ids).........................DONE
-           - Mods Info..........................................NO EXISTS
+           - Mods Info..........................................IN PROGRESS
               x assignments.....................................NO EXISTS
                  + course data..................................NO EXISTS
                  + user data....................................NO EXISTS
@@ -176,10 +176,10 @@ Restore Details:
                  + course data..................................NO EXISTS
                  + user data....................................NO EXISTS
                  + files........................................NO EXISTS
-              x resources.......................................NO EXISTS
-                 + course data..................................NO EXISTS
-                 + user data....................................NO EXISTS
-                 + files........................................NO EXISTS
+              x resources.......................................IN PROGRESS
+                 + course data..................................IN PROGRESS
+                 + user data....................................IN PROGRESS
+                 + files.(ARE COURSE FILES !!!).................DONE
               x surveys.........................................NO EXISTS
                  + course data..................................NO EXISTS
                  + user data....................................NO EXISTS
index 78564f13940b9d5b1fbc495df971a7bbe85c08cc..7d66ffe3ab36ce210b3a82fc918fdee96a9e407d 100644 (file)
         }
         //Get info from xml
         if ($status) {
-            //info will contain the old_id of every module
+            //info will contain the id and modtype of every module
             //in backup_ids->info will be the real info (serialized)
             $info = restore_read_xml_modules($restore,$xml_file);
         }
 
+        //Now, if we have anything in info, we have to restore that mods
+        //from backup_ids (calling every mod restore function)
+        if ($info) {
+print_object($info);
+
+        } else {
+            $status = false;
+        }
+
+       return $status; 
+
     }
 
     //=====================================================================================
         var $tree = array();   //Array of levels we are
         var $content = "";     //Content under current level
         var $todo = "";        //What we hav to do when parsing
-        var $info = "";        //Information collected. Temp storage.
+        var $info = "";        //Information collected. Temp storage. Used to return data after parsing.
+        var $temp = "";        //Temp storage.
         var $preferences = ""; //Preferences about what to load !!
         var $finished = false; //Flag to say xml_parse to stop
 
             //    echo $this->level.str_repeat("&nbsp;",$this->level*2)."&lt;".$tagName."&gt;<br>\n";   //Debug
             //If we are under a MOD tag under a MODULES zone, accumule it
             if (($this->tree[4] == "MOD") and ($this->tree[3] == "MODULES")) {
-                $this->info .= "<".$tagName.">";
+                $this->temp .= "<".$tagName.">";
             }
         }
 
                 //echo $this->level.str_repeat("&nbsp;",$this->level*2)."&lt;/".$tagName."&gt;<br>\n";          //Debug
                 //Acumulate data to info (content + close tag)
                 //Reconvert it to utf & htmlchars and trim to generate xml data
-                $this->info .= utf8_encode(htmlspecialchars(trim($this->content)))."</".$tagName.">";
+                $this->temp .= utf8_encode(htmlspecialchars(trim($this->content)))."</".$tagName.">";
                 //If we've finished a mod, xmlize it an save to db
                 if (($this->level == 4) and ($tagName == "MOD")) {
                     //Prepend XML standard header to info gathered
-                    $xml_data = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n".$this->info;
+                    $xml_data = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n".$this->temp;
                     //Call to xmlize for this portion of xml data (one MOD)
                     $data = xmlize($xml_data);
                     //traverse_xmlize($data);                                                                     //Debug
                         //Save to db
                         backup_putid($this->preferences->backup_unique_code,$mod_type,$mod_id,
                                      null,$sla_mod_temp);
+                        //Create returning info
+                        $this->info[] = array(id => $mod_id,modtype => $mod_type);
                     }
                     //Reset info to empty
-                    $this->info = "";
+                    $this->temp = "";
                 }
-
-
-
-
             }
 
             //Stop parsing if todo = MODULES and tagName = MODULES (en of the tag, of course)