MDL-7547 yet more speed improvements in rebuild_course_cache()

This commit is contained in:
skodak
2008-02-01 08:15:06 +00:00
parent 8d8105fdf7
commit c102e3aade
4 changed files with 22 additions and 9 deletions
+11 -5
View File
@@ -2744,20 +2744,26 @@ function assignment_get_all_submissions($assignment, $sort="", $dir="DESC") {
function assignment_get_coursemodule_info($coursemodule) {
global $CFG;
if (! $type = get_field('assignment', 'assignmenttype', 'id', $coursemodule->instance)) {
if (! $assignment = get_record('assignment', 'id', $coursemodule->instance, '', '', '', '', 'id, assignmenttype, name')) {
return false;
}
$libfile = "$CFG->dirroot/mod/assignment/type/$type/assignment.class.php";
$libfile = "$CFG->dirroot/mod/assignment/type/$assignment->assignmenttype/assignment.class.php";
if (file_exists($libfile)) {
require_once($libfile);
$assignmentclass = "assignment_$type";
$assignmentclass = "assignment_$assignment->assignmenttype";
$ass = new $assignmentclass('staticonly');
return $ass->get_coursemodule_info($coursemodule);
if ($result = $ass->get_coursemodule_info($coursemodule)) {
return $result;
} else {
$info = new object();
$info->name = $assignment->name;
return $info;
}
} else {
debugging('Incorrect assignment type: '.$type);
debugging('Incorrect assignment type: '.$assignment->assignmenttype);
return false;
}
}