]> 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>
Sun, 19 Dec 2021 12:23:45 +0000 (13:23 +0100)
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 582b9aa68165d511c157800ed185766023a1b786..b3a7d9f5225ad9a36d5f09700443a5b673f98c79 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