mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
Apply modularity to the creation of the log file during restore to a new course.
Remove the responsibility for loging the application of the course start date offset, from activity modules to the backup module. Merged from stable branch
This commit is contained in:
parent
352b8da86a
commit
cf0b1faded
17 changed files with 150 additions and 293 deletions
|
@ -32,12 +32,12 @@
|
|||
$data = backup_getid($restore->backup_unique_code,$mod->modtype,$mod->id);
|
||||
|
||||
if ($data) {
|
||||
//Now get completed xmlized object
|
||||
$info = $data->info;
|
||||
//First, check the course_id backup folder exists in CFG->dataroot
|
||||
$dest_dir = $CFG->dataroot."/".$restore->course_id."/backupdata";
|
||||
check_dir_exists($dest_dir,true);
|
||||
$restorelog_file = fopen("$dest_dir/restorelog.html","a");
|
||||
//Now get completed xmlized object
|
||||
$info = $data->info;
|
||||
//if necessary, write to restorelog and adjust date/time fields
|
||||
if ($restore->course_startdateoffset) {
|
||||
restore_log_date_changes('Assignment', $restore, $info['MOD']['#'], array('TIMEDUE', 'TIMEAVAILABLE'));
|
||||
}
|
||||
//traverse_xmlize($info); //Debug
|
||||
//print_object ($GLOBALS['traverse_array']); //Debug
|
||||
//$GLOBALS['traverse_array']=""; //Debug
|
||||
|
@ -59,18 +59,7 @@
|
|||
$assignment->assignmenttype = backup_todb($info['MOD']['#']['ASSIGNMENTTYPE']['0']['#']);
|
||||
$assignment->maxbytes = backup_todb($info['MOD']['#']['MAXBYTES']['0']['#']);
|
||||
$assignment->timedue = backup_todb($info['MOD']['#']['TIMEDUE']['0']['#']);
|
||||
$date = usergetdate($assignment->timedue);
|
||||
fwrite ($restorelog_file,"<br>The Assignment - ".$assignment->name." <br>");
|
||||
fwrite ($restorelog_file,"The TIMEDUE was " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."");
|
||||
$assignment->timedue += $restore->course_startdateoffset;
|
||||
$date = usergetdate($assignment->timedue);
|
||||
fwrite ($restorelog_file," the TIMEDUE is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."<br>");
|
||||
$assignment->timeavailable = backup_todb($info['MOD']['#']['TIMEAVAILABLE']['0']['#']);
|
||||
$date = usergetdate($assignment->timeavailable);
|
||||
fwrite ($restorelog_file,"The TIMEAVAILABLE was " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."");
|
||||
$assignment->timeavailable += $restore->course_startdateoffset;
|
||||
$date = usergetdate($assignment->timeavailable);
|
||||
fwrite ($restorelog_file," the TIMEAVAILABLE is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."<br>");
|
||||
$assignment->grade = backup_todb($info['MOD']['#']['GRADE']['0']['#']);
|
||||
$assignment->timemodified = backup_todb($info['MOD']['#']['TIMEMODIFIED']['0']['#']);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue