Merge branch 'MDL-73833-master' of https://github.com/sarjona/moodle

This commit is contained in:
Andrew Nicols
2022-02-28 14:21:28 +08:00
2 changed files with 19 additions and 7 deletions
+15 -6
View File
@@ -926,13 +926,17 @@ class manager {
// Plugins.
$plugins = $DB->get_records('adminpresets_app_plug', ['adminpresetapplyid' => $presetappid]);
if ($plugins) {
$pluginmanager = \core_plugin_manager::instance();
foreach ($plugins as $plugin) {
$pluginclass = \core_plugin_manager::resolve_plugininfo_class($plugin->plugin);
$pluginclass::enable_plugin($plugin->name, (int) $plugin->oldvalue);
$visiblename = $plugin->plugin . '_' . $plugin->name;
if (get_string_manager()->string_exists('pluginname', $plugin->plugin . '_' . $plugin->name)) {
$visiblename = get_string('pluginname', $plugin->plugin . '_' . $plugin->name);
// Get the plugininfo object for this plugin, to get its proper visible name.
$plugininfo = $pluginmanager->get_plugin_info($plugin->plugin . '_' . $plugin->name);
if ($plugininfo != null) {
$visiblename = $plugininfo->displayname;
} else {
$visiblename = $plugin->plugin . '_' . $plugin->name;
}
// Output table.
@@ -1087,14 +1091,19 @@ class manager {
$strdisabled = get_string('disabled', 'core_adminpresets');
$plugins = $DB->get_records('adminpresets_plug', ['adminpresetid' => $presetid]);
$pluginmanager = \core_plugin_manager::instance();
foreach ($plugins as $plugin) {
$pluginclass = \core_plugin_manager::resolve_plugininfo_class($plugin->plugin);
$oldvalue = $pluginclass::get_enabled_plugin($plugin->name);
$visiblename = $plugin->plugin . '_' . $plugin->name;
if (get_string_manager()->string_exists('pluginname', $plugin->plugin . '_' . $plugin->name)) {
$visiblename = get_string('pluginname', $plugin->plugin . '_' . $plugin->name);
// Get the plugininfo object for this plugin, to get its proper visible name.
$plugininfo = $pluginmanager->get_plugin_info($plugin->plugin . '_' . $plugin->name);
if ($plugininfo != null) {
$visiblename = $plugininfo->displayname;
} else {
$visiblename = $plugin->plugin . '_' . $plugin->name;
}
if ($plugin->enabled > 0) {
$visiblevalue = $strenabled;
} else if ($plugin->enabled == 0) {
@@ -92,7 +92,7 @@ Feature: I can apply presets
And I should see "Server files" in the "Setting changes" "table"
And I should see "Show data retention summary" in the "Setting changes" "table"
And I should see "Social activities" in the "Setting changes" "table"
And I should see "Social format" in the "format" "table_row"
And I should see "Social format" in the "Setting changes" "table"
And I should see "Starred courses" in the "Setting changes" "table"
And I should see "Survey" in the "Setting changes" "table"
And I should see "Tags" in the "Setting changes" "table"
@@ -101,6 +101,9 @@ Feature: I can apply presets
And I should see "Wiki" in the "Setting changes" "table"
And I should see "Wikimedia" in the "Setting changes" "table"
And I should see "Workshop" in the "Setting changes" "table"
# Check filters and data formats strings are displayed properly.
And I should see "Activity names auto-linking" in the "Setting changes" "table"
And I should see "Javascript Object Notation (.json)" in the "Setting changes" "table"
# Apply the Starter preset.
And I click on "Apply" "button"
And I navigate to "Advanced features" in site administration