Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Won't Fix
-
Affects Version/s: 1.7
-
Fix Version/s: None
-
Component/s: Backup
-
Labels:None
-
Environment:Moodle 1.7, Apache 2.0.59, PHP 5.1.6, MySQL 4.1.21
-
Affected Branches:MOODLE_17_STABLE
Description
http://moodle.org/mod/forum/discuss.php?d=62033
restorelib.php, restore_execute(), line 5420:
if ($status = restore_open_html($restore,$course_header)){
echo "<li>Creating the Restorelog.html in the course backup folder</li>";
}
This is fine, but it's within the first clause of an if statement (If we've selected to restore into new course). If you're restoring to an existing course (as in my case, where I've created a large number of courses and I'm now trying to restore one template course to a lot of different places), this is never called, so when at the end of the restore_execute() function in line 5900, it's closed, the closure fails and the function returns false, which triggers the error message in import_backup_file_silently() but there's nothing in $errorstr for the error message to report and all the work has completed successfully anyway. So I moved the above lines to open the restorelog.html file outside the if statement and rewrote the code that closes it at line 5900:
if (!defined('RESTORE_SILENTLY')) {
echo "<li>Closing the Restorelog.html file.<li>";
}
$status = restore_close_html($restore);
if (!$status){
if (!defined('RESTORE_SILENTLY')) {
notify("Could not close the Restorelog.html file");
} else {
$errorstr = "Could not close the Restorelog.html file";
return false;
}
}
Oh, and I altered the opening of the file as well (the above works, it's just that it echo()s stuff to the screen instead of being silent):
if (!defined('RESTORE_SILENTLY')) {
echo "<li>Creating the Restorelog.html in the course backup folder</li>";
}
$status = restore_open_html($restore,$course_header);
if (!$status){
if (!defined('RESTORE_SILENTLY')) {
notify("Could not open the Restorelog.html file");
} else {
$errorstr = "Could not open the Restorelog.html file";
return false;
}
}
Assigning this to Penny.