MDL-70230 admin: add setting sched. task status

When defining settings that are used by scheduled tasks,
it is also useful, or even needed, to know the status
of that scheduled task to have the whole big picture of
that part of the system.

Based on the admin_setting_description, this new setting
reports its name, its status, a link to the configuration.

When adding a new setting of this type, the user can add
an extra description field to complete the whole meaning.
This commit is contained in:
Jordi Pujol Ahulló
2021-06-04 08:12:16 +02:00
parent 411150a424
commit 9c4510a358
7 changed files with 171 additions and 8 deletions
+9
View File
@@ -208,4 +208,13 @@ abstract class task_base {
public function get_pid() {
return $this->pid;
}
/**
* Informs whether the task's component is enabled.
* @return bool true when enabled. false otherwise.
*/
public function is_component_enabled(): bool {
$plugininfo = \core_plugin_manager::instance()->get_plugin_info($this->get_component());
return $plugininfo && $plugininfo->is_enabled();
}
}