mirror of
https://github.com/moodle/moodle.git
synced 2025-01-22 08:11:26 +01:00
Now message->groupid is supported in backup & restore.
This commit is contained in:
parent
7a9e8dae46
commit
89e399dcda
@ -74,6 +74,7 @@
|
||||
//Print message contents
|
||||
fwrite ($bf,full_tag("ID",6,false,$cha_mes->id));
|
||||
fwrite ($bf,full_tag("USERID",6,false,$cha_mes->userid));
|
||||
fwrite ($bf,full_tag("GROUPID",6,false,$cha_mes->groupid));
|
||||
fwrite ($bf,full_tag("SYSTEM",6,false,$cha_mes->system));
|
||||
fwrite ($bf,full_tag("MESSAGE_TEXT",6,false,$cha_mes->message));
|
||||
fwrite ($bf,full_tag("TIMESTAMP",6,false,$cha_mes->timestamp));
|
||||
|
@ -102,6 +102,7 @@
|
||||
//Now, build the CHAT_MESSAGES record structure
|
||||
$message->chatid = $new_chat_id;
|
||||
$message->userid = backup_todb($mes_info['#']['USERID']['0']['#']);
|
||||
$message->groupid = backup_todb($mes_info['#']['GROUPID']['0']['#']);
|
||||
$message->system = backup_todb($mes_info['#']['SYSTEM']['0']['#']);
|
||||
$message->message = backup_todb($mes_info['#']['MESSAGE_TEXT']['0']['#']);
|
||||
$message->timestamp = backup_todb($mes_info['#']['TIMESTAMP']['0']['#']);
|
||||
@ -112,6 +113,12 @@
|
||||
$message->userid = $user->new_id;
|
||||
}
|
||||
|
||||
//We have to recode the groupid field
|
||||
$group = backup_getid($restore->backup_unique_code,"group",$message->groupid);
|
||||
if ($group) {
|
||||
$message->groupid = $group->new_id;
|
||||
}
|
||||
|
||||
//The structure is equal to the db, so insert the chat_message
|
||||
$newid = insert_record ("chat_messages",$message);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user