Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
|
A check object returns a result object. More...
Public Member Functions | |
__construct ($status, $summary, $details='') | |
Constructor. | |
export_for_template (\renderer_base $output) | |
Export this data so it can be used as the context for a mustache template. | |
get_details () | |
Get the check detailed info. | |
get_ref () | |
Get the check reference label. | |
get_status () | |
Get the check status. | |
get_summary () | |
Summary of the check. | |
get_template_name () | |
Which mustache template? | |
Public Attributes | |
const | CRITICAL = 'critical' |
This is used to notify if a check is a major critical issue. | |
const | ERROR = 'error' |
This is used to notify if a check failed. | |
const | INFO = 'info' |
This is used to show info for a check. | |
const | NA = 'na' |
This is used to notify if a check does not apply. | |
const | OK = 'ok' |
Ideally all checks should be ok. | |
const | UNKNOWN = 'unknown' |
This means we could not determine the state. | |
const | WARNING = 'warning' |
Warnings. | |
Protected Attributes | |
string | $details = '' |
details about check. | |
string | $status = self::UNKNOWN |
$status - status | |
string | $summary = '' |
summary - should be roughly 1 line of plain text and may change depending on the state. | |
A check object returns a result object.
Most checks can use this an instance of this directly but if you have a 'details' which is computationally expensive then extend this and overide the get_details() method so that it is only called when it will be needed.
core\check\result::__construct | ( | $status, | |
$summary, | |||
$details = '' ) |
Constructor.
string | $status | code |
string | $summary | a 1 liner summary |
string | $details | as a html chunk |
core\check\result::export_for_template | ( | \renderer_base | $output | ) |
Export this data so it can be used as the context for a mustache template.
renderer_base | $output | typically, the renderer that's calling this function |
array | data context for a mustache template |
core\check\result::get_details | ( | ) |
Get the check detailed info.
string | formatted html |
Reimplemented in core\check\access\riskbackup_result, and core\check\access\riskxss_result.
core\check\result::get_ref | ( | ) |
Get the check reference label.
string | must be globally unique |
core\check\result::get_status | ( | ) |
Get the check status.
string | one of the consts eg result\OK |
core\check\result::get_summary | ( | ) |
Summary of the check.
string | formatted html |
core\check\result::get_template_name | ( | ) |
Which mustache template?
string | path to mustache template |
|
protected |
details about check.
This may be a large amount of preformatted html text, possibly describing all the different states and actions to address them.
const core\check\result::CRITICAL = 'critical' |
This is used to notify if a check is a major critical issue.
An error which is affecting everyone in a major way.
const core\check\result::ERROR = 'error' |
This is used to notify if a check failed.
Something is wrong with a component and a feature is not working.
const core\check\result::INFO = 'info' |
This is used to show info for a check.
This is equivalent to OK but could be used for alerting to potential future warnings such as a deprecation in a service.
const core\check\result::NA = 'na' |
This is used to notify if a check does not apply.
In most cases if a check doesn't apply a check object shouldn't be made. This state exists for when you always want visibilty of the check itself. Can be useful for a check which depends on another check and it helps focus on the other check which matters more.
const core\check\result::UNKNOWN = 'unknown' |
This means we could not determine the state.
An example might be an expensive check done via cron, and it has never run. It would be prudent to consider an unknown check as a warning or error.
const core\check\result::WARNING = 'warning' |
Warnings.
Something is not ideal and should be addressed, eg usability or the speed of the site may be affected, but it may self heal (eg a load spike)