Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 1.5, 1.5.1, 1.5.2, 1.5.3, 1.5.4, 1.6, 1.6.1, 1.6.2, 1.6.3, 1.6.4, 1.6.5, 1.7, 1.7.1, 1.7.2, 1.8
-
Component/s: Backup
-
Labels:None
-
Affected Branches:MOODLE_15_STABLE, MOODLE_16_STABLE, MOODLE_17_STABLE, MOODLE_18_STABLE
-
Fixed Branches:MOODLE_18_STABLE, MOODLE_19_STABLE, MOODLE_20_STABLE
Description
Restore process takes too long, more than the maximum specified in restore.php, and hangs.
When the moodle.xml file of the backup is large.
Issue Links
| This issue has been marked as being related by: | ||||
| MDL-9602 | Restoring courses sometimes fails |
|
|
|
We have resolved the problem
+ $lasttime = time(); // crmas
while ($data = fread($fp, 4096) and !$moodle_parser->finished) {
+ if ((time() - $lasttime) > 5) { + $lasttime = time(); + backup_flush(1); + }
xml_parse($xml_parser, $data, feof($fp))
or die(sprintf("XML error: %s at line %d",
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));
}
fclose($fp);
- commenting out the call to backup_flush() of every StartElement... and
- including the code marked with + in the file restorelib.php at the end of the function restore_read_xml(...)
+ $lasttime = time(); // crmas while ($data = fread($fp, 4096) and !$moodle_parser->finished) { + if ((time() - $lasttime) > 5) { + $lasttime = time(); + backup_flush(1); + } xml_parse($xml_parser, $data, feof($fp)) or die(sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser))); } fclose($fp);