public static function preload_course($courseid) {
        // Users can call this multiple times without doing any harm
        if (isset(context::$cache_preloaded[$courseid])) {
            return;
        }
        $coursecontext = context_course::instance($courseid);
        $coursecontext->get_child_contexts();

        context::$cache_preloaded[$courseid] = true;
    }
public static function preload_course($courseid) {
        // Users can call this multiple times without doing any harm
        if (isset(context::$cache_preloaded[$courseid])) {
            return;
        }
        $coursecontext = context_course::instance($courseid);
        $coursecontext->get_child_contexts();

        context::$cache_preloaded[$courseid] = true;
    }
public static function preload_course ( $ courseid ) { // Users can call this multiple times without doing any harm if ( isset ( context :: $ cache_preloaded [ $ courseid ] ) ) { return ; } $ coursecontext = context_course :: instance ( $ courseid ) ; $ coursecontext -> get_child_contexts ( ) ; context :: $ cache_preloaded [ $ courseid ] = true ; }
Preload all contexts instances from course.

To be used if you expect multiple queries for course activities...

@static
@param int $courseid
Preload all contexts instances from course .