Skip to content
Snippets Groups Projects
Commit bfb2cac2 authored by Alexander Bias's avatar Alexander Bias
Browse files

Remove user preferences when being uninstalled.

parent f97256c1
Branches
Tags
No related merge requests found
...@@ -6,6 +6,7 @@ Changes ...@@ -6,6 +6,7 @@ Changes
### Unreleased ### Unreleased
* 2019-03-28 - Remove user preferences when being uninstalled.
* 2019-03-28 - Prepare the plugin that the hooks for fetching the course news will be removed in Moodle 3.7. If installed on Moodle 3.7, this plugin will silently disable the course news feature even if it is enabled in the plugin settings. * 2019-03-28 - Prepare the plugin that the hooks for fetching the course news will be removed in Moodle 3.7. If installed on Moodle 3.7, this plugin will silently disable the course news feature even if it is enabled in the plugin settings.
* 2019-03-28 - Check compatibility for Moodle 3.6, no functionality change. * 2019-03-28 - Check compatibility for Moodle 3.6, no functionality change.
* 2018-12-05 - Changed travis.yml due to upstream changes. * 2018-12-05 - Changed travis.yml due to upstream changes.
......
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Block "course overview (campus)" - Uninstall file
*
* @package block_course_overview_campus
* @copyright 2019 Alexander Bias, Ulm University <alexander.bias@uni-ulm.de>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
function xmldb_block_course_overview_campus_uninstall() {
global $DB;
// The plugin uninstall process in Moodle core will take care of removing the plugin configuration, but not of removing the
// user preferences which we have set for the users. We have to remove them ourselves.
// We remove them directly from the DB table and don't use unset_user_preference() as the cache is cleared anyway directly
// after the plugin has been uninstalled.
$like = $DB->sql_like('name', '?', true, true, false, '|');
$params = array($DB->sql_like_escape('block_course_overview_campus-', '|') . '%');
$DB->delete_records_select('user_preferences', $like, $params);
$like = $DB->sql_like('name', '?', true, true, false, '|');
$params = array($DB->sql_like_escape('local_boostcoc-', '|') . '%');
$DB->delete_records_select('user_preferences', $like, $params);
return true;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment