]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
ids-functions.pl: Add remove_from_etags() function.
authorStefan Schantl <stefan.schantl@ipfire.org>
Tue, 26 Apr 2022 03:23:44 +0000 (05:23 +0200)
committerStefan Schantl <stefan.schantl@ipfire.org>
Tue, 26 Apr 2022 03:23:44 +0000 (05:23 +0200)
This function is used to drop the stored etags data of a given provider.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
config/cfgroot/ids-functions.pl

index 3994d17808838fcdab57d390daee85ce4a9d7b1d..ec4fdacc57680c3deb75a759de0e1c29bae1a1eb 100644 (file)
@@ -1884,6 +1884,30 @@ sub get_provider_used_rulesfiles($) {
        return @used_rulesfiles;
 }
 
+#
+## Function to delete the stored etag data of a given provider.
+#
+sub remove_from_etags ($) {
+       my ($provider) = @_;
+
+       my %etags;
+
+       # Early exit function if the etags file does not exist.
+       return unless (-f $etags_file);
+
+       # Read-in etag file.
+       &General::readhash("$etags_file", \%etags);
+
+       # Check if the hash contains an entry for the given provider.
+       if ($etags{$provider}) {
+               # Drop the entry.
+               delete($etags{$provider});
+
+               # Write back the etags file.
+               &General::writehash("$etags_file", \%etags);
+       }
+}
+
 #
 ## Function to write the lock file for locking the WUI, while
 ## the autoupdate script runs.