OK I noticed that this got improved in 1.9, but not 1.5.x - 1.8.x. Maybe we should consider backport this back to 1.5 - 1.8 (I could help with this).
Basically the problem is that if you have really BIG course (e.g. for our case, a course with 1300+ students with lots of quizzes and unlimited quiz attempts for practice quizzes..etc.). In this case for moodle 1.5. - 1.8 the backup process would stop when the system is "Writing categories and questions." We tried to narrow down the problem and one thing that we came up with is to improve the function full_tag a little bit.
Currently in the backuplib.php in moodle 1.5.x to 1.8.x, it looks like this:
function full_tag($tag,$level=0,$endline=true,$content,$attributes=null)
{ global $CFG; //Here we encode absolute links $content = backup_encode_absolute_links($content); $st = start_tag($tag,$level,$endline,$attributes); $co = xml_tag_safe_content($content); $et = end_tag($tag,0,true); return $st.$co.$et; }This is not efficient as no matter what the backup_encode_absolute_links will be called. We rewrote it a little bit to add a if condition before the $content = backup_encode_absolute_links($content); See below:
439 //Here we encode absolute links
440 //Only run backup_encode_absolute_links when necessary...
441 //Running backup_encode_absolute_links on every tag adds a lot of overhead
442 //Looking at backup_encode_absolute_links, it appears to only operate on
443 if (strpos($content, "file.php") !== false || strpos($content, "index.php") !== false || strpos($content, "discuss.php"))
444
The solution that moodle 1.9 came up with is: (see MDL-10770 for more details):
function full_tag($tag,$level=0,$endline=true,$content,$attributes=null) {
global $CFG;
//Here we encode absolute links
// MDL-10770
if (is_null($content))
else
{ $content = backup_encode_absolute_links($content); }$st = start_tag($tag,$level,$endline,$attributes);
$co = xml_tag_safe_content($content);
$et = end_tag($tag,0,true);
return $st.$co.$et;
}
Which one would be a better solution? Just thought that I would throw it out here for discussion. I could help with backporting by the way once we reach some kind of agreement. thanks!
- has been marked as being related by
-
MDL-14269 META: Backup performance
-
- Closed
-