From f0f44dbd84063c3e56732ede07c4f2ef8f4b9a1d Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Wed, 8 May 2019 00:46:13 -0400 Subject: [PATCH 1/2] Delete all addon hooks by default on uninstall --- src/Core/Addon.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Core/Addon.php b/src/Core/Addon.php index b6f64ad742..2ec46b71c1 100644 --- a/src/Core/Addon.php +++ b/src/Core/Addon.php @@ -149,6 +149,8 @@ class Addon extends BaseObject $func(); } + DBA::delete('hook', ['file' => 'addon/' . $addon . '/' . $addon . '.php']); + unset(self::$addons[array_search($addon, self::$addons)]); Addon::saveEnabledList(); From 5ff5325e14667d86f78d232cb9d4702944e7e4e3 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Wed, 8 May 2019 00:46:42 -0400 Subject: [PATCH 2/2] Uninstall addon when it wasn't found when accessed from admin aside --- src/Module/Admin/Addons/Details.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Module/Admin/Addons/Details.php b/src/Module/Admin/Addons/Details.php index 33e7c7a00c..1fadf6768b 100644 --- a/src/Module/Admin/Addons/Details.php +++ b/src/Module/Admin/Addons/Details.php @@ -48,7 +48,8 @@ class Details extends BaseAdminModule $addon = $a->argv[2]; $addon = Strings::sanitizeFilePathItem($addon); if (!is_file("addon/$addon/$addon.php")) { - notice(L10n::t('Item not found.')); + notice(L10n::t('Addon not found.')); + Addon::uninstall($addon); $a->internalRedirect('admin/addons'); }