From ceff2e47a89acd6b5138593dd95ebc51c47cdef2 Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Mon, 12 Mar 2018 10:16:11 -0400 Subject: [PATCH] Fix issue processwire/processwire-issues#523 prevent user from uninstalling admin themes defined by `$config->defaultAdminTheme` --- wire/core/AdminTheme.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/wire/core/AdminTheme.php b/wire/core/AdminTheme.php index 0fd64ee5..ce7469b3 100644 --- a/wire/core/AdminTheme.php +++ b/wire/core/AdminTheme.php @@ -312,6 +312,14 @@ abstract class AdminTheme extends WireData implements Module { } public function ___uninstall() { + + $defaultAdminTheme = $this->wire('config')->defaultAdminTheme; + if($defaultAdminTheme == $this->className()) { + throw new WireException( + "Cannot uninstall this admin theme because \$config->defaultAdminTheme = '$defaultAdminTheme'; " . + "Please add this setting with a different value in /site/config.php" + ); + } /* if(self::$numAdminThemes > 1) return;