diff --git a/backup/STATUS.txt b/backup/STATUS.txt index fc733699de5..df888f9c34a 100644 --- a/backup/STATUS.txt +++ b/backup/STATUS.txt @@ -5,7 +5,7 @@ This documment shows the current status of the backup/restore option. Backup: WORKING. COMPLETED !! -Restore: WORKING. COMPLETED except logs. +Restore: WORKING. COMPLETED except logs restore. ========== ========== ========== ========== ========== ========== @@ -49,6 +49,7 @@ Backup Details: - All..........................................DONE - Logs...............................................DONE - Scales.............................................DONE + - Groups.............................................DONE - Categories and Questions.(STEP 1)..................DONE + categories......................................DONE + questions structure.............................DONE @@ -177,6 +178,7 @@ Restore Details: + categories......................................DONE + questions structure.............................DONE - Scales.............................................DONE + - Groups.............................................DONE - Mods Info Prepare..................................DONE x read modules zone...............................DONE x separate every mod..............................DONE diff --git a/backup/restore_execute.html b/backup/restore_execute.html index f1ba6ebeeb8..500e33ad9bd 100644 --- a/backup/restore_execute.html +++ b/backup/restore_execute.html @@ -227,6 +227,14 @@ } } + //Now create groups as needed + if ($status) { + echo "
GROUP: ".strftime ("%X",time()),"-"; //Debug
+ //} //Debug
+
+ //Output something to avoid browser timeouts...
+ backup_flush();
+
+ //Check if we are into GROUPS zone
+ //if ($this->tree[3] == "GROUPS") //Debug
+ // echo $this->level.str_repeat(" ",$this->level*2)."<".$tagName.">
\n"; //Debug
+
+ //If we are under a GROUP tag under a GROUPS zone, accumule it
+ if (isset($this->tree[4]) and isset($this->tree[3])) {
+ if (($this->tree[4] == "GROUP") and ($this->tree[3] == "GROUPS")) {
+ if (!isset($this->temp)) {
+ $this->temp = "";
+ }
+ $this->temp .= "<".$tagName.">";
+ }
+ }
+ }
+
//This is the startTag handler we use where we are reading the modules zone (todo="MODULES")
function startElementModules($parser, $tagName, $attrs) {
//Refresh properties
@@ -1706,6 +1871,56 @@
$this->content = "";
}
+ //This is the endTag handler we use where we are reading the groups zone (todo="GROUPS")
+ function endElementGroups($parser, $tagName) {
+ //Check if we are into GROUPS zone
+ if ($this->tree[3] == "GROUPS") {
+ //if (trim($this->content)) //Debug
+ // echo "C".str_repeat(" ",($this->level+2)*2).$this->getContents()."
\n"; //Debug
+ //echo $this->level.str_repeat(" ",$this->level*2)."</".$tagName.">
\n"; //Debug
+ //Acumulate data to info (content + close tag)
+ //Reconvert: strip htmlchars again and trim to generate xml data
+ if (!isset($this->temp)) {
+ $this->temp = "";
+ }
+ $this->temp .= htmlspecialchars(trim($this->content))."".$tagName.">";
+ //If we've finished a group, xmlize it an save to db
+ if (($this->level == 4) and ($tagName == "GROUP")) {
+ //Prepend XML standard header to info gathered
+ $xml_data = "\n".$this->temp;
+ //Call to xmlize for this portion of xml data (one GROUP)
+ //echo "-XMLIZE: ".strftime ("%X",time()),"-"; //Debug
+ $data = xmlize($xml_data,0);
+ //echo strftime ("%X",time())."
"; //Debug + //traverse_xmlize($data); //Debug + //print_object ($GLOBALS['traverse_array']); //Debug + //$GLOBALS['traverse_array']=""; //Debug + //Now, save data to db. We'll use it later + //Get id and from data + $group_id = $data["GROUP"]["#"]["ID"]["0"]["#"]; + //Save to db + $status = backup_putid($this->preferences->backup_unique_code,"group",$group_id, + null,$data); + //Create returning info + $ret_info->id = $group_id; + $this->info[] = $ret_info; + //Reset temp + unset($this->temp); + } + } + + //Stop parsing if todo = GROUPS and tagName = GROUP (en of the tag, of course) + //Speed up a lot (avoid parse all) + if ($tagName == "GROUPS" and $this->level == 3) { + $this->finished = true; + } + + //Clear things + $this->tree[$this->level] = ""; + $this->level--; + $this->content = ""; + } + //This is the endTag handler we use where we are reading the modules zone (todo="MODULES") function endElementModules($parser, $tagName) { //Check if we are into MODULES zone @@ -1809,6 +2024,9 @@ } else if ($todo == "SCALES") { //Define handlers to that zone xml_set_element_handler($xml_parser, "startElementScales", "endElementScales"); + } else if ($todo == "GROUPS") { + //Define handlers to that zone + xml_set_element_handler($xml_parser, "startElementGroups", "endElementGroups"); } else if ($todo == "MODULES") { //Define handlers to that zone xml_set_element_handler($xml_parser, "startElementModules", "endElementModules"); diff --git a/backup/version.php b/backup/version.php index 1f4b87339b7..f524ad0fc49 100644 --- a/backup/version.php +++ b/backup/version.php @@ -5,6 +5,6 @@ // database (backup_version) to determine whether upgrades should // be performed (see db/backup_*.php) -$backup_version = 2004012200; // The current version is a date (YYYYMMDDXX) +$backup_version = 2004012500; // The current version is a date (YYYYMMDDXX) $backup_release = "1.2 development"; // User-friendly version number