You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: inc/admin/advanced-settings.php
+10-10Lines changed: 10 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -23,8 +23,9 @@ function adminAdvancedSettings()
23
23
$bouncer = newBouncer($configs);
24
24
$bouncer->clearCache();
25
25
$refresh = $bouncer->refreshBlocklistCache();
26
-
$result = $refresh['new']??0;
27
-
$message = __('As the stream mode is enabled, the cache has just been refreshed, '.($result > 1 ? 'there are now '.$result.' decisions' : 'there is now '.$result.' decision').' in cache.');
26
+
$new = $refresh['new']??0;
27
+
$deleted = $refresh['deleted']??0;
28
+
$message = __('As the stream mode is enabled, the cache has just been refreshed. New decision(s): '.$new.'. Deleted decision(s): '. $deleted);
28
29
AdminNotice::displaySuccess($message);
29
30
scheduleBlocklistRefresh();
30
31
}, function () {
@@ -54,11 +55,9 @@ function adminAdvancedSettings()
54
55
$bouncer = newBouncer($configs);
55
56
$bouncer->clearCache();
56
57
$refresh = $bouncer->refreshBlocklistCache();
57
-
$result = $refresh['new']??0;
58
-
$message = __('As the stream mode refresh duration changed, the cache has just been refreshed, ' .
59
-
($result > 1 ? 'there are now '.$result.' decisions' : 'there is now '.$result.' decision')
60
-
. ' in cache.'
61
-
);
58
+
$new = $refresh['new']??0;
59
+
$deleted = $refresh['deleted']??0;
60
+
$message = __('As the stream mode refresh duration changed, the cache has just been refreshed. New decision(s): '.$new.'. Deleted decision(s): '. $deleted);
62
61
AdminNotice::displaySuccess($message);
63
62
scheduleBlocklistRefresh();
64
63
}
@@ -170,8 +169,9 @@ function adminAdvancedSettings()
170
169
// system
171
170
$bouncer->clearCache();
172
171
$result = $bouncer->refreshBlocklistCache();
173
-
$count = $result['new'];
174
-
$message .= __('As the stream mode is enabled, the cache has just been refreshed, '.($count > 1 ? 'there are now '.$count.' decisions' : 'there is now '.$count.' decision').' in cache.');
172
+
$new = $result['new']??0;
173
+
$deleted = $result['deleted']??0;
174
+
$message = __('As the stream mode is enabled, the cache has just been refreshed. New decision(s): '.$new.'. Deleted decision(s): '. $deleted);
175
175
AdminNotice::displaySuccess($message);
176
176
scheduleBlocklistRefresh();
177
177
}
@@ -350,7 +350,7 @@ function convertInlineIpRangesToComparableIpBounds(string $inlineIpRanges): arra
Copy file name to clipboardExpand all lines: inc/admin/init.php
+7-3Lines changed: 7 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -45,8 +45,9 @@ function clearBouncerCacheInAdminPage()
45
45
// In stream mode, immediatelly warm the cache up.
46
46
if (get_option('crowdsec_stream_mode')) {
47
47
$refresh = $bouncer->refreshBlocklistCache();
48
-
$result = $refresh['new']??0;
49
-
$message .= __(' As the stream mode is enabled, the cache has just been refreshed, '.($result > 1 ? 'there are now '.$result.' decisions' : 'there is now '.$result.' decision').' in cache.');
48
+
$new = $refresh['new']??0;
49
+
$deleted = $refresh['deleted']??0;
50
+
$message .= __(' As the stream mode is enabled, the cache has just been refreshed. New decision(s): '.$new.'. Deleted decision(s): '. $deleted);
50
51
}
51
52
52
53
AdminNotice::displaySuccess($message);
@@ -77,7 +78,10 @@ function refreshBouncerCacheInAdminPage()
77
78
$configs = getDatabaseConfigs();
78
79
$bouncer = newBouncer($configs);
79
80
$result = $bouncer->refreshBlocklistCache();
80
-
AdminNotice::displaySuccess(__(' The cache has just been refreshed ('.($result['new'] > 0 ? $result['new'].' new decisions' : $result['new'].' new decision').', '.$result['deleted'].' deleted).'));
81
+
$new = $result['new']??0;
82
+
$deleted = $result['deleted']??0;
83
+
$message = __('The cache has just been refreshed. New decision(s): '.$new.'. Deleted decision(s): '. $deleted);
0 commit comments