mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 04:30:15 +01:00
MDL-73394 admin_presets: New setting to store last preset applied
A new setting has been added to config_plugins to store the last preset identifier applied.
This commit is contained in:
parent
58a729f088
commit
bfa24ae53a
@ -399,6 +399,11 @@ class manager {
|
||||
$applied = array_merge($settingsapplied, $pluginsapplied);
|
||||
$skipped = array_merge($settingsskipped, $pluginsskipped);
|
||||
|
||||
if (!$simulate) {
|
||||
// Store it in a config setting as the last preset applied.
|
||||
set_config('lastpresetapplied', $presetid, 'tool_admin_presets');
|
||||
}
|
||||
|
||||
return [$applied, $skipped];
|
||||
}
|
||||
|
||||
|
@ -236,6 +236,14 @@ class manager_test extends \advanced_testcase {
|
||||
$this->assertArrayHasKey('assign', $enabledplugins);
|
||||
$enabledplugins = \core\plugininfo\qtype::get_enabled_plugins();
|
||||
$this->assertArrayHasKey('truefalse', $enabledplugins);
|
||||
|
||||
// Check the presetid has been also stored in the lastpresetapplied config setting.
|
||||
$this->assertEquals($presetid, get_config('tool_admin_presets', 'lastpresetapplied'));
|
||||
|
||||
// Call apply_preset as a simulation, so it shouldn't be applied and lastpresetapplied should still be $presetid.
|
||||
$presetid2 = $generator->create_preset();
|
||||
$manager->apply_preset($presetid2, true);
|
||||
$this->assertEquals($presetid, get_config('tool_admin_presets', 'lastpresetapplied'));
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user