From e464445596177e703b5fbeb2ecb0fbc0869acab1 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Sat, 2 Feb 2008 23:59:48 +0000 Subject: [PATCH] Now we are reading user_profile_fields and user_tags + some small fixes on roles. MDL-6856 ; merged from 19_STABLE --- backup/restorelib.php | 139 ++++++++++++++++++++++++++++-------------- 1 file changed, 94 insertions(+), 45 deletions(-) diff --git a/backup/restorelib.php b/backup/restorelib.php index 5594708239..e0b38829ae 100644 --- a/backup/restorelib.php +++ b/backup/restorelib.php @@ -5638,6 +5638,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3); break; } } + if ($this->level == 5) { switch ($tagName) { case "ID": @@ -5780,6 +5781,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3); break; } } + if ($this->level == 6 && $this->tree[5]!="ROLES_ASSIGNMENTS" && $this->tree[5]!="ROLES_OVERRIDES") { switch ($tagName) { case "ROLE": @@ -5792,56 +5794,103 @@ define('RESTORE_GROUPS_GROUPINGS', 3); $this->info->tempuser->user_preferences[$this->info->tempuserpreference->name] = $this->info->tempuserpreference; unset($this->info->tempuserpreference); break; - } - } - - if ($this->level == 7) { - switch ($tagName) { - case "TYPE": - $this->info->temprole->type = $this->getContents(); - break; - case "AUTHORITY": - $this->info->temprole->authority = $this->getContents(); - break; - case "TEA_ROLE": - $this->info->temprole->tea_role = $this->getContents(); - break; - case "EDITALL": - $this->info->temprole->editall = $this->getContents(); - break; - case "TIMESTART": - $this->info->temprole->timestart = $this->getContents(); - break; - case "TIMEEND": - $this->info->temprole->timeend = $this->getContents(); - break; - case "TIMEMODIFIED": - $this->info->temprole->timemodified = $this->getContents(); - break; - case "TIMESTART": - $this->info->temprole->timestart = $this->getContents(); + case "USER_CUSTOM_PROFILE_FIELD": + //We've finalized a user_custom_profile_field, get it + $this->info->tempuser->user_custom_profile_fields[] = $this->info->tempusercustomprofilefield; + unset($this->info->tempusercustomprofilefield); break; - case "TIMEEND": - $this->info->temprole->timeend = $this->getContents(); - break; - case "TIME": - $this->info->temprole->time = $this->getContents(); - break; - case "TIMEACCESS": - $this->info->temprole->timeaccess = $this->getContents(); - break; - case "ENROL": - $this->info->temprole->enrol = $this->getContents(); - break; - case "NAME": - $this->info->tempuserpreference->name = $this->getContents(); - break; - case "VALUE": - $this->info->tempuserpreference->value = $this->getContents(); + case "USER_TAG": + //We've finalized a user_tag, get it + $this->info->tempuser->user_tags[] = $this->info->tempusertag; + unset($this->info->tempusertag); break; default: break; + } + } + if ($this->level == 7 && $this->tree[5]!="ROLES_ASSIGNMENTS" && $this->tree[5]!="ROLES_OVERRIDES") { + /// If we are reading roles + if($this->tree[6] == 'ROLE') { + switch ($tagName) { + case "TYPE": + $this->info->temprole->type = $this->getContents(); + break; + case "AUTHORITY": + $this->info->temprole->authority = $this->getContents(); + break; + case "TEA_ROLE": + $this->info->temprole->tea_role = $this->getContents(); + break; + case "EDITALL": + $this->info->temprole->editall = $this->getContents(); + break; + case "TIMESTART": + $this->info->temprole->timestart = $this->getContents(); + break; + case "TIMEEND": + $this->info->temprole->timeend = $this->getContents(); + break; + case "TIMEMODIFIED": + $this->info->temprole->timemodified = $this->getContents(); + break; + case "TIMESTART": + $this->info->temprole->timestart = $this->getContents(); + break; + case "TIMEEND": + $this->info->temprole->timeend = $this->getContents(); + break; + case "TIME": + $this->info->temprole->time = $this->getContents(); + break; + case "TIMEACCESS": + $this->info->temprole->timeaccess = $this->getContents(); + break; + case "ENROL": + $this->info->temprole->enrol = $this->getContents(); + break; + default: + break; + } + /// If we are reading user_preferences + } else if ($this->tree[6] == 'USER_PREFERENCE') { + switch ($tagName) { + case "NAME": + $this->info->tempuserpreference->name = $this->getContents(); + break; + case "VALUE": + $this->info->tempuserpreference->value = $this->getContents(); + break; + default: + break; + } + /// If we are reading user_custom_profile_fields + } else if ($this->tree[6] == 'USER_CUSTOM_PROFILE_FIELD') { + switch ($tagName) { + case "FIELD_NAME": + $this->info->tempusercustomprofilefield->field_name = $this->getContents(); + break; + case "FIELD_TYPE": + $this->info->tempusercustomprofilefield->field_type = $this->getContents(); + break; + case "FIELD_DATA": + $this->info->tempusercustomprofilefield->field_data = $this->getContents(); + break; + default: + break; + } + /// If we are reading user_tags + } else if ($this->tree[6] == 'USER_TAG') { + switch ($tagName) { + case "NAME": + $this->info->tempusertag->name = $this->getContents(); + break; + case "RAWNAME": + $this->info->tempusertag->rawname = $this->getContents(); + break; + default: + break; + } } } -- 2.39.5