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

This commit is contained in:
Eloy Lafuente (stronk7)
2022-02-22 00:06:53 +01:00
2 changed files with 38 additions and 0 deletions
@@ -113,6 +113,18 @@ Feature: I can apply presets
And I navigate to "Plugins > Question types > Manage question types" in site administration
And "Enabled" "icon" should not exist in the "Calculated multichoice" "table_row"
Scenario: Re-applying Starter Moodle preset does not display setting changes
# Apply Starter preset.
Given I navigate to "Site admin presets" in site administration
And I open the action menu in "Starter" "table_row"
And I choose "Review settings and apply" in the open action menu
And I click on "Apply" "button"
And I click on "Continue" "button"
# When the Starter preset it's applied again, no changes should be displayed.
When I open the action menu in "Starter" "table_row"
And I choose "Review settings and apply" in the open action menu
Then I should not see "Setting changes"
Scenario: Applied exported settings
Given I navigate to "Site admin presets" in site administration
And I click on "Create preset" "button"
+26
View File
@@ -51,6 +51,32 @@ class repository extends base {
return $DB->get_records_menu('repository', null, 'type ASC', 'type, type AS val');
}
/**
* Returns current status for a pluginname.
*
* Repositories needs to be calculated in a different way than the default method in the base class because they need to take
* into account the value of the visible column too.
*
* @param string $pluginname The plugin name to check.
* @return int The current status (enabled, disabled...) of $pluginname.
*/
public static function get_enabled_plugin(string $pluginname): int {
global $DB;
$repository = $DB->get_record('repository', ['type' => $pluginname]);
if ($repository) {
switch ($repository->visible) {
case 1:
$value = self::REPOSITORY_ON;
break;
default:
$value = self::REPOSITORY_OFF;
}
} else {
$value = self::REPOSITORY_DISABLED;
}
return $value;
}
/**
* Enable or disable a plugin.