MDL-84652 core: Remove block_mnet_hosts dependencies

- Remove block_mnet_hosts from the standard plugins
- Remove block_mnet_hosts from default admin presets
- Replace block_mnet_hosts in behat tests of core features

Original issue: MDL-84309

Signed-off-by: Daniel Ziegenberg <[email protected]>
This commit is contained in:
Daniel Ziegenberg
2025-03-07 10:49:58 +08:00
committed by Jun Pataleta
parent 660f12dc7c
commit 60f7db3a93
7 changed files with 16 additions and 10 deletions
@@ -0,0 +1,5 @@
issueNumber: MDL-84309
notes:
core_adminpresets:
- message: Removed block_mnet_hosts from admin presets
type: removed
+2 -4
View File
@@ -207,7 +207,7 @@ class helper {
static::add_plugin($presetid, 'availability', 'profile', false);
// Blocks: Hide Activities, Blog menu, Blog tags, Comments, Course completion status, Courses, Flickr,
// Global search, Latest badges, Learning plans, Logged in user, Login, Main menu, Mentees, Network servers, Online users,
// Global search, Latest badges, Learning plans, Logged in user, Login, Main menu, Mentees, Online users,
// Private files, Recent blog entries, Recently accessed courses, Search forums, Section links, Social activities,
// Starred courses, Tags, YouTube.
// Hidden by default: Course/site summary, RSS feeds, Self completion, Feedback.
@@ -226,7 +226,6 @@ class helper {
static::add_plugin($presetid, 'block', 'login', false);
static::add_plugin($presetid, 'block', 'site_main_menu', false);
static::add_plugin($presetid, 'block', 'mentees', false);
static::add_plugin($presetid, 'block', 'mnet_hosts', false);
static::add_plugin($presetid, 'block', 'private_files', false);
static::add_plugin($presetid, 'block', 'blog_recent', false);
static::add_plugin($presetid, 'block', 'rss_client', false);
@@ -313,7 +312,7 @@ class helper {
static::add_plugin($presetid, 'availability', 'profile', true);
// Blocks: Enable Activities, Blog menu, Blog tags, Comments, Course completion status, Courses, Flickr,
// Global search, Latest badges, Learning plans, Logged in user, Login, Main menu, Mentees, Network servers, Online users,
// Global search, Latest badges, Learning plans, Logged in user, Login, Main menu, Mentees, Online users,
// Private files, Recent blog entries, Recently accessed courses, Search forums, Section links, Social activities,
// Starred courses, Tags, YouTube.
// Hidden by default: Course/site summary, RSS feeds, Self completion, Feedback.
@@ -331,7 +330,6 @@ class helper {
static::add_plugin($presetid, 'block', 'login', true);
static::add_plugin($presetid, 'block', 'site_main_menu', true);
static::add_plugin($presetid, 'block', 'mentees', true);
static::add_plugin($presetid, 'block', 'mnet_hosts', true);
static::add_plugin($presetid, 'block', 'private_files', true);
static::add_plugin($presetid, 'block', 'blog_recent', true);
static::add_plugin($presetid, 'block', 'search_forums', true);
@@ -73,7 +73,6 @@ Feature: I can apply presets
And "Maximum number of attachments" row "Current value" column of "Setting changes" table should contain "9"
And "Maximum number of attachments" row "New value" column of "Setting changes" table should contain "3"
And I should see "Mentees" in the "Setting changes" "table"
And I should see "Network servers" in the "Setting changes" "table"
And I should see "Numerical" in the "Setting changes" "table"
And I should see "Online users" in the "Setting changes" "table"
And I should see "Private files" in the "Setting changes" "table"
@@ -25,13 +25,13 @@ Feature: Edit capabilities
And I click on "Edit Teacher role" "link"
And I fill the capabilities form with the following permissions:
| capability | permission |
| block/mnet_hosts:myaddinstance | Allow |
| block/online_users:myaddinstance | Allow |
| moodle/site:messageanyuser | Inherit |
| moodle/grade:managesharedforms | Prevent |
| moodle/course:request | Prohibit |
And I press "Save changes"
When I follow "Edit Teacher role"
Then "block/mnet_hosts:myaddinstance" capability has "Allow" permission
Then "block/online_users:myaddinstance" capability has "Allow" permission
And "moodle/site:messageanyuser" capability has "Not set" permission
And "moodle/grade:managesharedforms" capability has "Prevent" permission
And "moodle/course:request" capability has "Prohibit" permission
+4
View File
@@ -1495,7 +1495,11 @@ function xmldb_main_upgrade($oldversion) {
if ($oldversion < 2025030400.04) {
if (!file_exists($CFG->dirroot . "/blocks/mnet_hosts/version.php")) {
uninstall_plugin('block', 'mnet_hosts');
// Delete all the admin preset plugin states concerning mnet_hosts in adminpresets_plug table.
$DB->delete_records('adminpresets_plug', ['name' => 'mnet_hosts']);
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2025030400.04);
}
+1 -1
View File
@@ -100,7 +100,6 @@
"login",
"lp",
"mentees",
"mnet_hosts",
"myoverview",
"myprofile",
"navigation",
@@ -584,6 +583,7 @@
"community",
"course_overview",
"messages",
"mnet_hosts",
"participants",
"quiz_results"
],
+2 -2
View File
@@ -318,7 +318,7 @@ final class component_test extends \advanced_testcase {
$this->assertSame('auth_mnet', component::normalize_componentname('auth_mnet'));
$this->assertSame('enrol_self', component::normalize_componentname('enrol_self'));
$this->assertSame('block_html', component::normalize_componentname('block_html'));
$this->assertSame('block_mnet_hosts', component::normalize_componentname('block_mnet_hosts'));
$this->assertSame('auth_oauth2', component::normalize_componentname('auth_oauth2'));
$this->assertSame('local_amos', component::normalize_componentname('local_amos'));
$this->assertSame('local_admin', component::normalize_componentname('local_admin'));
@@ -396,7 +396,7 @@ final class component_test extends \advanced_testcase {
[['auth', 'mnet'], 'auth_mnet'],
[['enrol', 'self'], 'enrol_self'],
[['block', 'html'], 'block_html'],
[['block', 'mnet_hosts'], 'block_mnet_hosts'],
[['auth', 'oauth2'], 'auth_oauth2'],
[['local', 'amos'], 'local_amos'],
[['local', 'admin'], 'local_admin'],