From: toyomoyo <toyomoyo>
Date: Mon, 2 Apr 2007 03:53:10 +0000 (+0000)
Subject: merged fix for MDL-9160, get_my_courses caching issues
X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=47bb1aed07ba217fd7b24bfe555a222cd0ed82e7;p=moodle.git

merged fix for MDL-9160, get_my_courses caching issues
---

diff --git a/lib/datalib.php b/lib/datalib.php
index 80f09e81bb..3941a65627 100644
--- a/lib/datalib.php
+++ b/lib/datalib.php
@@ -685,8 +685,8 @@ function get_my_courses($userid, $sort='visible DESC,sortorder ASC', $fields='*'
     global $USER;
 
     if (!empty($USER->id) && ($USER->id == $userid)) {
-        if (!empty($USER->mycourses)) {
-            return $USER->mycourses;      // Just return the cached version
+        if (!empty($USER->mycourses[$doanything])) {
+            return $USER->mycourses[$doanything];      // Just return the cached version
         }
     }
 
@@ -771,7 +771,7 @@ ORDER BY $sort");
     }
 
     if (!empty($USER->id) && ($USER->id == $userid)) {
-        $USER->mycourses = $mycourses;
+        $USER->mycourses[$doanything] = $mycourses;
     }
 
     return $mycourses;