Included log generation to XML

This commit is contained in:
stronk7 2003-05-09 20:05:15 +00:00
parent 9d85990f62
commit 537718f85a
3 changed files with 53 additions and 2 deletions

View File

@ -4,7 +4,7 @@ STATUS $Id$
This documment shows the current status of the backup/restore option.
Backup: WORKING. Only xml generation into temp dir. Header, info,
course data, sections and user data.
course data, sections, user data and logs.
Restore: NOT WORKING. No comments.
@ -47,6 +47,7 @@ Backup Details:
x students........................................DONE
- Course.......................................DONE
- All..........................................DONE
- Logs...............................................DONE
- Mods Info..........................................IN PROGRESS
x assignments.....................................IN PROGRESS
+ course data..................................NO EXISTS

View File

@ -156,7 +156,15 @@
if ($status) {
$status = backup_user_info($backup_file,$preferences);
}
//Print logs if selected
if ($preferences->backup_logs) {
echo "<li>Writing logs info";
//User info
if ($status) {
$status = backup_log_info($backup_file,$preferences);
}
}
//Module info

View File

@ -771,6 +771,48 @@
}
return $status;
}
//Backup log info (time ordered)
function backup_log_info($bf,$preferences) {
global $CFG;
$status = true;
$logs = get_records ("log","course",$preferences->backup_course);
//We have logs
if ($logs) {
//Pring logs header
fwrite ($bf,start_tag("LOGS",2,true));
//Iterate
foreach ($logs as $log) {
//See if it is a valid module to backup
if ($log->module == "course" or
$log->module == "user") {
//Begin log tag
fwrite ($bf,start_tag("LOG",3,true));
//Output log data
fwrite ($bf,full_tag("ID",4,false,$log->id));
fwrite ($bf,full_tag("TIME",4,false,$log->time));
fwrite ($bf,full_tag("USERID",4,false,$log->userid));
fwrite ($bf,full_tag("IP",4,false,$log->ip));
fwrite ($bf,full_tag("MODULE",4,false,$log->module));
fwrite ($bf,full_tag("ACTION",4,false,$log->action));
fwrite ($bf,full_tag("URL",4,false,$log->url));
fwrite ($bf,full_tag("INFO",4,false,$log->info));
//End log data
fwrite ($bf,end_tag("LOG",3,true));
}
}
$status = fwrite ($bf,end_tag("LOGS",2,true));
}
return $status;
}
?>