From 4c7c5137c5289fa07695eff21c521343bedd954f Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 22 Apr 2022 07:42:31 +0000 Subject: check if addons have been removed from the filesystem and also remove them from the db if that is the case --- include/plugin.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/include/plugin.php b/include/plugin.php index f9cee7ed6..a17f5761d 100644 --- a/include/plugin.php +++ b/include/plugin.php @@ -275,13 +275,16 @@ function plugins_sync() { if(! array_walk($plugins_arr,'array_trim')) return; - App::$plugins = $plugins_arr; - $installed_arr = []; if(count($installed)) { foreach($installed as $i) { - if(! in_array($i, $plugins_arr)) { + if (! file_exists('addon/' . $i . '/' . $i . '.php')) { + q("DELETE FROM addon WHERE aname = '%s' ", + dbesc($i) + ); + } + elseif(! in_array($i, $plugins_arr)) { unload_plugin($i); } else { @@ -298,6 +301,8 @@ function plugins_sync() { } } + App::$plugins = $installed_arr; + } -- cgit v1.2.3