From d0d0af289ddd2b543a878da56b7fa941148a1582 Mon Sep 17 00:00:00 2001 From: slawkens Date: Sun, 20 Apr 2025 21:32:46 +0200 Subject: [PATCH] Refactor code + use clearCache() instead --- system/src/Plugins.php | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/system/src/Plugins.php b/system/src/Plugins.php index f6711a3a..a0910b01 100644 --- a/system/src/Plugins.php +++ b/system/src/Plugins.php @@ -793,25 +793,19 @@ class Plugins { } } - if($success) { - foreach($plugin_info['uninstall'] as $file) { - if(!deleteDirectory(BASE . $file)) { - self::$warnings[] = 'Cannot delete: ' . $file; - } - } - - $cache = Cache::getInstance(); - if($cache->enabled()) { - $cache->delete('templates'); - $cache->delete('hooks'); - $cache->delete('template_menus'); - } - - return true; + if(!$success) { + $revertEnable(); + return false; } - $revertEnable(); - return false; + foreach($plugin_info['uninstall'] as $file) { + if(!deleteDirectory(BASE . $file)) { + self::$warnings[] = 'Cannot delete: ' . $file; + } + } + + clearCache(); + return true; } public static function is_installed($plugin_name, $version): bool