Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Performance helper.

Copyright: 2016 Frédéric Massart - FMCorz.net
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 123 lines (4 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: performance_helper  - X-Ref

Performance helper class.

This tool keeps a local cache of certain items, which means that subsequent
calls to get the resource will not query the database. You will want to use
this when many resources could be shared and need to be queried in a loop.

Note that some of these improvements can only be achieved by knowing the
logic deeper in other modules. For instance we know that a competency's context
is the one of its framework. This tool must be kept in sync with those APIs.

get_context_from_competency(competency $competency)   X-Ref
Get the context of a competency.

param: competency $competency The competency.
return: \context

get_framework_from_competency(competency $competency)   X-Ref
Get the framework of a competency.

param: competency $competency The competency.
return: competency_framework

get_scale_from_competency(competency $competency)   X-Ref
Get the scale of a competency.

/!\ Make sure that this is always kept in sync with:
- core_competency\competency::get_scale()
- core_competency\competency_framework::get_scale()

param: competency $competency The competency.
return: \grade_scale

ingest_framework(competency_framework $framework)   X-Ref
Ingest a framework to avoid additional fetching.

param: competency_framework $framework The framework.
return: void