]> git.ipfire.org Git - people/stevee/ipfire-2.x.git/commitdiff
ids.cgi: Introduce remove_provider().
authorStefan Schantl <stefan.schantl@ipfire.org>
Wed, 14 Apr 2021 18:18:47 +0000 (20:18 +0200)
committerStefan Schantl <stefan.schantl@ipfire.org>
Tue, 3 Aug 2021 17:25:54 +0000 (19:25 +0200)
This function is used to remove a configured provider by it's ID.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
html/cgi-bin/ids.cgi

index 8698842357856605d88d89299cb286a5b47d83e3..b85f9f0c3475971f096f90b67959d6e614dd02c7 100644 (file)
@@ -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