最近准备将Moodle系统移植到效能较好服务器(IBM xServer),但对于档案超过400M的备份档一直无法成功。
- 将备份档直接ftp到server上,以免需重设最大上传容量。
- 更改一些timeout时间仍无法解决。
- 找寻moodle官方网站有无同样问题;在http://moodle.org/mod/forum/discuss.php?d=86281 找到相同的问题。
- 在http://tracker.moodle.org/browse/MDL-9290提供修正方法。 We have resolved the problem
- 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);
- 批注掉backup_flush() 测试后发现就不会让客户端CPU使用率一直在100%。
- 但如同第3点所提,并不见得会成功;
- 观察还原过程服务器内存使用量,发现若memory_limit设得太低仍无法成功,改进方法在php.ini中设定memory_limit 或是在backup/restore.php将raise_memory_limit("192M")调高即可,我调到512M才正常。
- 此问题在moodle2.0将会被修正


