From b6570b2fec7f15ed7f414ec7e35fb27379e28597 Mon Sep 17 00:00:00 2001 From: Rossiani Wijaya Date: Fri, 5 Feb 2010 08:08:57 +0000 Subject: [PATCH] MDL-21509 - include timecreate field (user table) to backup and restore. --- backup/backuplib.php | 1 + backup/restorelib.php | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/backup/backuplib.php b/backup/backuplib.php index 418146a8e4b..64571d652fe 100644 --- a/backup/backuplib.php +++ b/backup/backuplib.php @@ -1367,6 +1367,7 @@ if ($user->mnethostid != $CFG->mnet_localhost_id && !empty($user->wwwroot)) { fwrite ($bf,full_tag("MNETHOSTURL",4,false,$user->wwwroot)); } + fwrite ($bf,full_tag("TIMECREATED",4,false,$user->timecreated)); fwrite ($bf,full_tag("TIMEMODIFIED",4,false,$user->timemodified)); /// write assign/override code for context_userid diff --git a/backup/restorelib.php b/backup/restorelib.php index 36ca02c7da2..d35114d79f0 100644 --- a/backup/restorelib.php +++ b/backup/restorelib.php @@ -3037,6 +3037,11 @@ define('RESTORE_GROUPS_GROUPINGS', 3); $user->theme = ''; } + //set time created + if (empty($user->timecreated)) { + $user->timecreated = time(); + } + //We are going to create the user //The structure is exactly as we need @@ -7159,6 +7164,9 @@ define('RESTORE_GROUPS_GROUPINGS', 3); case "MNETHOSTURL": $this->info->tempuser->mnethosturl = $this->getContents(); break; + case "TIMECREATED": + $this->info->tempuser->timecreated = $this->getContents(); + break; case "TIMEMODIFIED": $this->info->tempuser->timemodified = $this->getContents(); break;