ids.cgi: Introduce remove_provider().

This function is used to remove a configured provider by it's ID.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
This commit is contained in:
Stefan Schantl
2021-04-14 20:18:47 +02:00
parent 697787c930
commit 63cf95af3f

View 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