MDL-49489 caching: Prevent full coursecontact purge
authorSkylar Kelty <S.Kelty@kent.ac.uk>
Mon, 16 Mar 2015 09:22:53 +0000 (09:22 +0000)
committerSkylar Kelty <S.Kelty@kent.ac.uk>
Mon, 16 Mar 2015 09:22:53 +0000 (09:22 +0000)
lib/coursecatlib.php

index a027c55..7dad744 100644 (file)
@@ -713,7 +713,8 @@ class coursecat implements renderable, cacheable_object, IteratorAggregate {
         if (empty($cacheddata['basic']) || $cacheddata['basic']['roles'] !== $CFG->coursecontact ||
                 $cacheddata['basic']['lastreset'] < time() - self::CACHE_COURSE_CONTACTS_TTL) {
             // Reset cache.
         if (empty($cacheddata['basic']) || $cacheddata['basic']['roles'] !== $CFG->coursecontact ||
                 $cacheddata['basic']['lastreset'] < time() - self::CACHE_COURSE_CONTACTS_TTL) {
             // Reset cache.
-            $cache->purge();
+            $keys = $DB->get_fieldset_select('course', 'id', '');
+            $cache->delete_many($keys);
             $cache->set('basic', array('roles' => $CFG->coursecontact, 'lastreset' => time()));
             $cacheddata = $cache->get_many(array_merge(array('basic'), array_keys($courses)));
         }
             $cache->set('basic', array('roles' => $CFG->coursecontact, 'lastreset' => time()));
             $cacheddata = $cache->get_many(array_merge(array('basic'), array_keys($courses)));
         }