]> git.mjollnir.org Git - moodle.git/commitdiff
get_my_courses() - tighten default fields - faster, risky
authormartinlanghoff <martinlanghoff>
Sun, 6 May 2007 05:27:31 +0000 (05:27 +0000)
committermartinlanghoff <martinlanghoff>
Sun, 6 May 2007 05:27:31 +0000 (05:27 +0000)
This makes get_my_courses() faster/lighter in 2 ways

 - We fetch a ton less data from the DB
 - We store a tone less data in the Session

In a test environment, with a student enrolled in  3 _empty_ courses
(just created, empty modinfo, etc), this shaves 50% off the session
size on-disk.

The problem is callers that may be expecting a given field to appear by
default. Next step: walk all callers...

lib/datalib.php

index 34498d029b4f317893d5d626a9088dcfab485535..65dce50b3c9afa7f1d8b9fff58108e8db994e140 100644 (file)
@@ -686,7 +686,7 @@ function get_my_courses($userid, $sort=NULL, $fields=NULL, $doanything=false,$li
 
     // Default parameters
     $d_sort   = 'visible DESC,sortorder ASC';
-    $d_fields = '*';
+    $d_fields = 'id, category, sortorder, shortname, fullname, idnumber, newsitems, teacher, teachers, student, students, guest, startdate, visible, cost, enrol, summary';
 
     $usingdefaults = true;
     if (is_null($sort)) {