]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
ids.cg: Regeneate ruleset if the ruleset action (mode) of a provider
authorStefan Schantl <stefan.schantl@ipfire.org>
Thu, 14 Apr 2022 03:16:25 +0000 (05:16 +0200)
committerStefan Schantl <stefan.schantl@ipfire.org>
Thu, 14 Apr 2022 03:16:25 +0000 (05:16 +0200)
get changed.

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

index 1ba4b9b538fc3fc64968115bf18a97caccc664f0..83928b258a34b64077cf58971e120076ee3395d7 100644 (file)
@@ -642,6 +642,7 @@ if ($cgiparams{'RULESET'} eq $Lang::tr{'ids apply'}) {
        my $subscription_code = $cgiparams{'SUBSCRIPTION_CODE'};
        my $status_autoupdate;
        my $mode;
+       my $regenerate_ruleset_required;
 
        # Handle autoupdate checkbox.
        if ($cgiparams{'ENABLE_AUTOUPDATE'} eq "on") {
@@ -697,6 +698,15 @@ if ($cgiparams{'RULESET'} eq $Lang::tr{'ids apply'}) {
                        # Undef the given ID.
                        undef($cgiparams{'ID'});
 
+                       # Grab the configured mode.
+                       my $stored_mode = $used_providers{$id}[4];
+
+                       # Check if the ruleset action (mode) has been changed.
+                       if ($stored_mode ne $mode) {
+                               # It has been changed, so the ruleset needs to be regenerated.
+                               $regenerate_ruleset_required = "1";
+                       }
+
                        # Grab the configured status of the corresponding entry.
                        $status = $used_providers{$id}[3];
                } else {
@@ -770,6 +780,14 @@ if ($cgiparams{'RULESET'} eq $Lang::tr{'ids apply'}) {
                        }
                }
 
+               # Check if the ruleset has to be regenerated.
+               if ($regenerate_ruleset_required) {
+                       # Call oinkmaster web function.
+                       &oinkmaster_web();
+
+                       # Perform a reload of the page.
+                       &reload();
+               }
        }
 
        # Undefine providers flag.