Skip to content

Commit 07c78ce

Browse files
committed
Update solve #13 capability is checked before plugin is installed on Moodle 4.5
1 parent 4e866d7 commit 07c78ce

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

classes/hook/before_http_headers.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
use context_course;
3535
use context_system;
36+
use core_plugin_manager;
3637

3738
/**
3839
* Class before_http_headers.
@@ -50,13 +51,20 @@ class before_http_headers {
5051
*/
5152
public static function callback(): void {
5253

53-
global $COURSE, $PAGE;
54+
global $COURSE, $PAGE , $CFG;
5455

5556
if (isloggedin() === false) {
5657
return;
5758
}
5859

5960
$context = empty($COURSE->id) ? context_system::instance() : context_course::instance($COURSE->id);
61+
62+
// Check if the plugin is installed.
63+
$plugininfo = core_plugin_manager::instance()->get_plugin_info('local_commander');
64+
if (empty($plugininfo->versiondb)) {
65+
return;
66+
}
67+
6068
if (!has_capability('local/commander:display', $context)) {
6169
return;
6270
}

version.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
**/
2626
defined('MOODLE_INTERNAL') || die();
2727

28-
$plugin->release = '4.5.0';
28+
$plugin->release = '4.5.1';
2929
$plugin->maturity = MATURITY_STABLE;
30-
$plugin->version = 2024101002;
30+
$plugin->version = 2024111700;
3131
$plugin->requires = 2015111602;
3232
$plugin->component = 'local_commander';
3333
$plugin->supported = [39, 405];

0 commit comments

Comments
 (0)