From af86bd3e4e06b167df084be280e5a202eaea78b3 Mon Sep 17 00:00:00 2001 From: John Rayes Date: Fri, 18 Sep 2026 03:33:01 -0700 Subject: [PATCH] Only remove permanent hooks if requested to --- Sources/IntegrationHook.php | 40 +++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/Sources/IntegrationHook.php b/Sources/IntegrationHook.php index b93d229395..524ce7d58b 100644 --- a/Sources/IntegrationHook.php +++ b/Sources/IntegrationHook.php @@ -305,25 +305,27 @@ public static function remove(string $name, string $function, bool $permanent = $enabled_call = rtrim($function, '!'); $disabled_call = $enabled_call . '!'; - // Get the permanent functions. - $request = Db::$db->query( - 'SELECT value - FROM {db_prefix}settings - WHERE variable = {string:variable}', - [ - 'variable' => $name, - ], - ); - list($current_functions) = Db::$db->fetch_row($request); - Db::$db->free_result($request); - - if (!empty($current_functions)) { - $current_functions = explode(',', $current_functions); - - // Cleanup enabled and disabled variants. - $current_functions = array_unique(array_diff($current_functions, [$enabled_call, $disabled_call])); - - Config::updateModSettings([$name => implode(',', $current_functions)]); + if ($permanent) { + // Get the permanent functions. + $request = Db::$db->query( + 'SELECT value + FROM {db_prefix}settings + WHERE variable = {string:variable}', + [ + 'variable' => $name, + ], + ); + list($current_functions) = Db::$db->fetch_row($request); + Db::$db->free_result($request); + + if (!empty($current_functions)) { + $current_functions = explode(',', $current_functions); + + // Cleanup enabled and disabled variants. + $current_functions = array_unique(array_diff($current_functions, [$enabled_call, $disabled_call])); + + Config::updateModSettings([$name => implode(',', $current_functions)]); + } } // Turn the function list into something usable.