From: Stefan Schantl Date: Wed, 14 Apr 2021 18:18:47 +0000 (+0200) Subject: ids.cgi: Introduce remove_provider(). X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6d2cf023563fd17d056d17511043eb54544e998f;p=people%2Fstevee%2Fipfire-2.x.git ids.cgi: Introduce remove_provider(). This function is used to remove a configured provider by it's ID. Signed-off-by: Stefan Schantl --- diff --git a/html/cgi-bin/ids.cgi b/html/cgi-bin/ids.cgi index 8698842357..b85f9f0c34 100644 --- a/html/cgi-bin/ids.cgi +++ b/html/cgi-bin/ids.cgi @@ -2062,6 +2062,24 @@ sub get_provider_name($) { return $provider_name; } +# +## Function to remove a provider by a given ID. +# +sub remove_provider($) { + my ($id) = @_; + + my %used_providers = (); + + # Read-in provider settings file. + &General::readhasharray($IDS::providers_settings_file, \%used_providers); + + # Drop entry from the hash. + delete($used_providers{$id}); + + # Write the changed hash to the provider settings file. + &General::writehasharray($IDS::providers_settings_file, \%used_providers); +} + # ## Private function to convert a given rulefile to a category name. ## ( No file extension anymore and if the name contained a dot, it