public function get_child_contexts() {
        global $DB;

        debugging('Fetching of system context child courses is strongly discouraged on production servers (it may eat all available memory)!');

        // Just get all the contexts except for CONTEXT_SYSTEM level
        // and hope we don't OOM in the process - don't cache
        $sql = "SELECT c.*
                  FROM {context} c
                 WHERE contextlevel > ".CONTEXT_SYSTEM;
        $records = $DB->get_records_sql($sql);

        $result = array();
        foreach ($records as $record) {
            $result[$record->id] = context::create_instance_from_record($record);
        }

        return $result;
    }
public function get_child_contexts() {
        global $DB;

        debugging('Fetching of system context child courses is strongly discouraged on production servers (it may eat all available memory)!');

        // Just get all the contexts except for CONTEXT_SYSTEM level
        // and hope we don't OOM in the process - don't cache
        $sql = "SELECT c.*
                  FROM {context} c
                 WHERE contextlevel > ".CONTEXT_SYSTEM;
        $records = $DB->get_records_sql($sql);

        $result = array();
        foreach ($records as $record) {
            $result[$record->id] = context::create_instance_from_record($record);
        }

        return $result;
    }
public function get_child_contexts ( ) { global $ DB ; debugging ( 'Fetching of system context child courses is strongly discouraged on production servers (it may eat all available memory)!' ) ; // Just get all the contexts except for CONTEXT_SYSTEM level // and hope we don't OOM in the process - don't cache $ sql = "SELECT c.*
                  FROM {context} c
                 WHERE contextlevel > " . CONTEXT_SYSTEM ; $ records = $ DB -> get_records_sql ( $ sql ) ; $ result = array ( ) ; foreach ( $ records as $ record ) { $ result [ $ record -> id ] = context :: create_instance_from_record ( $ record ) ; } return $ result ; }
Returns all site contexts except the system context, DO NOT call on production servers!!

Contexts are not cached.

@return array
Returns all site contexts except the system context DO NOT call on production servers!!