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
$message = __('Cache system changed. Previous cache data has been cleared.');
66
-
67
-
// Update wp-cron schedule if stream mode is enabled
68
-
if ((bool) get_option('crowdsec_stream_mode')) {
69
-
$bouncer = getBouncerInstance($input); // Reload bouncer instance with the new cache system
70
-
$result = $bouncer->warmBlocklistCacheUp();
71
-
$message .= __(' As the stream mode is enabled, the cache has just been warmed up, '.($result > 0 ? 'there are now '.$result.' decisions' : 'there is now '.$result.' decision').' in cache.');
72
-
scheduleBlocklistRefresh();
63
+
64
+
try {
65
+
$bouncer = getBouncerInstance();
66
+
$bouncer->clearCache();
67
+
$message = __('Cache system changed. Previous cache data has been cleared.');
68
+
69
+
// Update wp-cron schedule if stream mode is enabled
70
+
if ((bool) get_option('crowdsec_stream_mode')) {
71
+
$bouncer = getBouncerInstance($input); // Reload bouncer instance with the new cache system
72
+
$result = $bouncer->warmBlocklistCacheUp();
73
+
$message .= __(' As the stream mode is enabled, the cache has just been warmed up, '.($result > 0 ? 'there are now '.$result.' decisions' : 'there is now '.$result.' decision').' in cache.');
AdminNotice::displaySuccess(__(' The cache has just been refreshed ('.($result['new'] > 0 ? $result['new'].' new decisions' : $result['new'].' new decision').', '.$result['deleted'].' deleted).'));
67
67
}
68
68
} catch (WordpressCrowdSecBouncerException$e) {
69
-
getCrowdSecLoggerInstance()->error(null, [
69
+
getCrowdSecLoggerInstance()->error('', [
70
70
'type' => 'WP_EXCEPTION_WHILE_REFRESHING_CACHE',
71
71
'messsage' => $e->getMessage(),
72
72
'code' => $e->getCode(),
@@ -85,7 +85,7 @@ function pruneBouncerCacheInAdminPage()
85
85
86
86
AdminNotice::displaySuccess(__('CrowdSec cache has just been pruned.'));
87
87
} catch (WordpressCrowdSecBouncerException$e) {
88
-
getCrowdSecLoggerInstance()->error(null, [
88
+
getCrowdSecLoggerInstance()->error('', [
89
89
'type' => 'WP_EXCEPTION_WHILE_PRUNING',
90
90
'messsage' => $e->getMessage(),
91
91
'code' => $e->getCode(),
@@ -116,8 +116,8 @@ function pruneBouncerCacheInAdminPage()
0 commit comments