mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
Included log generation to XML
This commit is contained in:
parent
9d85990f62
commit
537718f85a
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user