Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are 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