Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 21 additions & 19 deletions Sources/IntegrationHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading