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