From b8a7a814757526a1c84bf0e0b0a8322030c8f1bb Mon Sep 17 00:00:00 2001 From: qrazi Date: Tue, 19 Mar 2024 10:48:03 +0100 Subject: [PATCH 1/4] fix: typo --- src/helpers/DiagnosticsHelper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/helpers/DiagnosticsHelper.php b/src/helpers/DiagnosticsHelper.php index 4437985c..e9c951fc 100644 --- a/src/helpers/DiagnosticsHelper.php +++ b/src/helpers/DiagnosticsHelper.php @@ -403,7 +403,7 @@ public static function getTests(): array $pass = $settings->refreshCacheAutomaticallyForGlobals; if ($pass) { $message = '' . Craft::t('blitz', '{num, plural, =1{global exists} other{globals exist}}', ['num' => $globalSetCount]) . ' and - refreshCacheAutomaticallyForGlobals is diabled.'; + refreshCacheAutomaticallyForGlobals is disabled.'; } else { $message = '' . Craft::t('blitz', '{num, plural, =1{global exists} other{globals exist}}', ['num' => $globalSetCount]) . ' and refreshCacheAutomaticallyForGlobals is enabled.'; From dbd07b6227d6da28de8ec5bb1d2833ea2b0bd41b Mon Sep 17 00:00:00 2001 From: qrazi Date: Tue, 19 Mar 2024 10:50:30 +0100 Subject: [PATCH 2/4] fix: use the correct info tooltip message for the config setting See commit 9fd70015, in that refactor looks like the info message was mis-copy/pasted. --- src/helpers/DiagnosticsHelper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/helpers/DiagnosticsHelper.php b/src/helpers/DiagnosticsHelper.php index e9c951fc..a0449cdd 100644 --- a/src/helpers/DiagnosticsHelper.php +++ b/src/helpers/DiagnosticsHelper.php @@ -361,7 +361,7 @@ public static function getTests(): array $tests[] = [ 'pass' => $pass, 'message' => $message, - 'info' => 'Globals should be avoided, since they are preloaded on every page in your site, unless the refreshCacheAutomaticallyForGlobals config setting is disabled. Learn more', + 'info' => 'With the refreshCacheWhenElementSavedUnchanged config setting disabled, cached pages are refreshed only when an element is saved and its content changed. This is recommended and should only be enabled with good reason, as it can cause more refresh cache jobs to be created than necessary.', ]; /** From 6938e881fd4a0bd36711e445663a62913ee92867 Mon Sep 17 00:00:00 2001 From: qrazi Date: Tue, 19 Mar 2024 11:02:58 +0100 Subject: [PATCH 3/4] fix: flip boolean logic for correct $pass condition Without the flip, $pass will actually be `false` if the setting is set to `false`, but the messaging is then indicating that the setting is enabled and should preferably be disabled. --- src/helpers/DiagnosticsHelper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/helpers/DiagnosticsHelper.php b/src/helpers/DiagnosticsHelper.php index a0449cdd..9b73f3fe 100644 --- a/src/helpers/DiagnosticsHelper.php +++ b/src/helpers/DiagnosticsHelper.php @@ -400,7 +400,7 @@ public static function getTests(): array */ $globalSetCount = GlobalSet::find()->count(); if ($globalSetCount > 0) { - $pass = $settings->refreshCacheAutomaticallyForGlobals; + $pass = (false === $settings->refreshCacheAutomaticallyForGlobals); if ($pass) { $message = '' . Craft::t('blitz', '{num, plural, =1{global exists} other{globals exist}}', ['num' => $globalSetCount]) . ' and refreshCacheAutomaticallyForGlobals is disabled.'; From 191abacbb5c9ae5b2ce91ba0cd563b82d27af765 Mon Sep 17 00:00:00 2001 From: qrazi Date: Tue, 19 Mar 2024 11:08:26 +0100 Subject: [PATCH 4/4] fix: switch message to fit with $pass value --- src/helpers/DiagnosticsHelper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/helpers/DiagnosticsHelper.php b/src/helpers/DiagnosticsHelper.php index 9b73f3fe..1ea9f008 100644 --- a/src/helpers/DiagnosticsHelper.php +++ b/src/helpers/DiagnosticsHelper.php @@ -500,9 +500,9 @@ public static function getTests(): array $now = new DateTime(); $pass = $refreshExpired !== null && $refreshExpired > $now->modify('-24 hours'); if ($pass) { - $message = 'The blitz/cache/refresh-expired console command has not been executed within the past 24 hours.'; - } else { $message = 'The blitz/cache/refresh-expired console command has been executed within the past 24 hours.'; + } else { + $message = 'The blitz/cache/refresh-expired console command has not been executed within the past 24 hours.'; } $tests[] = [ 'pass' => $pass,