Skip to content

Commit

Permalink
Now course-guest, user-login and user-logout
Browse files Browse the repository at this point in the history
log actions are restored properly.
Plus some problem with double & entities solved.
Part of bug 3582.
(http://moodle.org/bugs/bug.php?op=show&bugid=3852)
  • Loading branch information
stronk7 committed Aug 3, 2005
1 parent 623b5e5 commit d65d9f9
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions backup/restorelib.php
Expand Up @@ -2524,14 +2524,18 @@ function restore_log_course($restore,$log) {
$log->info = $log->course;
$toinsert = true;
break;
case "guest":
$log->url = "view.php?id=".$log->course;
$toinsert = true;
break;
case "user report":
//recode the info field (it's the user id)
$user = backup_getid($restore->backup_unique_code,"user",$log->info);
if ($user) {
$log->info = $user->new_id;
//Now, extract the mode from the url field
$mode = substr(strrchr($log->url,"="),1);
$log->url = "user.php?id=".$log->course."&user=".$log->info."&mode=".$mode;
$log->url = "user.php?id=".$log->course."&user=".$log->info."&mode=".$mode;
$toinsert = true;
}
break;
Expand Down Expand Up @@ -2657,7 +2661,7 @@ function restore_log_user($restore,$log) {
$user = backup_getid($restore->backup_unique_code,"user",$log->info);
if ($user) {
$log->info = $user->new_id;
$log->url = "view.php?id=".$log->info."&course=".$log->course;
$log->url = "view.php?id=".$log->info."&course=".$log->course;
$toinsert = true;
}
break;
Expand All @@ -2666,7 +2670,25 @@ function restore_log_user($restore,$log) {
$user = backup_getid($restore->backup_unique_code,"user",$log->info);
if ($user) {
$log->info = $user->new_id;
$log->url = "view.php?id=".$log->info."&course=".$log->course;
$log->url = "view.php?id=".$log->info."&course=".$log->course;
$toinsert = true;
}
break;
case "login":
//recode the info field (it's the user id)
$user = backup_getid($restore->backup_unique_code,"user",$log->info);
if ($user) {
$log->info = $user->new_id;
$log->url = "view.php?id=".$log->info."&course=".$log->course;
$toinsert = true;
}
break;
case "logout":
//recode the info field (it's the user id)
$user = backup_getid($restore->backup_unique_code,"user",$log->info);
if ($user) {
$log->info = $user->new_id;
$log->url = "view.php?id=".$log->info."&course=".$log->course;
$toinsert = true;
}
break;
Expand All @@ -2683,7 +2705,7 @@ function restore_log_user($restore,$log) {
$user = backup_getid($restore->backup_unique_code,"user",$userid);
if ($user) {
$log->info = "";
$log->url = "view.php?id=".$user->new_id."&course=".$log->course;
$log->url = "view.php?id=".$user->new_id."&course=".$log->course;
$toinsert = true;
}
break;
Expand Down

0 comments on commit d65d9f9

Please sign in to comment.