diff --git a/README.md b/README.md index a7e00ab..dc10381 100644 --- a/README.md +++ b/README.md @@ -103,10 +103,11 @@ what matters. ## Branches -| Moodle version | Branch | PHP | Excimer | -|-------------------|------------------|------|------------| -| Moodle 3.5+ | MOODLE_35_STABLE | 7.1+ | 1.0.2+ | -| Totara 10+ | MOODLE_35_STABLE | 7.1+ | 1.0.2+ | +| Moodle version | Branch | PHP | Excimer | +|-------------------|------------------|-------|------------| +| Moodle 4.3+ | MOODLE_403_STABLE | 8.1 | 2024110100 | +| Moodle 3.5+ | MOODLE_35_STABLE | 7.1+ | 1.0.2+ | +| Totara 10+ | MOODLE_35_STABLE | 7.1+ | 1.0.2+ | ## Installation diff --git a/classes/local/hooks/after_config.php b/classes/local/hooks/after_config.php new file mode 100644 index 0000000..faf8568 --- /dev/null +++ b/classes/local/hooks/after_config.php @@ -0,0 +1,65 @@ +. + +namespace tool_excimer\local\hooks; + +use tool_excimer\manager; + +/** + * Class after_config + * + * @package tool_excimer + * @author Sumaiya Javed + * @copyright 2024, Catalyst IT + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class after_config { + + /** + * Hook to be run after initial site config. + * + * This allows the plugin to selectively activate the ExcimerProfiler while + * having access to the database. If the site does not have the MDL-75014 + * available then the timer will be started at this point. It means that + * the initialisation of the request up to this point will not be captured + * by the profiler. This eliminates the need for an + * auto_prepend_file/auto_append_file. + * + * See also https://docs.moodle.org/dev/Login_callbacks#after_config. + * + * @param \core\hook\after_config $hook + * return void + */ + public static function callback(\core\hook\after_config $hook): void { + + global $CFG; + + if (during_initial_install() || isset($CFG->upgraderunning)) { + // Do nothing during installation or upgrade. + return; + } + + try { + // Start processor. + $manager = manager::get_instance(); + $manager->start_processor(); + } catch (\Exception $exception) { + debugging('tool_excimer_after_config error', + DEBUG_DEVELOPER, $exception->getTrace()); + } + + } +} diff --git a/db/hooks.php b/db/hooks.php new file mode 100644 index 0000000..09f3522 --- /dev/null +++ b/db/hooks.php @@ -0,0 +1,35 @@ +. + +/** + * Hook callbacks for tool_excimer + * + * @package tool_excimer + * @author Sumaiya Javed + * @copyright 2024, Catalyst IT + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + +$callbacks = [ + [ + 'hook' => \core\hook\after_config::class, + 'callback' => 'tool_excimer\local\hooks\after_config::callback', + 'priority' => 0, + ], +]; + diff --git a/lib.php b/lib.php index f766b67..f7cab13 100644 --- a/lib.php +++ b/lib.php @@ -37,23 +37,6 @@ function tool_excimer_before_session_start() { $manager = manager::get_instance(); } -/** - * Hook to be run after initial site config. - * - * This allows the plugin to selectively activate the ExcimerProfiler while - * having access to the database. If the site does not have the MDL-75014 available, then the timer will be - * started at this point. It means that the initialisation of the - * request up to this point will not be captured by the profiler. This - * eliminates the need for an auto_prepend_file/auto_append_file. - * - * See also https://docs.moodle.org/dev/Login_callbacks#after_config. - */ -function tool_excimer_after_config(): void { - // Start processor. - $manager = manager::get_instance(); - $manager->start_processor(); -} - /** * Hook to obtain a list of perfomence checks supplied by the plugin. * diff --git a/version.php b/version.php index 0018c95..d2c196a 100644 --- a/version.php +++ b/version.php @@ -25,13 +25,11 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2024091600; -$plugin->release = 2024091600; -$plugin->requires = 2017051500; // Moodle 3.3 for Totara support. -$plugin->supported = [35, 401]; // Supports Moodle 3.5 or later. -// TODO $plugin->incompatible = ; // Available as of Moodle 3.9.0 or later. - +$plugin->version = 2024110100; +$plugin->release = 2024110100; +$plugin->requires = 2023100900; // Moodle 4.3. +$plugin->supported = [403, 405]; $plugin->component = 'tool_excimer'; $plugin->maturity = MATURITY_STABLE; - $plugin->dependencies = []; +