Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-21509 - include timecreate field (user table) to backup and restore.

  • Loading branch information...
commit b6570b2fec7f15ed7f414ec7e35fb27379e28597 1 parent aa7fbeb
Rossiani Wijaya authored
Showing with 9 additions and 0 deletions.
  1. +1 −0  backup/backuplib.php
  2. +8 −0 backup/restorelib.php
View
1  backup/backuplib.php
@@ -1367,6 +1367,7 @@ function backup_user_info ($bf,$preferences) {
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
View
8 backup/restorelib.php
@@ -3037,6 +3037,11 @@ function restore_create_users($restore,$xml_file) {
$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 @@ function endElementUsers($parser, $tagName) {
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;
Please sign in to comment.
Something went wrong with that request. Please try again.