MDL-73342 admin_presets: Remove blocks from the core presets
This commit is contained in:
@@ -204,10 +204,10 @@ privatefiles,moodle|/user/files.php');
|
||||
static::add_plugin($presetid, 'availability', 'grouping', false);
|
||||
static::add_plugin($presetid, 'availability', 'profile', false);
|
||||
|
||||
// Blocks: Disable Activities, Blog menu, Blog tags, Comments, Course completion status, Course/site summary, Courses,
|
||||
// Flickr, Global search, Latest badges, Learning plans, Logged in user, Login, Main menu, Mentees, Network servers,
|
||||
// Private files, Recent blog entries, RSS feeds, Search forums, Section links,Self completion, Social activities,
|
||||
// Tags, YouTube.
|
||||
// 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, Private files,
|
||||
// Recent blog entries, Search forums, Section links, Social activities,Tags, YouTube.
|
||||
// Hidden by default: Course/site summary, RSS feeds, Self completion, Feedback.
|
||||
static::add_plugin($presetid, 'block', 'activity_modules', false);
|
||||
static::add_plugin($presetid, 'block', 'blog_menu', false);
|
||||
static::add_plugin($presetid, 'block', 'blog_tags', false);
|
||||
@@ -316,16 +316,15 @@ privatefiles,moodle|/user/files.php'
|
||||
static::add_plugin($presetid, 'availability', 'grouping', true);
|
||||
static::add_plugin($presetid, 'availability', 'profile', true);
|
||||
|
||||
// Blocks: Enable Activities, Blog menu, Blog tags, Comments, Course completion status, Course/site summary, Courses,
|
||||
// Flickr, Global search, Latest badges, Learning plans, Logged in user, Login, Main menu, Mentees, Network servers,
|
||||
// Private files, Recent blog entries, RSS feeds, Search forums, Section links,Self completion, Social activities,
|
||||
// Tags, YouTube.
|
||||
// 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, Private files,
|
||||
// Recent blog entries, Search forums, Section links, Social activities,Tags, YouTube.
|
||||
// Hidden by default: Course/site summary, RSS feeds, Self completion, Feedback.
|
||||
static::add_plugin($presetid, 'block', 'activity_modules', true);
|
||||
static::add_plugin($presetid, 'block', 'blog_menu', true);
|
||||
static::add_plugin($presetid, 'block', 'blog_tags', true);
|
||||
static::add_plugin($presetid, 'block', 'comments', true);
|
||||
static::add_plugin($presetid, 'block', 'completionstatus', true);
|
||||
static::add_plugin($presetid, 'block', 'course_summary', true);
|
||||
static::add_plugin($presetid, 'block', 'course_list', true);
|
||||
static::add_plugin($presetid, 'block', 'tag_flickr', true);
|
||||
static::add_plugin($presetid, 'block', 'globalsearch', true);
|
||||
@@ -338,13 +337,10 @@ privatefiles,moodle|/user/files.php'
|
||||
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', 'rss_client', true);
|
||||
static::add_plugin($presetid, 'block', 'search_forums', true);
|
||||
static::add_plugin($presetid, 'block', 'section_links', true);
|
||||
static::add_plugin($presetid, 'block', 'selfcompletion', true);
|
||||
static::add_plugin($presetid, 'block', 'social_activities', true);
|
||||
static::add_plugin($presetid, 'block', 'tags', true);
|
||||
static::add_plugin($presetid, 'block', 'feedback', true);
|
||||
|
||||
// Course formats: Enable Social format.
|
||||
static::add_plugin($presetid, 'format', 'social', true);
|
||||
|
||||
@@ -3538,5 +3538,34 @@ privatefiles,moodle|/user/files.php';
|
||||
upgrade_main_savepoint(true, 2021123000.03);
|
||||
}
|
||||
|
||||
if ($oldversion < 2022011100.01) {
|
||||
// The following blocks have been hidden by default, so they shouldn't be enabled in the Full core preset: Course/site
|
||||
// summary, RSS feeds, Self completion and Feedback.
|
||||
$params = ['name' => get_string('fullpreset', 'core_adminpresets'), 'iscore' => 1];
|
||||
$fullpreset = $DB->get_record('adminpresets', $params);
|
||||
|
||||
if ($fullpreset) {
|
||||
$blocknames = ['course_summary', 'feedback', 'rss_client', 'selfcompletion'];
|
||||
list($blocksinsql, $blocksinparams) = $DB->get_in_or_equal($blocknames);
|
||||
|
||||
// Remove entries from the adminpresets_app_plug table (in case the preset has been applied).
|
||||
$appliedpresets = $DB->get_records('adminpresets_app', ['adminpresetid' => $fullpreset->id], '', 'id');
|
||||
if ($appliedpresets) {
|
||||
list($appsinsql, $appsinparams) = $DB->get_in_or_equal(array_keys($appliedpresets));
|
||||
$sql = "adminpresetapplyid $appsinsql AND plugin='block' AND name $blocksinsql";
|
||||
$params = array_merge($appsinparams, $blocksinparams);
|
||||
$DB->delete_records_select('adminpresets_app_plug', $sql, $params);
|
||||
}
|
||||
|
||||
// Remove entries for these blocks from the adminpresets_plug table.
|
||||
$sql = "adminpresetid = ? AND plugin='block' AND name $blocksinsql";
|
||||
$params = array_merge([$fullpreset->id], $blocksinparams);
|
||||
$DB->delete_records_select('adminpresets_plug', $sql, $params);
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2022011100.01);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$version = 2022011100.00; // YYYYMMDD = weekly release date of this DEV branch.
|
||||
$version = 2022011100.01; // YYYYMMDD = weekly release date of this DEV branch.
|
||||
// RR = release increments - 00 in DEV branches.
|
||||
// .XX = incremental changes.
|
||||
$release = '4.0dev+ (Build: 20220111)'; // Human-friendly version name
|
||||
|
||||
Reference in New Issue
Block a user