From f149e58990918177c0a01821e575e4e44d30c09f Mon Sep 17 00:00:00 2001 From: Mark Nielsen Date: Mon, 16 Jun 2014 15:10:30 -0700 Subject: [PATCH] MDL-46013 theme: Uninstall theme unconditionally unsets configs --- lib/classes/plugininfo/theme.php | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/lib/classes/plugininfo/theme.php b/lib/classes/plugininfo/theme.php index d5106ea9676..f7a5868957a 100644 --- a/lib/classes/plugininfo/theme.php +++ b/lib/classes/plugininfo/theme.php @@ -63,9 +63,25 @@ class theme extends base { $DB->set_field('user', 'theme', '', array('theme'=>$this->name)); $DB->set_field('mnet_host', 'theme', '', array('theme'=>$this->name)); - unset_config('thememobile'); - unset_config('themetablet'); - unset_config('themelegacy'); + if (get_config('core', 'thememobile') === $this->name) { + unset_config('thememobile'); + } + if (get_config('core', 'themetablet') === $this->name) { + unset_config('themetablet'); + } + if (get_config('core', 'themelegacy') === $this->name) { + unset_config('themelegacy'); + } + + $themelist = get_config('core', 'themelist'); + if (!empty($themelist)) { + $themes = explode(',', $themelist); + $key = array_search($this->name, $themes); + if ($key !== false) { + unset($themes[$key]); + set_config('themelist', implode(',', $themes)); + } + } parent::uninstall_cleanup(); }