MDL-53977 enrol_lti: a hack to workaround a hack to utilise DB caching
authorMark Nelson <markn@moodle.com>
Mon, 2 May 2016 07:34:15 +0000 (15:34 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Fri, 6 May 2016 01:27:34 +0000 (09:27 +0800)
enrol/lti/classes/helper.php

index f6a006a..d2d6336 100644 (file)
@@ -267,7 +267,10 @@ class helper {
             $instance->enrol = 'lti';
             $instance->status = $tool->status;
             $ltienrol = enrol_get_plugin('lti');
-            $ltienrol->enrol_user($instance, $userid, null, time(), $timeend);
+
+            // Hack - need to do this to workaround DB caching hack. See MDL-53977.
+            $timestart = intval(substr(time(), 0, 8) . '00') - 1;
+            $ltienrol->enrol_user($instance, $userid, null, $timestart, $timeend);
         }
 
         return self::ENROLMENT_SUCCESSFUL;