Commit f3a3e234 authored by Ankit Agarwal's avatar Ankit Agarwal
Browse files

MDL-57115 blocks: Cleanup block_messages instances and other configs

parent 898ba89b
......@@ -9,6 +9,7 @@ information provided here is intended especially for developers.
* Blocks can now be included in Moodle global search, with some limitations (at present, the search
works only for blocks located directly on course pages or site home page). See the HTML block for
an example.
* Block block_messages is no longer a part of core.
=== 3.3 ===
......
......@@ -1647,7 +1647,7 @@ class core_plugin_manager {
$plugins = array(
'qformat' => array('blackboard', 'learnwise'),
'auth' => array('radius', 'fc', 'nntp', 'pam', 'pop3', 'imap'),
'block' => array('course_overview'),
'block' => array('course_overview', 'messages'),
'enrol' => array('authorize'),
'report' => array('search'),
'repository' => array('alfresco'),
......@@ -1715,7 +1715,7 @@ class core_plugin_manager {
'calendar_upcoming', 'comments', 'community',
'completionstatus', 'course_list', 'course_summary',
'feedback', 'globalsearch', 'glossary_random', 'html',
'login', 'lp', 'mentees', 'messages', 'mnet_hosts', 'myoverview', 'myprofile',
'login', 'lp', 'mentees', 'mnet_hosts', 'myoverview', 'myprofile',
'navigation', 'news_items', 'online_users', 'participants',
'private_files', 'quiz_results', 'recent_activity',
'rss_client', 'search_forums', 'section_links',
......
......@@ -2436,5 +2436,41 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2017082800.00);
}
if ($oldversion < 2017091000.00) {
if (!file_exists($CFG->dirroot . '/blocks/messages/block_messages.php')) {
// Delete instances.
$instances = $DB->get_records_list('block_instances', 'blockname', ['messages']);
$instanceids = array_keys($instances);
if (!empty($instanceids)) {
$DB->delete_records_list('block_positions', 'blockinstanceid', $instanceids);
$DB->delete_records_list('block_instances', 'id', $instanceids);
list($sql, $params) = $DB->get_in_or_equal($instanceids, SQL_PARAMS_NAMED);
$params['contextlevel'] = CONTEXT_BLOCK;
$DB->delete_records_select('context', "contextlevel=:contextlevel AND instanceid " . $sql, $params);
$preferences = array();
foreach ($instances as $instanceid => $instance) {
$preferences[] = 'block' . $instanceid . 'hidden';
$preferences[] = 'docked_block_instance_' . $instanceid;
}
$DB->delete_records_list('user_preferences', 'name', $preferences);
}
// Delete the block from the block table.
$DB->delete_records('block', array('name' => 'messages'));
// Remove capabilities.
capabilities_cleanup('block_messages');
// Clean config.
unset_all_config_for_plugin('block_messages');
}
upgrade_main_savepoint(true, 2017091000.00);
}
return true;
}
......@@ -29,7 +29,7 @@
defined('MOODLE_INTERNAL') || die();
$version = 2017090700.00; // YYYYMMDD = weekly release date of this DEV branch.
$version = 2017091000.00; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment