mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 17:06:53 +02:00
MDL-37813 remove missing filters when configuring string filters and fix filter uninstall
This commit is contained in:
parent
4e47920f08
commit
a67ea663b1
3 changed files with 59 additions and 14 deletions
|
@ -112,11 +112,25 @@ class filter extends base {
|
|||
* @private
|
||||
*/
|
||||
public function uninstall_cleanup() {
|
||||
global $DB;
|
||||
global $DB, $CFG;
|
||||
|
||||
$DB->delete_records('filter_active', array('filter' => $this->name));
|
||||
$DB->delete_records('filter_config', array('filter' => $this->name));
|
||||
|
||||
if (empty($CFG->filterall)) {
|
||||
$stringfilters = array();
|
||||
} else if (!empty($CFG->stringfilters)) {
|
||||
$stringfilters = explode(',', $CFG->stringfilters);
|
||||
$stringfilters = array_combine($stringfilters, $stringfilters);
|
||||
} else {
|
||||
$stringfilters = array();
|
||||
}
|
||||
|
||||
unset($stringfilters[$this->name]);
|
||||
|
||||
set_config('stringfilters', implode(',', $stringfilters));
|
||||
set_config('filterall', !empty($stringfilters));
|
||||
|
||||
parent::uninstall_cleanup();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue