From 7906b9c8456a48b184d27cc3681cf8ddf0365776 Mon Sep 17 00:00:00 2001 From: zukucker Date: Thu, 15 Jan 2026 10:47:34 +0100 Subject: [PATCH 01/12] feat: added new snippet for done --- .../app/administration/src/module/frosh-tools/snippet/de-DE.json | 1 + .../app/administration/src/module/frosh-tools/snippet/en-GB.json | 1 + 2 files changed, 2 insertions(+) diff --git a/src/Resources/app/administration/src/module/frosh-tools/snippet/de-DE.json b/src/Resources/app/administration/src/module/frosh-tools/snippet/de-DE.json index 448dbb8d..b0602ca8 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/snippet/de-DE.json +++ b/src/Resources/app/administration/src/module/frosh-tools/snippet/de-DE.json @@ -346,6 +346,7 @@ "status": "Status", "name": "Name", "good": "Gut", + "done": "Erledigt", "warning": "Warnung", "error": "Fehler", "info": "Info", diff --git a/src/Resources/app/administration/src/module/frosh-tools/snippet/en-GB.json b/src/Resources/app/administration/src/module/frosh-tools/snippet/en-GB.json index 27e4268b..529cb831 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/snippet/en-GB.json +++ b/src/Resources/app/administration/src/module/frosh-tools/snippet/en-GB.json @@ -346,6 +346,7 @@ "status": "Status", "name": "Name", "good": "Good", + "done": "Done", "warning": "Warning", "error": "Error", "info": "Info", From 4a668a9d216fc6430a2382a64d6febe23fd38846 Mon Sep 17 00:00:00 2001 From: zukucker Date: Thu, 15 Jan 2026 10:48:29 +0100 Subject: [PATCH 02/12] feat: added return SettingsResult:ok to performancechecks --- .../PerformanceChecker/AdminWorkerChecker.php | 10 +++++ .../CompressionMethodChecker.php | 10 +++++ .../DisableAppUrlExternalCheckChecker.php | 10 +++++ .../DisableSymfonySecretsChecker.php | 10 +++++ .../DisabledMailUpdatesChecker.php | 21 +++++++-- .../Checker/PerformanceChecker/EsChecker.php | 10 +++++ .../FineGrainedCachingChecker.php | 11 +++++ .../FixCacheIdSetChecker.php | 10 +++++ .../IncrementStorageChecker.php | 10 +++++ .../PerformanceChecker/LoggerLevelChecker.php | 8 ++++ .../MailOverQueueChecker.php | 10 +++++ .../MessengerAutoSetupChecker.php | 10 +++++ .../MysqlSettingsChecker.php | 43 +++++++++++++++++++ .../PerformanceChecker/PhpSettingsChecker.php | 11 +++++ .../ProductStreamIndexingChecker.php | 10 +++++ .../QueueConnectionChecker.php | 13 ++++++ .../RedisTagAwareChecker.php | 33 +++++++++----- src/Components/Health/SettingsResult.php | 14 ++++-- 18 files changed, 237 insertions(+), 17 deletions(-) diff --git a/src/Components/Health/Checker/PerformanceChecker/AdminWorkerChecker.php b/src/Components/Health/Checker/PerformanceChecker/AdminWorkerChecker.php index 42f72905..c23bc5f8 100644 --- a/src/Components/Health/Checker/PerformanceChecker/AdminWorkerChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/AdminWorkerChecker.php @@ -28,6 +28,16 @@ public function collect(HealthCollection $collection): void 'disabled', ), ); + }else{ + $collection->add( + SettingsResult::ok( + 'admin-watcher', + 'Admin-Worker', + 'disabled', + 'disabled', + 'https://developer.shopware.com/docs/guides/plugins/plugins/framework/message-queue/add-message-handler#the-admin-worker', + ), + ); } } } diff --git a/src/Components/Health/Checker/PerformanceChecker/CompressionMethodChecker.php b/src/Components/Health/Checker/PerformanceChecker/CompressionMethodChecker.php index 5a0f160f..929eb81e 100644 --- a/src/Components/Health/Checker/PerformanceChecker/CompressionMethodChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/CompressionMethodChecker.php @@ -63,6 +63,16 @@ private function checkCompression(HealthCollection $collection, string $function 'enabled', ), ); + }else{ + $collection->add( + SettingsResult::ok( + strtolower($functionality) . '-compression-method-extension-zstd', + 'PHP extension zstd for ' . $functionality . ' compression method', + \extension_loaded('zstd'), + 'enabled', + self::DOCUMENTATION_URL, + ), + ); } } } diff --git a/src/Components/Health/Checker/PerformanceChecker/DisableAppUrlExternalCheckChecker.php b/src/Components/Health/Checker/PerformanceChecker/DisableAppUrlExternalCheckChecker.php index 8cc83b3d..5ba136d1 100644 --- a/src/Components/Health/Checker/PerformanceChecker/DisableAppUrlExternalCheckChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/DisableAppUrlExternalCheckChecker.php @@ -23,6 +23,16 @@ public function collect(HealthCollection $collection): void 'disabled', ), ); + }else{ + $collection->add( + SettingsResult::ok( + 'app-url-check-disabled', + 'App URL external check', + 'enabled', + 'disabled', + 'https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks.html#disable-app-url-external-check', + ), + ); } } } diff --git a/src/Components/Health/Checker/PerformanceChecker/DisableSymfonySecretsChecker.php b/src/Components/Health/Checker/PerformanceChecker/DisableSymfonySecretsChecker.php index 710bf37c..647245b7 100644 --- a/src/Components/Health/Checker/PerformanceChecker/DisableSymfonySecretsChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/DisableSymfonySecretsChecker.php @@ -29,6 +29,16 @@ public function collect(HealthCollection $collection): void 'disabled', ), ); + }else{ + $collection->add( + SettingsResult::ok( + 'symfony-secrets', + 'Disable Symfony Secrets', + 'disabled', + 'disabled', + 'https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks.html#disable-symfony-secrets', + ), + ); } } } diff --git a/src/Components/Health/Checker/PerformanceChecker/DisabledMailUpdatesChecker.php b/src/Components/Health/Checker/PerformanceChecker/DisabledMailUpdatesChecker.php index 438cef35..33f24908 100644 --- a/src/Components/Health/Checker/PerformanceChecker/DisabledMailUpdatesChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/DisabledMailUpdatesChecker.php @@ -24,11 +24,26 @@ public function collect(HealthCollection $collection): void $setting = $this->params->get('shopware.mail.update_mail_variables_on_send'); if (!$setting) { + $collection->add( + SettingsResult::ok( + 'mail_variables', + 'MailVariables updates', + 'disabled', + 'disabled', + 'https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks#prevent-mail-data-updates' + ) + ); return; } - $result = SettingsResult::warning('mail_variables', 'MailVariables updates', 'enabled', 'disabled'); - - $collection->add($result); + $collection->add( + SettingsResult::warning( + 'mail_variables', + 'MailVariables updates', + 'enabled', + 'disabled', + 'https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks#prevent-mail-data-updates' + ) + ); } } diff --git a/src/Components/Health/Checker/PerformanceChecker/EsChecker.php b/src/Components/Health/Checker/PerformanceChecker/EsChecker.php index 38cc062b..f6e82262 100644 --- a/src/Components/Health/Checker/PerformanceChecker/EsChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/EsChecker.php @@ -29,6 +29,16 @@ public function collect(HealthCollection $collection): void 'enabled', ), ); + }else{ + $collection->add( + SettingsResult::ok( + 'elasticsearch', + 'Elasticsearch', + 'enabled', + 'enabled', + 'https://developer.shopware.com/docs/guides/hosting/infrastructure/elasticsearch/elasticsearch-setup', + ), + ); } } } diff --git a/src/Components/Health/Checker/PerformanceChecker/FineGrainedCachingChecker.php b/src/Components/Health/Checker/PerformanceChecker/FineGrainedCachingChecker.php index 9785288e..924fedaf 100644 --- a/src/Components/Health/Checker/PerformanceChecker/FineGrainedCachingChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/FineGrainedCachingChecker.php @@ -44,6 +44,17 @@ public function collect(HealthCollection $collection): void 'disabled', ), ); + }else{ + $collection->add( + // only info, because it only affects redis, varnish etc. + SettingsResult::ok( + 'fine-grained-caching', + 'Fine-grained caching on Redis, Varnish etc.', + 'disabled', + 'disabled', + self::DOCUMENTATION_URL, + ), + ); } } } diff --git a/src/Components/Health/Checker/PerformanceChecker/FixCacheIdSetChecker.php b/src/Components/Health/Checker/PerformanceChecker/FixCacheIdSetChecker.php index ac373319..55a83348 100644 --- a/src/Components/Health/Checker/PerformanceChecker/FixCacheIdSetChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/FixCacheIdSetChecker.php @@ -39,6 +39,16 @@ public function collect(HealthCollection $collection): void 'set', ), ); + }else{ + $collection->add( + SettingsResult::ok( + 'cache-id', + 'Fixed cache id', + 'set', + 'set', + 'https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks#cache-id', + ), + ); } } } diff --git a/src/Components/Health/Checker/PerformanceChecker/IncrementStorageChecker.php b/src/Components/Health/Checker/PerformanceChecker/IncrementStorageChecker.php index 6880d80d..31bff1d5 100644 --- a/src/Components/Health/Checker/PerformanceChecker/IncrementStorageChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/IncrementStorageChecker.php @@ -32,6 +32,16 @@ public function collect(HealthCollection $collection): void $recommended, ), ); + }else{ + $collection->add( + SettingsResult::ok( + 'increment-storage', + 'Increment storage', + $this->userActivity, + $recommended, + 'https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks#increment-storage', + ), + ); } } } diff --git a/src/Components/Health/Checker/PerformanceChecker/LoggerLevelChecker.php b/src/Components/Health/Checker/PerformanceChecker/LoggerLevelChecker.php index f2093b13..94e50696 100644 --- a/src/Components/Health/Checker/PerformanceChecker/LoggerLevelChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/LoggerLevelChecker.php @@ -32,6 +32,14 @@ public function collect(HealthCollection $collection): void Logger::toMonologLevel($this->businessEventHandlerLevel)->getName(), 'min WARNING', )); + }else{ + $collection->add(SettingsResult::ok( + 'business_logger', + 'BusinessEventHandler logging', + Logger::toMonologLevel($this->businessEventHandlerLevel)->getName(), + 'min WARNING', + $this->url, + )); } } } diff --git a/src/Components/Health/Checker/PerformanceChecker/MailOverQueueChecker.php b/src/Components/Health/Checker/PerformanceChecker/MailOverQueueChecker.php index aceffa01..28e773b7 100644 --- a/src/Components/Health/Checker/PerformanceChecker/MailOverQueueChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/MailOverQueueChecker.php @@ -28,6 +28,16 @@ public function collect(HealthCollection $collection): void 'enabled', ), ); + }else{ + $collection->add( + SettingsResult::ok( + 'mail', + 'Sending mails over queue', + 'enabled', + 'enabled', + 'https://developer.shopware.com/docs/guides/hosting/infrastructure/message-queue#sending-mails-over-the-message-queue', + ), + ); } } } diff --git a/src/Components/Health/Checker/PerformanceChecker/MessengerAutoSetupChecker.php b/src/Components/Health/Checker/PerformanceChecker/MessengerAutoSetupChecker.php index 39682d66..6dc38af3 100644 --- a/src/Components/Health/Checker/PerformanceChecker/MessengerAutoSetupChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/MessengerAutoSetupChecker.php @@ -32,6 +32,16 @@ public function collect(HealthCollection $collection): void 'disabled', ), ); + }else{ + $collection->add( + SettingsResult::ok( + 'messenger-auto-setup', + 'Messenger auto_setup', + 'disabled', + 'disabled', + 'https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks.html#disable-auto-setup', + ), + ); } } diff --git a/src/Components/Health/Checker/PerformanceChecker/MysqlSettingsChecker.php b/src/Components/Health/Checker/PerformanceChecker/MysqlSettingsChecker.php index dba276be..1719d1fd 100644 --- a/src/Components/Health/Checker/PerformanceChecker/MysqlSettingsChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/MysqlSettingsChecker.php @@ -50,6 +50,17 @@ private function checkGroupConcatMaxLen(HealthCollection $collection): void 'min ' . self::MYSQL_GROUP_CONCAT_MAX_LEN, ), ); + }else{ + $collection->add( + SettingsResult::ok( + 'sql_group_concat_max_len', + 'MySQL value group_concat_max_len', + (string) $groupConcatMaxLen, + 'min ' . self::MYSQL_GROUP_CONCAT_MAX_LEN, + self::DOCUMENTATION_URL, + ), + ); + } } @@ -65,6 +76,17 @@ private function checkSqlMode(HealthCollection $collection): void 'No ' . self::MYSQL_SQL_MODE_PART, ), ); + }else{ + $collection->add( + SettingsResult::ok( + 'sql_mode', + 'MySQL value sql_mode', + $sqlMode, + 'No ' . self::MYSQL_SQL_MODE_PART, + self::DOCUMENTATION_URL, + ), + ); + } } @@ -80,6 +102,17 @@ private function checkTimeZone(HealthCollection $collection): void implode(', ', self::MYSQL_TIME_ZONES), ), ); + }else{ + $collection->add( + SettingsResult::ok( + 'sql_time_zone', + 'MySQL value time_zone', + $timeZone, + implode(', ', self::MYSQL_TIME_ZONES), + self::DOCUMENTATION_URL, + ), + ); + } } @@ -100,6 +133,16 @@ private function checkCheckDefaultEnvironmentSessionVariables(HealthCollection $ 'disabled', ), ); + }else{ + $collection->add( + SettingsResult::ok( + 'sql_set_default_session_variables', + 'MySQL session vars are set on each connect', + 'disabled', + 'disabled', + self::DOCUMENTATION_URL, + ), + ); } } } diff --git a/src/Components/Health/Checker/PerformanceChecker/PhpSettingsChecker.php b/src/Components/Health/Checker/PerformanceChecker/PhpSettingsChecker.php index 3a069091..f789667c 100644 --- a/src/Components/Health/Checker/PerformanceChecker/PhpSettingsChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/PhpSettingsChecker.php @@ -45,6 +45,17 @@ private function checkEnableFileOverride(HealthCollection $collection): void '1', ), ); + }else{ + $collection->add( + SettingsResult::ok( + 'php.opcache.enable_file_override', + 'PHP value opcache.enable_file_override', + $currentValue, + '1', + $url, + ), + ); + } } diff --git a/src/Components/Health/Checker/PerformanceChecker/ProductStreamIndexingChecker.php b/src/Components/Health/Checker/PerformanceChecker/ProductStreamIndexingChecker.php index 767a448d..9e132c60 100644 --- a/src/Components/Health/Checker/PerformanceChecker/ProductStreamIndexingChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/ProductStreamIndexingChecker.php @@ -35,6 +35,16 @@ public function collect(HealthCollection $collection): void 'disabled', ), ); + }else{ + $collection->add( + SettingsResult::ok( + 'product-stream-indexing', + 'Product Stream Indexing', + 'disabled', + 'disabled', + 'https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks.html#disable-product-stream-indexer', + ), + ); } } } diff --git a/src/Components/Health/Checker/PerformanceChecker/QueueConnectionChecker.php b/src/Components/Health/Checker/PerformanceChecker/QueueConnectionChecker.php index c5c675cb..1c63e81f 100644 --- a/src/Components/Health/Checker/PerformanceChecker/QueueConnectionChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/QueueConnectionChecker.php @@ -46,6 +46,19 @@ public function collect(HealthCollection $collection): void ), ); } + + if($schema === 'redis' || $schema === 'rabiitmq'){ + $collection->add( + SettingsResult::ok( + $id, + '', + $schema, + 'redis or rabbitmq', + $url, + ), + ); + + } } private function getSchema(): string diff --git a/src/Components/Health/Checker/PerformanceChecker/RedisTagAwareChecker.php b/src/Components/Health/Checker/PerformanceChecker/RedisTagAwareChecker.php index ab81bbad..4a7546c7 100644 --- a/src/Components/Health/Checker/PerformanceChecker/RedisTagAwareChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/RedisTagAwareChecker.php @@ -21,18 +21,31 @@ public function collect(HealthCollection $collection): void { $httpCacheType = $this->cacheRegistry->get('cache.http')->getType(); - if (!\str_starts_with($httpCacheType, CacheAdapter::TYPE_REDIS) - || \str_starts_with($httpCacheType, CacheAdapter::TYPE_REDIS_TAG_AWARE)) { + // no redis + if (!\str_starts_with($httpCacheType, CacheAdapter::TYPE_REDIS)) { return; } - $collection->add( - SettingsResult::warning( - 'redis-tag-aware', - 'Redis adapter should be TagAware', - CacheAdapter::TYPE_REDIS, - CacheAdapter::TYPE_REDIS_TAG_AWARE, - ), - ); + if (!\str_starts_with($httpCacheType, CacheAdapter::TYPE_REDIS_TAG_AWARE)) { + $collection->add( + SettingsResult::warning( + 'redis-tag-aware', + 'Redis adapter should be TagAware', + CacheAdapter::TYPE_REDIS, + CacheAdapter::TYPE_REDIS_TAG_AWARE, + 'https://developer.shopware.com/docs/guides/hosting/performance/caches.html#example-replace-some-cache-with-redis', + ), + ); + } else { + $collection->add( + SettingsResult::ok( + 'redis-tag-aware', + 'Redis adapter is TagAware', + CacheAdapter::TYPE_REDIS, + CacheAdapter::TYPE_REDIS_TAG_AWARE, + 'https://developer.shopware.com/docs/guides/hosting/performance/caches.html#example-replace-some-cache-with-redis', + ), + ); + } } } diff --git a/src/Components/Health/SettingsResult.php b/src/Components/Health/SettingsResult.php index 9251b694..e246e287 100644 --- a/src/Components/Health/SettingsResult.php +++ b/src/Components/Health/SettingsResult.php @@ -19,11 +19,13 @@ class SettingsResult extends Struct public string $state; + public ?string $url = null; + public string $id; protected string $snippet; - public static function ok(string $id, string $snippet, string $current = '', string $recommended = ''): self + public static function ok(string $id, string $snippet, string $current = '', string $recommended = '', ?string $url = null): self { $me = new self(); $me->id = $id; @@ -31,11 +33,12 @@ public static function ok(string $id, string $snippet, string $current = '', str $me->snippet = $snippet; $me->current = $current; $me->recommended = $recommended; + $me->url = $url; return $me; } - public static function warning(string $id, string $snippet, string $current = '', string $recommended = ''): self + public static function warning(string $id, string $snippet, string $current = '', string $recommended = '', ?string $url = null): self { $me = new self(); $me->id = $id; @@ -43,11 +46,12 @@ public static function warning(string $id, string $snippet, string $current = '' $me->snippet = $snippet; $me->current = $current; $me->recommended = $recommended; + $me->url = $url; return $me; } - public static function error(string $id, string $snippet, string $current = '', string $recommended = ''): self + public static function error(string $id, string $snippet, string $current = '', string $recommended = '', ?string $url = null): self { $me = new self(); $me->id = $id; @@ -55,11 +59,12 @@ public static function error(string $id, string $snippet, string $current = '', $me->snippet = $snippet; $me->current = $current; $me->recommended = $recommended; + $me->url = $url; return $me; } - public static function info(string $id, string $snippet, string $current = '', string $recommended = ''): self + public static function info(string $id, string $snippet, string $current = '', string $recommended = '', ?string $url = null): self { $me = new self(); $me->id = $id; @@ -67,6 +72,7 @@ public static function info(string $id, string $snippet, string $current = '', s $me->snippet = $snippet; $me->current = $current; $me->recommended = $recommended; + $me->url = $url; return $me; } From 80d85631a6638cefa2c86c2e714219a975e18154 Mon Sep 17 00:00:00 2001 From: zukucker Date: Thu, 15 Jan 2026 11:31:00 +0100 Subject: [PATCH 03/12] feat: added option to select if done is visible or not --- .../component/frosh-tools-tab-index/index.js | 15 ++++++++++++- .../frosh-tools-tab-index/style.scss | 13 ++++++++++++ .../frosh-tools-tab-index/template.twig | 21 +++++++++++++------ 3 files changed, 42 insertions(+), 7 deletions(-) diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-index/index.js b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-index/index.js index 5c51158f..05921fa2 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-index/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-index/index.js @@ -12,8 +12,9 @@ Component.register('frosh-tools-tab-index', { data() { return { isLoading: true, + showDone: false, health: null, - performanceStatus: null, + performanceStatus: [], activeInfo: null, }; }, @@ -22,6 +23,18 @@ Component.register('frosh-tools-tab-index', { this.createdComponent(); }, + computed: { + filteredPerformanceStatus() { + if (this.showDone) { + return this.performanceStatus; + } + + return this.performanceStatus.filter( + (item) => item.state !== 'STATE_OK' + ); + }, + }, + methods: { recommendationFor(item) { return (item && recommendations[item.id]) || null; diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-index/style.scss b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-index/style.scss index dba7a176..9e21ff54 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-index/style.scss +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-index/style.scss @@ -11,6 +11,19 @@ font-weight: 500; } +.ft-show-done-toggle { + display: inline-flex; + align-items: center; + gap: 6px; + font-size: 13px; + color: var(--ft-text-muted); + cursor: pointer; + + input { + margin: 0; + } +} + .ft-info-modal { display: flex; flex-direction: column; diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-index/template.twig b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-index/template.twig index d1bca100..28fdb4c5 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-index/template.twig +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-index/template.twig @@ -82,11 +82,20 @@ +
@@ -124,7 +133,7 @@
@@ -211,4 +220,4 @@ - \ No newline at end of file + From 13e068a8360d0d622da2b3c1209072ed0106276c Mon Sep 17 00:00:00 2001 From: zukucker Date: Thu, 15 Jan 2026 11:37:59 +0100 Subject: [PATCH 04/12] fix: wrong state --- .../PerformanceChecker/DisableAppUrlExternalCheckChecker.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Components/Health/Checker/PerformanceChecker/DisableAppUrlExternalCheckChecker.php b/src/Components/Health/Checker/PerformanceChecker/DisableAppUrlExternalCheckChecker.php index 5ba136d1..4c7dd3c5 100644 --- a/src/Components/Health/Checker/PerformanceChecker/DisableAppUrlExternalCheckChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/DisableAppUrlExternalCheckChecker.php @@ -28,7 +28,7 @@ public function collect(HealthCollection $collection): void SettingsResult::ok( 'app-url-check-disabled', 'App URL external check', - 'enabled', + 'disabled', 'disabled', 'https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks.html#disable-app-url-external-check', ), From 03a195a00b43f7bdd465bbd324463c6664fda9fb Mon Sep 17 00:00:00 2001 From: zukucker Date: Thu, 15 Jan 2026 11:47:08 +0100 Subject: [PATCH 05/12] fix: coding style --- .../Checker/PerformanceChecker/AdminWorkerChecker.php | 2 +- .../PerformanceChecker/CompressionMethodChecker.php | 2 +- .../DisableAppUrlExternalCheckChecker.php | 2 +- .../DisableSymfonySecretsChecker.php | 2 +- .../PerformanceChecker/DisabledMailUpdatesChecker.php | 1 + .../Health/Checker/PerformanceChecker/EsChecker.php | 2 +- .../PerformanceChecker/FineGrainedCachingChecker.php | 2 +- .../PerformanceChecker/FixCacheIdSetChecker.php | 2 +- .../PerformanceChecker/IncrementStorageChecker.php | 2 +- .../Checker/PerformanceChecker/LoggerLevelChecker.php | 2 +- .../PerformanceChecker/MailOverQueueChecker.php | 2 +- .../PerformanceChecker/MessengerAutoSetupChecker.php | 2 +- .../PerformanceChecker/MysqlSettingsChecker.php | 11 ++++------- .../Checker/PerformanceChecker/PhpSettingsChecker.php | 3 +-- .../ProductStreamIndexingChecker.php | 2 +- .../PerformanceChecker/QueueConnectionChecker.php | 3 +-- 16 files changed, 19 insertions(+), 23 deletions(-) diff --git a/src/Components/Health/Checker/PerformanceChecker/AdminWorkerChecker.php b/src/Components/Health/Checker/PerformanceChecker/AdminWorkerChecker.php index c23bc5f8..0abd92f9 100644 --- a/src/Components/Health/Checker/PerformanceChecker/AdminWorkerChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/AdminWorkerChecker.php @@ -28,7 +28,7 @@ public function collect(HealthCollection $collection): void 'disabled', ), ); - }else{ + } else { $collection->add( SettingsResult::ok( 'admin-watcher', diff --git a/src/Components/Health/Checker/PerformanceChecker/CompressionMethodChecker.php b/src/Components/Health/Checker/PerformanceChecker/CompressionMethodChecker.php index 929eb81e..ff9cbfb6 100644 --- a/src/Components/Health/Checker/PerformanceChecker/CompressionMethodChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/CompressionMethodChecker.php @@ -63,7 +63,7 @@ private function checkCompression(HealthCollection $collection, string $function 'enabled', ), ); - }else{ + } else { $collection->add( SettingsResult::ok( strtolower($functionality) . '-compression-method-extension-zstd', diff --git a/src/Components/Health/Checker/PerformanceChecker/DisableAppUrlExternalCheckChecker.php b/src/Components/Health/Checker/PerformanceChecker/DisableAppUrlExternalCheckChecker.php index 4c7dd3c5..7717f581 100644 --- a/src/Components/Health/Checker/PerformanceChecker/DisableAppUrlExternalCheckChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/DisableAppUrlExternalCheckChecker.php @@ -23,7 +23,7 @@ public function collect(HealthCollection $collection): void 'disabled', ), ); - }else{ + } else { $collection->add( SettingsResult::ok( 'app-url-check-disabled', diff --git a/src/Components/Health/Checker/PerformanceChecker/DisableSymfonySecretsChecker.php b/src/Components/Health/Checker/PerformanceChecker/DisableSymfonySecretsChecker.php index 647245b7..01e6a5d5 100644 --- a/src/Components/Health/Checker/PerformanceChecker/DisableSymfonySecretsChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/DisableSymfonySecretsChecker.php @@ -29,7 +29,7 @@ public function collect(HealthCollection $collection): void 'disabled', ), ); - }else{ + } else { $collection->add( SettingsResult::ok( 'symfony-secrets', diff --git a/src/Components/Health/Checker/PerformanceChecker/DisabledMailUpdatesChecker.php b/src/Components/Health/Checker/PerformanceChecker/DisabledMailUpdatesChecker.php index 33f24908..b4fdab37 100644 --- a/src/Components/Health/Checker/PerformanceChecker/DisabledMailUpdatesChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/DisabledMailUpdatesChecker.php @@ -33,6 +33,7 @@ public function collect(HealthCollection $collection): void 'https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks#prevent-mail-data-updates' ) ); + return; } diff --git a/src/Components/Health/Checker/PerformanceChecker/EsChecker.php b/src/Components/Health/Checker/PerformanceChecker/EsChecker.php index f6e82262..3f5c8c9e 100644 --- a/src/Components/Health/Checker/PerformanceChecker/EsChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/EsChecker.php @@ -29,7 +29,7 @@ public function collect(HealthCollection $collection): void 'enabled', ), ); - }else{ + } else { $collection->add( SettingsResult::ok( 'elasticsearch', diff --git a/src/Components/Health/Checker/PerformanceChecker/FineGrainedCachingChecker.php b/src/Components/Health/Checker/PerformanceChecker/FineGrainedCachingChecker.php index 924fedaf..59daca30 100644 --- a/src/Components/Health/Checker/PerformanceChecker/FineGrainedCachingChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/FineGrainedCachingChecker.php @@ -44,7 +44,7 @@ public function collect(HealthCollection $collection): void 'disabled', ), ); - }else{ + } else { $collection->add( // only info, because it only affects redis, varnish etc. SettingsResult::ok( diff --git a/src/Components/Health/Checker/PerformanceChecker/FixCacheIdSetChecker.php b/src/Components/Health/Checker/PerformanceChecker/FixCacheIdSetChecker.php index 55a83348..4dee4c04 100644 --- a/src/Components/Health/Checker/PerformanceChecker/FixCacheIdSetChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/FixCacheIdSetChecker.php @@ -39,7 +39,7 @@ public function collect(HealthCollection $collection): void 'set', ), ); - }else{ + } else { $collection->add( SettingsResult::ok( 'cache-id', diff --git a/src/Components/Health/Checker/PerformanceChecker/IncrementStorageChecker.php b/src/Components/Health/Checker/PerformanceChecker/IncrementStorageChecker.php index 31bff1d5..cbac1060 100644 --- a/src/Components/Health/Checker/PerformanceChecker/IncrementStorageChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/IncrementStorageChecker.php @@ -32,7 +32,7 @@ public function collect(HealthCollection $collection): void $recommended, ), ); - }else{ + } else { $collection->add( SettingsResult::ok( 'increment-storage', diff --git a/src/Components/Health/Checker/PerformanceChecker/LoggerLevelChecker.php b/src/Components/Health/Checker/PerformanceChecker/LoggerLevelChecker.php index 94e50696..e240f8e1 100644 --- a/src/Components/Health/Checker/PerformanceChecker/LoggerLevelChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/LoggerLevelChecker.php @@ -32,7 +32,7 @@ public function collect(HealthCollection $collection): void Logger::toMonologLevel($this->businessEventHandlerLevel)->getName(), 'min WARNING', )); - }else{ + } else { $collection->add(SettingsResult::ok( 'business_logger', 'BusinessEventHandler logging', diff --git a/src/Components/Health/Checker/PerformanceChecker/MailOverQueueChecker.php b/src/Components/Health/Checker/PerformanceChecker/MailOverQueueChecker.php index 28e773b7..b1363793 100644 --- a/src/Components/Health/Checker/PerformanceChecker/MailOverQueueChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/MailOverQueueChecker.php @@ -28,7 +28,7 @@ public function collect(HealthCollection $collection): void 'enabled', ), ); - }else{ + } else { $collection->add( SettingsResult::ok( 'mail', diff --git a/src/Components/Health/Checker/PerformanceChecker/MessengerAutoSetupChecker.php b/src/Components/Health/Checker/PerformanceChecker/MessengerAutoSetupChecker.php index 6dc38af3..ab4e179b 100644 --- a/src/Components/Health/Checker/PerformanceChecker/MessengerAutoSetupChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/MessengerAutoSetupChecker.php @@ -32,7 +32,7 @@ public function collect(HealthCollection $collection): void 'disabled', ), ); - }else{ + } else { $collection->add( SettingsResult::ok( 'messenger-auto-setup', diff --git a/src/Components/Health/Checker/PerformanceChecker/MysqlSettingsChecker.php b/src/Components/Health/Checker/PerformanceChecker/MysqlSettingsChecker.php index 1719d1fd..1103e8fe 100644 --- a/src/Components/Health/Checker/PerformanceChecker/MysqlSettingsChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/MysqlSettingsChecker.php @@ -50,7 +50,7 @@ private function checkGroupConcatMaxLen(HealthCollection $collection): void 'min ' . self::MYSQL_GROUP_CONCAT_MAX_LEN, ), ); - }else{ + } else { $collection->add( SettingsResult::ok( 'sql_group_concat_max_len', @@ -60,7 +60,6 @@ private function checkGroupConcatMaxLen(HealthCollection $collection): void self::DOCUMENTATION_URL, ), ); - } } @@ -76,7 +75,7 @@ private function checkSqlMode(HealthCollection $collection): void 'No ' . self::MYSQL_SQL_MODE_PART, ), ); - }else{ + } else { $collection->add( SettingsResult::ok( 'sql_mode', @@ -86,7 +85,6 @@ private function checkSqlMode(HealthCollection $collection): void self::DOCUMENTATION_URL, ), ); - } } @@ -102,7 +100,7 @@ private function checkTimeZone(HealthCollection $collection): void implode(', ', self::MYSQL_TIME_ZONES), ), ); - }else{ + } else { $collection->add( SettingsResult::ok( 'sql_time_zone', @@ -112,7 +110,6 @@ private function checkTimeZone(HealthCollection $collection): void self::DOCUMENTATION_URL, ), ); - } } @@ -133,7 +130,7 @@ private function checkCheckDefaultEnvironmentSessionVariables(HealthCollection $ 'disabled', ), ); - }else{ + } else { $collection->add( SettingsResult::ok( 'sql_set_default_session_variables', diff --git a/src/Components/Health/Checker/PerformanceChecker/PhpSettingsChecker.php b/src/Components/Health/Checker/PerformanceChecker/PhpSettingsChecker.php index f789667c..206c23fc 100644 --- a/src/Components/Health/Checker/PerformanceChecker/PhpSettingsChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/PhpSettingsChecker.php @@ -45,7 +45,7 @@ private function checkEnableFileOverride(HealthCollection $collection): void '1', ), ); - }else{ + } else { $collection->add( SettingsResult::ok( 'php.opcache.enable_file_override', @@ -55,7 +55,6 @@ private function checkEnableFileOverride(HealthCollection $collection): void $url, ), ); - } } diff --git a/src/Components/Health/Checker/PerformanceChecker/ProductStreamIndexingChecker.php b/src/Components/Health/Checker/PerformanceChecker/ProductStreamIndexingChecker.php index 9e132c60..bd939042 100644 --- a/src/Components/Health/Checker/PerformanceChecker/ProductStreamIndexingChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/ProductStreamIndexingChecker.php @@ -35,7 +35,7 @@ public function collect(HealthCollection $collection): void 'disabled', ), ); - }else{ + } else { $collection->add( SettingsResult::ok( 'product-stream-indexing', diff --git a/src/Components/Health/Checker/PerformanceChecker/QueueConnectionChecker.php b/src/Components/Health/Checker/PerformanceChecker/QueueConnectionChecker.php index 1c63e81f..fbd95c8b 100644 --- a/src/Components/Health/Checker/PerformanceChecker/QueueConnectionChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/QueueConnectionChecker.php @@ -47,7 +47,7 @@ public function collect(HealthCollection $collection): void ); } - if($schema === 'redis' || $schema === 'rabiitmq'){ + if ($schema === 'redis' || $schema === 'rabiitmq') { $collection->add( SettingsResult::ok( $id, @@ -57,7 +57,6 @@ public function collect(HealthCollection $collection): void $url, ), ); - } } From addc36a00812b46741986254638f1e7b1e4a2590 Mon Sep 17 00:00:00 2001 From: zukucker Date: Thu, 15 Jan 2026 14:30:15 +0100 Subject: [PATCH 06/12] fix: wrong types --- .../Checker/PerformanceChecker/CompressionMethodChecker.php | 2 +- .../Checker/PerformanceChecker/MysqlSettingsChecker.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Components/Health/Checker/PerformanceChecker/CompressionMethodChecker.php b/src/Components/Health/Checker/PerformanceChecker/CompressionMethodChecker.php index ff9cbfb6..cc5ad0fa 100644 --- a/src/Components/Health/Checker/PerformanceChecker/CompressionMethodChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/CompressionMethodChecker.php @@ -68,7 +68,7 @@ private function checkCompression(HealthCollection $collection, string $function SettingsResult::ok( strtolower($functionality) . '-compression-method-extension-zstd', 'PHP extension zstd for ' . $functionality . ' compression method', - \extension_loaded('zstd'), + \extension_loaded('zstd') ? 'enabled' : 'disabled', 'enabled', self::DOCUMENTATION_URL, ), diff --git a/src/Components/Health/Checker/PerformanceChecker/MysqlSettingsChecker.php b/src/Components/Health/Checker/PerformanceChecker/MysqlSettingsChecker.php index 1103e8fe..f569fa96 100644 --- a/src/Components/Health/Checker/PerformanceChecker/MysqlSettingsChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/MysqlSettingsChecker.php @@ -55,7 +55,7 @@ private function checkGroupConcatMaxLen(HealthCollection $collection): void SettingsResult::ok( 'sql_group_concat_max_len', 'MySQL value group_concat_max_len', - (string) $groupConcatMaxLen, + '', 'min ' . self::MYSQL_GROUP_CONCAT_MAX_LEN, self::DOCUMENTATION_URL, ), @@ -80,7 +80,7 @@ private function checkSqlMode(HealthCollection $collection): void SettingsResult::ok( 'sql_mode', 'MySQL value sql_mode', - $sqlMode, + (string) $sqlMode, 'No ' . self::MYSQL_SQL_MODE_PART, self::DOCUMENTATION_URL, ), @@ -105,7 +105,7 @@ private function checkTimeZone(HealthCollection $collection): void SettingsResult::ok( 'sql_time_zone', 'MySQL value time_zone', - $timeZone, + (string) $timeZone, implode(', ', self::MYSQL_TIME_ZONES), self::DOCUMENTATION_URL, ), From f1b881104a999c59e41d89c5589dd4602c33d04c Mon Sep 17 00:00:00 2001 From: zukucker Date: Mon, 26 Jan 2026 08:48:34 +0100 Subject: [PATCH 07/12] added new static method for creating a settingsresult --- src/Components/Health/SettingsResult.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/Components/Health/SettingsResult.php b/src/Components/Health/SettingsResult.php index e246e287..ef18c5f3 100644 --- a/src/Components/Health/SettingsResult.php +++ b/src/Components/Health/SettingsResult.php @@ -76,4 +76,22 @@ public static function info(string $id, string $snippet, string $current = '', s return $me; } + + public static function create( + ?string $state, + string $id, + string $snippet, + string $current = '', + string $recommended = '', + ?string $url = null + ): self + { + return match ($state) { + 'ok' => self::ok($id, $snippet, $current, $recommended, $url), + 'warning' => self::warning($id, $snippet, $current, $recommended, $url), + 'error' => self::error($id, $snippet, $current, $recommended, $url), + 'info' => self::info($id, $snippet, $current, $recommended, $url), +default => throw new \InvalidArgumentException("Invalid state: {$state}"), + }; + } } From bb0c389274b09777c641d0bd1b45784a50f21c62 Mon Sep 17 00:00:00 2001 From: zukucker Date: Mon, 26 Jan 2026 08:49:49 +0100 Subject: [PATCH 08/12] refactor the if else clauses --- .../PerformanceChecker/AdminWorkerChecker.php | 30 ++-- .../DisableAppUrlExternalCheckChecker.php | 30 ++-- .../DisableSymfonySecretsChecker.php | 30 ++-- .../DisabledMailUpdatesChecker.php | 19 +-- .../Checker/PerformanceChecker/EsChecker.php | 30 ++-- .../FineGrainedCachingChecker.php | 40 ++--- .../FixCacheIdSetChecker.php | 30 ++-- .../IncrementStorageChecker.php | 30 ++-- .../PerformanceChecker/LoggerLevelChecker.php | 14 +- .../MailOverQueueChecker.php | 30 ++-- .../MessengerAutoSetupChecker.php | 32 ++-- .../MysqlSettingsChecker.php | 127 ++++++---------- .../PerformanceChecker/PhpSettingsChecker.php | 137 +++++++++--------- .../ProductStreamIndexingChecker.php | 30 ++-- .../RedisTagAwareChecker.php | 32 ++-- src/Components/Health/SettingsResult.php | 15 +- 16 files changed, 244 insertions(+), 412 deletions(-) diff --git a/src/Components/Health/Checker/PerformanceChecker/AdminWorkerChecker.php b/src/Components/Health/Checker/PerformanceChecker/AdminWorkerChecker.php index 0abd92f9..32647ed3 100644 --- a/src/Components/Health/Checker/PerformanceChecker/AdminWorkerChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/AdminWorkerChecker.php @@ -19,25 +19,15 @@ public function __construct( public function collect(HealthCollection $collection): void { - if ($this->adminWorkerEnabled) { - $collection->add( - SettingsResult::warning( - 'admin-watcher', - 'Admin-Worker', - 'enabled', - 'disabled', - ), - ); - } else { - $collection->add( - SettingsResult::ok( - 'admin-watcher', - 'Admin-Worker', - 'disabled', - 'disabled', - 'https://developer.shopware.com/docs/guides/plugins/plugins/framework/message-queue/add-message-handler#the-admin-worker', - ), - ); - } + $collection->add( + SettingsResult::create( + $this->adminWorkerEnabled ? 'warning' : 'ok', + 'admin-watcher', + 'Admin-Worker', + $this->adminWorkerEnabled ? 'enabled' : 'disabled', + 'disabled', + 'https://developer.shopware.com/docs/guides/plugins/plugins/framework/message-queue/add-message-handler#the-admin-worker', + ), + ); } } diff --git a/src/Components/Health/Checker/PerformanceChecker/DisableAppUrlExternalCheckChecker.php b/src/Components/Health/Checker/PerformanceChecker/DisableAppUrlExternalCheckChecker.php index 7717f581..080de28a 100644 --- a/src/Components/Health/Checker/PerformanceChecker/DisableAppUrlExternalCheckChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/DisableAppUrlExternalCheckChecker.php @@ -14,25 +14,15 @@ class DisableAppUrlExternalCheckChecker implements PerformanceCheckerInterface, public function collect(HealthCollection $collection): void { $appUrlCheckDisabled = (bool) EnvironmentHelper::getVariable('APP_URL_CHECK_DISABLED', false); - if (!$appUrlCheckDisabled) { - $collection->add( - SettingsResult::warning( - 'app-url-check-disabled', - 'App URL external check', - 'enabled', - 'disabled', - ), - ); - } else { - $collection->add( - SettingsResult::ok( - 'app-url-check-disabled', - 'App URL external check', - 'disabled', - 'disabled', - 'https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks.html#disable-app-url-external-check', - ), - ); - } + $collection->add( + SettingsResult::create( + !$appUrlCheckDisabled ? 'warning' : 'ok', + 'app-url-check-disabled', + 'App URL external check', + !$appUrlCheckDisabled ? 'enabled' : 'disabled', + 'disabled', + 'https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks.html#disable-app-url-external-check', + ) + ); } } diff --git a/src/Components/Health/Checker/PerformanceChecker/DisableSymfonySecretsChecker.php b/src/Components/Health/Checker/PerformanceChecker/DisableSymfonySecretsChecker.php index 01e6a5d5..ea5c51ed 100644 --- a/src/Components/Health/Checker/PerformanceChecker/DisableSymfonySecretsChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/DisableSymfonySecretsChecker.php @@ -20,25 +20,15 @@ public function __construct( public function collect(HealthCollection $collection): void { - if ($this->vault) { - $collection->add( - SettingsResult::info( - 'symfony-secrets', - 'Disable Symfony Secrets', - 'enabled', - 'disabled', - ), - ); - } else { - $collection->add( - SettingsResult::ok( - 'symfony-secrets', - 'Disable Symfony Secrets', - 'disabled', - 'disabled', - 'https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks.html#disable-symfony-secrets', - ), - ); - } + $collection->add( + SettingsResult::create( + $this->vault ? 'info' : 'ok', + 'symfony-secrets', + 'Disable Symfony Secrets', + $this->vault ? 'enabled' : 'disabled', + 'disabled', + 'https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks.html#disable-symfony-secrets', + ), + ); } } diff --git a/src/Components/Health/Checker/PerformanceChecker/DisabledMailUpdatesChecker.php b/src/Components/Health/Checker/PerformanceChecker/DisabledMailUpdatesChecker.php index b4fdab37..c3db3b6f 100644 --- a/src/Components/Health/Checker/PerformanceChecker/DisabledMailUpdatesChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/DisabledMailUpdatesChecker.php @@ -23,25 +23,12 @@ public function collect(HealthCollection $collection): void $setting = $this->params->get('shopware.mail.update_mail_variables_on_send'); - if (!$setting) { - $collection->add( - SettingsResult::ok( - 'mail_variables', - 'MailVariables updates', - 'disabled', - 'disabled', - 'https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks#prevent-mail-data-updates' - ) - ); - - return; - } - $collection->add( - SettingsResult::warning( + SettingsResult::create( + !$setting ? 'ok' : 'warning', 'mail_variables', 'MailVariables updates', - 'enabled', + $setting ? 'enabled' : 'disabled', 'disabled', 'https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks#prevent-mail-data-updates' ) diff --git a/src/Components/Health/Checker/PerformanceChecker/EsChecker.php b/src/Components/Health/Checker/PerformanceChecker/EsChecker.php index 3f5c8c9e..6d241e39 100644 --- a/src/Components/Health/Checker/PerformanceChecker/EsChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/EsChecker.php @@ -20,25 +20,15 @@ public function __construct(ElasticsearchManager $elasticsearchManager) public function collect(HealthCollection $collection): void { - if (!$this->esEnabled) { - $collection->add( - SettingsResult::info( - 'elasticsearch', - 'Elasticsearch', - 'disabled', - 'enabled', - ), - ); - } else { - $collection->add( - SettingsResult::ok( - 'elasticsearch', - 'Elasticsearch', - 'enabled', - 'enabled', - 'https://developer.shopware.com/docs/guides/hosting/infrastructure/elasticsearch/elasticsearch-setup', - ), - ); - } + $collection->add( + SettingsResult::create( + !$this->esEnabled ? 'info' : 'ok', + 'elasticsearch', + 'Elasticsearch', + !$this->esEnabled ? 'disabled' : 'enabled', + 'enabled', + 'https://developer.shopware.com/docs/guides/hosting/infrastructure/elasticsearch/elasticsearch-setup', + ) + ); } } diff --git a/src/Components/Health/Checker/PerformanceChecker/FineGrainedCachingChecker.php b/src/Components/Health/Checker/PerformanceChecker/FineGrainedCachingChecker.php index 59daca30..b052002f 100644 --- a/src/Components/Health/Checker/PerformanceChecker/FineGrainedCachingChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/FineGrainedCachingChecker.php @@ -1,6 +1,4 @@ -shopwareVersion, '6.7.0.0', '>=')) { return; } - - if ($this->cacheTaggingEachConfig || $this->cacheTaggingEachSnippet || $this->cacheTaggingEachThemeConfig) { - $collection->add( - // only info, because it only affects redis, varnish etc. - SettingsResult::info( - 'fine-grained-caching', - 'Fine-grained caching on Redis, Varnish etc.', - 'enabled', - 'disabled', - ), - ); - } else { - $collection->add( - // only info, because it only affects redis, varnish etc. - SettingsResult::ok( - 'fine-grained-caching', - 'Fine-grained caching on Redis, Varnish etc.', - 'disabled', - 'disabled', - self::DOCUMENTATION_URL, - ), - ); - } + $collection->add( + // only info, because it only affects redis, varnish etc. + SettingsResult::create( + $this->cacheTaggingEachConfig || $this->cacheTaggingEachSnippet || $this->cacheTaggingEachThemeConfig ? 'info' : 'ok', + 'fine-grained-caching', + 'Fine-grained caching on Redis, Varnish etc.', + 'enabled', + 'disabled', + self::DOCUMENTATION_URL, + ), + ); } } diff --git a/src/Components/Health/Checker/PerformanceChecker/FixCacheIdSetChecker.php b/src/Components/Health/Checker/PerformanceChecker/FixCacheIdSetChecker.php index 4dee4c04..51c4671c 100644 --- a/src/Components/Health/Checker/PerformanceChecker/FixCacheIdSetChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/FixCacheIdSetChecker.php @@ -30,25 +30,15 @@ public function collect(HealthCollection $collection): void $cacheId = (string) EnvironmentHelper::getVariable('SHOPWARE_CACHE_ID', ''); - if ($cacheId === '') { - $collection->add( - SettingsResult::warning( - 'cache-id', - 'Fixed cache id', - 'not set', - 'set', - ), - ); - } else { - $collection->add( - SettingsResult::ok( - 'cache-id', - 'Fixed cache id', - 'set', - 'set', - 'https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks#cache-id', - ), - ); - } + $collection->add( + SettingsResult::create( + $cacheId ? 'warning' : 'ok', + 'cache-id', + 'Fixed cache id', + 'not set', + 'set', + 'https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks#cache-id', + ), + ); } } diff --git a/src/Components/Health/Checker/PerformanceChecker/IncrementStorageChecker.php b/src/Components/Health/Checker/PerformanceChecker/IncrementStorageChecker.php index cbac1060..a4662a2c 100644 --- a/src/Components/Health/Checker/PerformanceChecker/IncrementStorageChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/IncrementStorageChecker.php @@ -23,25 +23,15 @@ public function collect(HealthCollection $collection): void { $recommended = 'array or redis'; - if ($this->userActivity === 'mysql' || $this->queueActivity === 'mysql') { - $collection->add( - SettingsResult::warning( - 'increment-storage', - 'Increment storage', - 'mysql', - $recommended, - ), - ); - } else { - $collection->add( - SettingsResult::ok( - 'increment-storage', - 'Increment storage', - $this->userActivity, - $recommended, - 'https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks#increment-storage', - ), - ); - } + $collection->add( + SettingsResult::create( + $this->userActivity === 'mysql' || $this->queueActivity === 'mysql' ? 'warning' : 'ok', + 'increment-storage', + 'Increment storage', + $this->userActivity === 'mysql' || $this->queueActivity === 'mysql' ? 'mysql' : 'array or redis', + $recommended, + 'https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks#increment-storage', + ), + ); } } diff --git a/src/Components/Health/Checker/PerformanceChecker/LoggerLevelChecker.php b/src/Components/Health/Checker/PerformanceChecker/LoggerLevelChecker.php index e240f8e1..5f143e75 100644 --- a/src/Components/Health/Checker/PerformanceChecker/LoggerLevelChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/LoggerLevelChecker.php @@ -25,21 +25,13 @@ public function __construct( public function collect(HealthCollection $collection): void { - if ($this->businessEventHandlerLevel->isLowerThan(Level::Warning)) { - $collection->add(SettingsResult::warning( + $collection->add( + SettingsResult::create( + $this->businessEventHandlerLevel->isLowerThan(Level::Warning) ? 'warning' : 'ok', 'business_logger', 'BusinessEventHandler logging', Logger::toMonologLevel($this->businessEventHandlerLevel)->getName(), 'min WARNING', )); - } else { - $collection->add(SettingsResult::ok( - 'business_logger', - 'BusinessEventHandler logging', - Logger::toMonologLevel($this->businessEventHandlerLevel)->getName(), - 'min WARNING', - $this->url, - )); - } } } diff --git a/src/Components/Health/Checker/PerformanceChecker/MailOverQueueChecker.php b/src/Components/Health/Checker/PerformanceChecker/MailOverQueueChecker.php index b1363793..c3684b83 100644 --- a/src/Components/Health/Checker/PerformanceChecker/MailOverQueueChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/MailOverQueueChecker.php @@ -19,25 +19,15 @@ public function __construct( public function collect(HealthCollection $collection): void { - if (!$this->mailerIsOverQueue) { - $collection->add( - SettingsResult::warning( - 'mail', - 'Sending mails over queue', - 'disabled', - 'enabled', - ), - ); - } else { - $collection->add( - SettingsResult::ok( - 'mail', - 'Sending mails over queue', - 'enabled', - 'enabled', - 'https://developer.shopware.com/docs/guides/hosting/infrastructure/message-queue#sending-mails-over-the-message-queue', - ), - ); - } + $collection->add( + SettingsResult::create( + !$this->mailerIsOverQueue ? 'warning' : 'ok', + 'mail', + 'Sending mails over queue', + $this->mailerIsOverQueue ? 'enabled' : 'disabled', + 'enabled', + 'https://developer.shopware.com/docs/guides/hosting/infrastructure/message-queue#sending-mails-over-the-message-queue', + ), + ); } } diff --git a/src/Components/Health/Checker/PerformanceChecker/MessengerAutoSetupChecker.php b/src/Components/Health/Checker/PerformanceChecker/MessengerAutoSetupChecker.php index ab4e179b..2b2da909 100644 --- a/src/Components/Health/Checker/PerformanceChecker/MessengerAutoSetupChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/MessengerAutoSetupChecker.php @@ -23,26 +23,18 @@ public function __construct( public function collect(HealthCollection $collection): void { - if ($this->isAutoSetupEnabled($this->messageTransportDsn) || $this->isAutoSetupEnabled($this->messageTransportDsnLowPriority) || $this->isAutoSetupEnabled($this->messageTransportDsnFailure)) { - $collection->add( - SettingsResult::info( - 'messenger-auto-setup', - 'Messenger auto_setup', - 'enabled', - 'disabled', - ), - ); - } else { - $collection->add( - SettingsResult::ok( - 'messenger-auto-setup', - 'Messenger auto_setup', - 'disabled', - 'disabled', - 'https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks.html#disable-auto-setup', - ), - ); - } + $autoSetupState = $this->isAutoSetupEnabled($this->messageTransportDsn) || $this->isAutoSetupEnabled($this->messageTransportDsnLowPriority) || $this->isAutoSetupEnabled($this->messageTransportDsnFailure); + + $collection->add( + SettingsResult::create( + $autoSetupState ? 'info' : 'ok', + 'messenger-auto-setup', + 'Messenger auto_setup', + 'enabled', + 'disabled', + 'https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks.html#disable-auto-setup', + ), + ); } private function isAutoSetupEnabled(string $messageTransportDsn): bool diff --git a/src/Components/Health/Checker/PerformanceChecker/MysqlSettingsChecker.php b/src/Components/Health/Checker/PerformanceChecker/MysqlSettingsChecker.php index f569fa96..e35337ec 100644 --- a/src/Components/Health/Checker/PerformanceChecker/MysqlSettingsChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/MysqlSettingsChecker.php @@ -13,6 +13,8 @@ class MysqlSettingsChecker implements PerformanceCheckerInterface, CheckerInterface { + public const DOCUMENTATION_URL = 'https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks.html#mysql-configuration'; + public const MYSQL_GROUP_CONCAT_MAX_LEN = 320000; public const MYSQL_SQL_MODE_PART = 'ONLY_FULL_GROUP_BY'; @@ -41,76 +43,50 @@ private function checkGroupConcatMaxLen(HealthCollection $collection): void { /** @var string|false $groupConcatMaxLen */ $groupConcatMaxLen = $this->connection->fetchOne('SELECT @@group_concat_max_len'); - if (!$groupConcatMaxLen || (int) $groupConcatMaxLen < self::MYSQL_GROUP_CONCAT_MAX_LEN) { - $collection->add( - SettingsResult::error( - 'sql_group_concat_max_len', - 'MySQL value group_concat_max_len', - (string) $groupConcatMaxLen, - 'min ' . self::MYSQL_GROUP_CONCAT_MAX_LEN, - ), - ); - } else { - $collection->add( - SettingsResult::ok( - 'sql_group_concat_max_len', - 'MySQL value group_concat_max_len', - '', - 'min ' . self::MYSQL_GROUP_CONCAT_MAX_LEN, - self::DOCUMENTATION_URL, - ), - ); - } + $maxLenNotOk = (int) $groupConcatMaxLen < self::MYSQL_GROUP_CONCAT_MAX_LEN; + + $collection->add( + SettingsResult::create( + $maxLenNotOk ? 'warning' : 'ok', + 'sql_group_concat_max_len', + 'MySQL value group_concat_max_len', + (string) $groupConcatMaxLen, + 'min ' . self::MYSQL_GROUP_CONCAT_MAX_LEN, + self::DOCUMENTATION_URL, + ), + ); } private function checkSqlMode(HealthCollection $collection): void { $sqlMode = $this->connection->fetchOne('SELECT @@sql_mode'); - if (\is_string($sqlMode) && \str_contains($sqlMode, self::MYSQL_SQL_MODE_PART)) { - $collection->add( - SettingsResult::error( - 'sql_mode', - 'MySQL value sql_mode', - $sqlMode, - 'No ' . self::MYSQL_SQL_MODE_PART, - ), - ); - } else { - $collection->add( - SettingsResult::ok( - 'sql_mode', - 'MySQL value sql_mode', - (string) $sqlMode, - 'No ' . self::MYSQL_SQL_MODE_PART, - self::DOCUMENTATION_URL, - ), - ); - } + $hasForbiddenMode = \is_string($sqlMode) && \str_contains($sqlMode, self::MYSQL_SQL_MODE_PART); + $collection->add( + SettingsResult::create( + $hasForbiddenMode ? 'error' : 'ok', + 'sql_mode', + 'MySQL value sql_mode', + (string) $sqlMode, + 'No ' . self::MYSQL_SQL_MODE_PART, + self::DOCUMENTATION_URL, + ), + ); } private function checkTimeZone(HealthCollection $collection): void { $timeZone = $this->connection->fetchOne('SELECT @@time_zone'); - if (\is_string($timeZone) && !\in_array($timeZone, self::MYSQL_TIME_ZONES, true)) { - $collection->add( - SettingsResult::warning( - 'sql_time_zone', - 'MySQL value time_zone', - $timeZone, - implode(', ', self::MYSQL_TIME_ZONES), - ), - ); - } else { - $collection->add( - SettingsResult::ok( - 'sql_time_zone', - 'MySQL value time_zone', - (string) $timeZone, - implode(', ', self::MYSQL_TIME_ZONES), - self::DOCUMENTATION_URL, - ), - ); - } + $isInvalidTimeZone = \is_string($timeZone) && !\in_array($timeZone, self::MYSQL_TIME_ZONES, true); + $collection->add( + SettingsResult::create( + $isInvalidTimeZone ? 'warning' : 'ok', + 'sql_time_zone', + 'MySQL value time_zone', + (string) $timeZone, + implode(', ', self::MYSQL_TIME_ZONES), + self::DOCUMENTATION_URL, + ), + ); } private function checkCheckDefaultEnvironmentSessionVariables(HealthCollection $collection): void @@ -121,25 +97,16 @@ private function checkCheckDefaultEnvironmentSessionVariables(HealthCollection $ } $setSessionVariables = (bool) EnvironmentHelper::getVariable('SQL_SET_DEFAULT_SESSION_VARIABLES', true); - if ($setSessionVariables) { - $collection->add( - SettingsResult::warning( - 'sql_set_default_session_variables', - 'MySQL session vars are set on each connect', - 'enabled', - 'disabled', - ), - ); - } else { - $collection->add( - SettingsResult::ok( - 'sql_set_default_session_variables', - 'MySQL session vars are set on each connect', - 'disabled', - 'disabled', - self::DOCUMENTATION_URL, - ), - ); - } + + $collection->add( + SettingsResult::create( + $setSessionVariables ? 'warning' : 'ok', + 'sql_set_default_session_variables', + 'MySQL session vars are set on each connect', + $setSessionVariables ? 'enabled' : 'disabled', + 'disabled', + self::DOCUMENTATION_URL, + ), + ); } } diff --git a/src/Components/Health/Checker/PerformanceChecker/PhpSettingsChecker.php b/src/Components/Health/Checker/PerformanceChecker/PhpSettingsChecker.php index 206c23fc..c8471395 100644 --- a/src/Components/Health/Checker/PerformanceChecker/PhpSettingsChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/PhpSettingsChecker.php @@ -12,94 +12,91 @@ class PhpSettingsChecker implements PerformanceCheckerInterface, CheckerInterfac { public function collect(HealthCollection $collection): void { - $this->checkAssertActive($collection); - $this->checkEnableFileOverride($collection); - $this->checkInternedStringsBuffer($collection); - $this->checkZendDetectUnicode($collection); - $this->checkRealpathCacheTtl($collection); + $url = 'https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks#php-config-tweaks'; + $this->checkAssertActive($collection, $url); + $this->checkEnableFileOverride($collection, $url); + $this->checkInternedStringsBuffer($collection, $url); + $this->checkZendDetectUnicode($collection, $url); + $this->checkRealpathCacheTtl($collection, $url); } - private function checkAssertActive(HealthCollection $collection): void + private function checkAssertActive(HealthCollection $collection, string $url): void { $currentValue = $this->iniGetFailover('zend.assertions'); - if ($currentValue !== '-1') { - $collection->add( - SettingsResult::warning( - 'zend.assertions', - 'PHP value zend.assertions', - $currentValue, - '-1', - ), - ); - } + $collection->add( + SettingsResult::create( + $currentValue !== '-1' ? 'warning' : 'ok', + 'zend.assertions', + 'PHP value zend.assertions', + $currentValue, + '-1', + $url, + ), + ); } - private function checkEnableFileOverride(HealthCollection $collection): void + private function checkEnableFileOverride(HealthCollection $collection, string $url): void { - if (!$this->isIniEnabled('opcache.enable_file_override')) { - $collection->add( - SettingsResult::warning( - 'php.opcache.enable_file_override', - 'PHP value opcache.enable_file_override', - $this->iniGetFailover('opcache.enable_file_override'), - '1', - ), - ); - } else { - $collection->add( - SettingsResult::ok( - 'php.opcache.enable_file_override', - 'PHP value opcache.enable_file_override', - $currentValue, - '1', - $url, - ), - ); - } + $currentValue = $this->iniGetFailover('opcache.enable_file_override'); + $iniFailOver = !$this->isIniEnabled('opcache.enable_file_override'); + $collection->add( + SettingsResult::create( + $iniFailOver ? 'warning' : 'ok', + 'php.opcache.enable_file_override', + 'PHP value opcache.enable_file_override', + $currentValue, + '1', + $url, + ), + ); } - private function checkInternedStringsBuffer(HealthCollection $collection): void + private function checkInternedStringsBuffer(HealthCollection $collection, string $url): void { $currentValue = $this->iniGetFailover('opcache.interned_strings_buffer'); - if ((int) $currentValue < 20) { - $collection->add( - SettingsResult::warning( - 'php.opcache.interned_strings_buffer', - 'PHP value opcache.interned_strings_buffer', - $currentValue, - 'min 20', - ), - ); - } + $bufferTooSmall = (int) $currentValue < 20; + $collection->add( + SettingsResult::create( + $bufferTooSmall ? 'warning' : 'ok', + 'php.opcache.interned_strings_buffer', + 'PHP value opcache.interned_strings_buffer', + $currentValue, + 'min 20', + $url, + ), + ); } - private function checkZendDetectUnicode(HealthCollection $collection): void + private function checkZendDetectUnicode(HealthCollection $collection, string $url): void { - if ($this->isIniEnabled('zend.detect_unicode')) { - $collection->add( - SettingsResult::warning( - 'php.zend.detect_unicode', - 'PHP value zend.detect_unicode', - $this->iniGetFailover('zend.detect_unicode'), - '0', - ), - ); - } + $currentValue = $this->iniGetFailover('zend.detect_unicode'); + $iniFailOver = $this->isIniEnabled('zend.detect_unicode'); + $collection->add( + SettingsResult::create( + $iniFailOver ? 'warning' : 'ok', + 'php.zend.detect_unicode', + 'PHP value zend.detect_unicode', + $currentValue, + '0', + $url, + ), + ); } - private function checkRealpathCacheTtl(HealthCollection $collection): void + private function checkRealpathCacheTtl(HealthCollection $collection, string $url): void { $currentValue = $this->iniGetFailover('realpath_cache_ttl'); - if ((int) $currentValue < 3600) { - $collection->add( - SettingsResult::warning( - 'php.zend.realpath_cache_ttl', - 'PHP value realpath_cache_ttl', - $currentValue, - 'min 3600', - ), - ); - } + $ttlTooLow = (int) $currentValue < 3600; + $collection->add( + SettingsResult::create( + $ttlTooLow ? 'warning' : 'ok', + 'php.zend.realpath_cache_ttl', + 'PHP value realpath_cache_ttl', + $currentValue, + 'min 3600', + $url, + ), + ); } /** diff --git a/src/Components/Health/Checker/PerformanceChecker/ProductStreamIndexingChecker.php b/src/Components/Health/Checker/PerformanceChecker/ProductStreamIndexingChecker.php index bd939042..1fcdefd0 100644 --- a/src/Components/Health/Checker/PerformanceChecker/ProductStreamIndexingChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/ProductStreamIndexingChecker.php @@ -26,25 +26,15 @@ public function collect(HealthCollection $collection): void return; } - if ($this->productStreamIndexingEnabled) { - $collection->add( - SettingsResult::info( - 'product-stream-indexing', - 'Product Stream Indexing', - 'enabled', - 'disabled', - ), - ); - } else { - $collection->add( - SettingsResult::ok( - 'product-stream-indexing', - 'Product Stream Indexing', - 'disabled', - 'disabled', - 'https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks.html#disable-product-stream-indexer', - ), - ); - } + $collection->add( + SettingsResult::create( + $this->productStreamIndexingEnabled ? 'info' : 'ok', + 'product-stream-indexing', + 'Product Stream Indexing', + 'enabled', + 'disabled', + 'https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks.html#disable-product-stream-indexer', + ), + ); } } diff --git a/src/Components/Health/Checker/PerformanceChecker/RedisTagAwareChecker.php b/src/Components/Health/Checker/PerformanceChecker/RedisTagAwareChecker.php index 4a7546c7..9f55fb6e 100644 --- a/src/Components/Health/Checker/PerformanceChecker/RedisTagAwareChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/RedisTagAwareChecker.php @@ -25,27 +25,17 @@ public function collect(HealthCollection $collection): void if (!\str_starts_with($httpCacheType, CacheAdapter::TYPE_REDIS)) { return; } + $notTagAware = !\str_starts_with($httpCacheType, CacheAdapter::TYPE_REDIS_TAG_AWARE); - if (!\str_starts_with($httpCacheType, CacheAdapter::TYPE_REDIS_TAG_AWARE)) { - $collection->add( - SettingsResult::warning( - 'redis-tag-aware', - 'Redis adapter should be TagAware', - CacheAdapter::TYPE_REDIS, - CacheAdapter::TYPE_REDIS_TAG_AWARE, - 'https://developer.shopware.com/docs/guides/hosting/performance/caches.html#example-replace-some-cache-with-redis', - ), - ); - } else { - $collection->add( - SettingsResult::ok( - 'redis-tag-aware', - 'Redis adapter is TagAware', - CacheAdapter::TYPE_REDIS, - CacheAdapter::TYPE_REDIS_TAG_AWARE, - 'https://developer.shopware.com/docs/guides/hosting/performance/caches.html#example-replace-some-cache-with-redis', - ), - ); - } + $collection->add( + SettingsResult::create( + $notTagAware ? 'warning' : 'ok', + 'redis-tag-aware', + 'Redis adapter should be TagAware', + CacheAdapter::TYPE_REDIS, + CacheAdapter::TYPE_REDIS_TAG_AWARE, + 'https://developer.shopware.com/docs/guides/hosting/performance/caches.html#example-replace-some-cache-with-redis', + ), + ); } } diff --git a/src/Components/Health/SettingsResult.php b/src/Components/Health/SettingsResult.php index ef18c5f3..0701de29 100644 --- a/src/Components/Health/SettingsResult.php +++ b/src/Components/Health/SettingsResult.php @@ -78,20 +78,19 @@ public static function info(string $id, string $snippet, string $current = '', s } public static function create( - ?string $state, - string $id, - string $snippet, - string $current = '', - string $recommended = '', + ?string $state, + string $id, + string $snippet, + string $current = '', + string $recommended = '', ?string $url = null - ): self - { + ): self { return match ($state) { 'ok' => self::ok($id, $snippet, $current, $recommended, $url), 'warning' => self::warning($id, $snippet, $current, $recommended, $url), 'error' => self::error($id, $snippet, $current, $recommended, $url), 'info' => self::info($id, $snippet, $current, $recommended, $url), -default => throw new \InvalidArgumentException("Invalid state: {$state}"), + default => throw new \InvalidArgumentException("Invalid state: {$state}"), }; } } From 0479eb033c20119fdeb01034756eb480c79b93f1 Mon Sep 17 00:00:00 2001 From: zukucker Date: Mon, 26 Jan 2026 09:01:00 +0100 Subject: [PATCH 09/12] bigger refactor --- .../CompressionMethodChecker.php | 35 +++++----- .../QueueConnectionChecker.php | 68 +++++++++---------- 2 files changed, 51 insertions(+), 52 deletions(-) diff --git a/src/Components/Health/Checker/PerformanceChecker/CompressionMethodChecker.php b/src/Components/Health/Checker/PerformanceChecker/CompressionMethodChecker.php index cc5ad0fa..7fc0e09f 100644 --- a/src/Components/Health/Checker/PerformanceChecker/CompressionMethodChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/CompressionMethodChecker.php @@ -11,6 +11,8 @@ class CompressionMethodChecker implements PerformanceCheckerInterface, CheckerInterface { + public const DOCUMENTATION_URL = 'https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks.html#using-zstd-instead-of-gzip-for-compression'; + public function __construct( #[Autowire(param: 'kernel.shopware_version')] public readonly string $shopwareVersion, @@ -41,34 +43,33 @@ private function checkCompression(HealthCollection $collection, string $function return; } + $id = strtolower($functionality) . '-compression-method'; + $snippet = $functionality . ' compression method'; + if ($method === 'gzip' && \version_compare($this->shopwareVersion, '6.7.1.0', '<')) { $collection->add( - SettingsResult::info( - strtolower($functionality) . '-compression-method', - $functionality . ' compression method', + SettingsResult::create( + 'info', + $id, + $snippet, 'gzip', 'zstd', + self::DOCUMENTATION_URL, ), ); return; } - if ($method === 'zstd' && !\extension_loaded('zstd')) { - $collection->add( - SettingsResult::error( - strtolower($functionality) . '-compression-method-extension-zstd', - 'PHP extension zstd for ' . $functionality . ' compression method', - 'disabled', - 'enabled', - ), - ); - } else { + if ($method === 'zstd') { + $extensionLoaded = \extension_loaded('zstd'); + $collection->add( - SettingsResult::ok( - strtolower($functionality) . '-compression-method-extension-zstd', - 'PHP extension zstd for ' . $functionality . ' compression method', - \extension_loaded('zstd') ? 'enabled' : 'disabled', + SettingsResult::create( + $extensionLoaded ? 'ok' : 'error', + $id . '-extension-zstd', + 'PHP extension zstd for ' . $snippet, + $extensionLoaded ? 'enabled' : 'disabled', 'enabled', self::DOCUMENTATION_URL, ), diff --git a/src/Components/Health/Checker/PerformanceChecker/QueueConnectionChecker.php b/src/Components/Health/Checker/PerformanceChecker/QueueConnectionChecker.php index fbd95c8b..3dbd418e 100644 --- a/src/Components/Health/Checker/PerformanceChecker/QueueConnectionChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/QueueConnectionChecker.php @@ -11,6 +11,10 @@ class QueueConnectionChecker implements PerformanceCheckerInterface, CheckerInterface { + private const ID = 'queue.adapter'; + private const URL = 'https://developer.shopware.com/docs/guides/hosting/infrastructure/message-queue.html#message-queue-on-production-systems'; + private const RECOMMENDED = 'redis or rabbitmq'; + public function __construct( #[Autowire(param: 'frosh_tools.queue_connection')] protected string $connection, @@ -20,44 +24,38 @@ public function __construct( public function collect(HealthCollection $collection): void { $schema = $this->getSchema(); + $state = $this->determineState($schema); + $snippet = $this->getSnippet($schema); - $id = 'queue.adapter'; - - if ($schema === 'doctrine') { - $collection->add( - SettingsResult::warning( - $id, - 'The queue storage in database does not scale well with multiple workers', - $schema, - 'redis or rabbitmq', - ), - ); - - return; - } + $collection->add( + SettingsResult::create( + $state, + self::ID, + $snippet, + $schema, + self::RECOMMENDED, + self::URL, + ), + ); + } - if ($schema === 'sync') { - $collection->add( - SettingsResult::warning( - $id, - 'The sync queue is not suitable for production environments', - $schema, - 'redis or rabbitmq', - ), - ); - } + private function determineState(string $schema): string + { + return match ($schema) { + 'redis', 'rabbitmq' => 'ok', + 'doctrine', 'sync' => 'warning', + default => 'info', + }; + } - if ($schema === 'redis' || $schema === 'rabiitmq') { - $collection->add( - SettingsResult::ok( - $id, - '', - $schema, - 'redis or rabbitmq', - $url, - ), - ); - } + private function getSnippet(string $schema): string + { + return match ($schema) { + 'doctrine' => 'The queue storage in database does not scale well with multiple workers', + 'sync' => 'The sync queue is not suitable for production environments', + 'redis', 'rabbitmq' => '', + default => 'Unknown queue adapter', + }; } private function getSchema(): string From c9969145991e075162a99a3a13a00d1b73f01223 Mon Sep 17 00:00:00 2001 From: zukucker Date: Mon, 26 Jan 2026 09:05:55 +0100 Subject: [PATCH 10/12] fix cs --- .../Checker/PerformanceChecker/LoggerLevelChecker.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Components/Health/Checker/PerformanceChecker/LoggerLevelChecker.php b/src/Components/Health/Checker/PerformanceChecker/LoggerLevelChecker.php index 5f143e75..dadc2c0b 100644 --- a/src/Components/Health/Checker/PerformanceChecker/LoggerLevelChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/LoggerLevelChecker.php @@ -16,6 +16,8 @@ class LoggerLevelChecker implements PerformanceCheckerInterface, CheckerInterfac { private readonly Level $businessEventHandlerLevel; + private string $url = 'https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks#logging'; + public function __construct( #[Autowire(service: 'monolog.handler.business_event_handler_buffer')] AbstractHandler $businessEventHandlerLevel, @@ -32,6 +34,8 @@ public function collect(HealthCollection $collection): void 'BusinessEventHandler logging', Logger::toMonologLevel($this->businessEventHandlerLevel)->getName(), 'min WARNING', - )); + $this->url, + ), + ); } } From fe07e96cdc1299658e3f5ba52cb3edf1df4b8405 Mon Sep 17 00:00:00 2001 From: Soner Sayakci Date: Thu, 2 Jul 2026 10:48:01 +0200 Subject: [PATCH 11/12] fix: address performance settings review --- .../PerformanceChecker/AdminWorkerChecker.php | 1 - .../CompressionMethodChecker.php | 4 --- .../DisableAppUrlExternalCheckChecker.php | 1 - .../DisableSymfonySecretsChecker.php | 1 - .../DisabledMailUpdatesChecker.php | 3 +-- .../Checker/PerformanceChecker/EsChecker.php | 1 - .../FineGrainedCachingChecker.php | 13 +++++----- .../FixCacheIdSetChecker.php | 5 ++-- .../IncrementStorageChecker.php | 1 - .../PerformanceChecker/LoggerLevelChecker.php | 3 --- .../MailOverQueueChecker.php | 1 - .../MessengerAutoSetupChecker.php | 3 +-- .../MysqlSettingsChecker.php | 6 ----- .../PerformanceChecker/PhpSettingsChecker.php | 26 +++++++------------ .../ProductStreamIndexingChecker.php | 3 +-- .../QueueConnectionChecker.php | 4 +-- .../RedisTagAwareChecker.php | 3 +-- src/Components/Health/SettingsResult.php | 25 +++++++----------- .../frosh-tools-tab-index/template.twig | 2 +- .../src/module/frosh-tools/snippet/de-DE.json | 1 + .../src/module/frosh-tools/snippet/en-GB.json | 1 + 21 files changed, 36 insertions(+), 72 deletions(-) diff --git a/src/Components/Health/Checker/PerformanceChecker/AdminWorkerChecker.php b/src/Components/Health/Checker/PerformanceChecker/AdminWorkerChecker.php index 32647ed3..b6d14fdc 100644 --- a/src/Components/Health/Checker/PerformanceChecker/AdminWorkerChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/AdminWorkerChecker.php @@ -26,7 +26,6 @@ public function collect(HealthCollection $collection): void 'Admin-Worker', $this->adminWorkerEnabled ? 'enabled' : 'disabled', 'disabled', - 'https://developer.shopware.com/docs/guides/plugins/plugins/framework/message-queue/add-message-handler#the-admin-worker', ), ); } diff --git a/src/Components/Health/Checker/PerformanceChecker/CompressionMethodChecker.php b/src/Components/Health/Checker/PerformanceChecker/CompressionMethodChecker.php index 7fc0e09f..4015fa9d 100644 --- a/src/Components/Health/Checker/PerformanceChecker/CompressionMethodChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/CompressionMethodChecker.php @@ -11,8 +11,6 @@ class CompressionMethodChecker implements PerformanceCheckerInterface, CheckerInterface { - public const DOCUMENTATION_URL = 'https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks.html#using-zstd-instead-of-gzip-for-compression'; - public function __construct( #[Autowire(param: 'kernel.shopware_version')] public readonly string $shopwareVersion, @@ -54,7 +52,6 @@ private function checkCompression(HealthCollection $collection, string $function $snippet, 'gzip', 'zstd', - self::DOCUMENTATION_URL, ), ); @@ -71,7 +68,6 @@ private function checkCompression(HealthCollection $collection, string $function 'PHP extension zstd for ' . $snippet, $extensionLoaded ? 'enabled' : 'disabled', 'enabled', - self::DOCUMENTATION_URL, ), ); } diff --git a/src/Components/Health/Checker/PerformanceChecker/DisableAppUrlExternalCheckChecker.php b/src/Components/Health/Checker/PerformanceChecker/DisableAppUrlExternalCheckChecker.php index 080de28a..62655aa7 100644 --- a/src/Components/Health/Checker/PerformanceChecker/DisableAppUrlExternalCheckChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/DisableAppUrlExternalCheckChecker.php @@ -21,7 +21,6 @@ public function collect(HealthCollection $collection): void 'App URL external check', !$appUrlCheckDisabled ? 'enabled' : 'disabled', 'disabled', - 'https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks.html#disable-app-url-external-check', ) ); } diff --git a/src/Components/Health/Checker/PerformanceChecker/DisableSymfonySecretsChecker.php b/src/Components/Health/Checker/PerformanceChecker/DisableSymfonySecretsChecker.php index ea5c51ed..b064091a 100644 --- a/src/Components/Health/Checker/PerformanceChecker/DisableSymfonySecretsChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/DisableSymfonySecretsChecker.php @@ -27,7 +27,6 @@ public function collect(HealthCollection $collection): void 'Disable Symfony Secrets', $this->vault ? 'enabled' : 'disabled', 'disabled', - 'https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks.html#disable-symfony-secrets', ), ); } diff --git a/src/Components/Health/Checker/PerformanceChecker/DisabledMailUpdatesChecker.php b/src/Components/Health/Checker/PerformanceChecker/DisabledMailUpdatesChecker.php index c3db3b6f..c909a8fe 100644 --- a/src/Components/Health/Checker/PerformanceChecker/DisabledMailUpdatesChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/DisabledMailUpdatesChecker.php @@ -29,8 +29,7 @@ public function collect(HealthCollection $collection): void 'mail_variables', 'MailVariables updates', $setting ? 'enabled' : 'disabled', - 'disabled', - 'https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks#prevent-mail-data-updates' + 'disabled' ) ); } diff --git a/src/Components/Health/Checker/PerformanceChecker/EsChecker.php b/src/Components/Health/Checker/PerformanceChecker/EsChecker.php index 6d241e39..d36aaf26 100644 --- a/src/Components/Health/Checker/PerformanceChecker/EsChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/EsChecker.php @@ -27,7 +27,6 @@ public function collect(HealthCollection $collection): void 'Elasticsearch', !$this->esEnabled ? 'disabled' : 'enabled', 'enabled', - 'https://developer.shopware.com/docs/guides/hosting/infrastructure/elasticsearch/elasticsearch-setup', ) ); } diff --git a/src/Components/Health/Checker/PerformanceChecker/FineGrainedCachingChecker.php b/src/Components/Health/Checker/PerformanceChecker/FineGrainedCachingChecker.php index b052002f..22679188 100644 --- a/src/Components/Health/Checker/PerformanceChecker/FineGrainedCachingChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/FineGrainedCachingChecker.php @@ -1,4 +1,6 @@ -shopwareVersion, '6.7.0.0', '>=')) { return; } + $fineGrainedCachingEnabled = $this->cacheTaggingEachConfig || $this->cacheTaggingEachSnippet || $this->cacheTaggingEachThemeConfig; + $collection->add( // only info, because it only affects redis, varnish etc. SettingsResult::create( - $this->cacheTaggingEachConfig || $this->cacheTaggingEachSnippet || $this->cacheTaggingEachThemeConfig ? 'info' : 'ok', + $fineGrainedCachingEnabled ? 'info' : 'ok', 'fine-grained-caching', 'Fine-grained caching on Redis, Varnish etc.', - 'enabled', + $fineGrainedCachingEnabled ? 'enabled' : 'disabled', 'disabled', - self::DOCUMENTATION_URL, ), ); } diff --git a/src/Components/Health/Checker/PerformanceChecker/FixCacheIdSetChecker.php b/src/Components/Health/Checker/PerformanceChecker/FixCacheIdSetChecker.php index 51c4671c..787d4f83 100644 --- a/src/Components/Health/Checker/PerformanceChecker/FixCacheIdSetChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/FixCacheIdSetChecker.php @@ -32,12 +32,11 @@ public function collect(HealthCollection $collection): void $collection->add( SettingsResult::create( - $cacheId ? 'warning' : 'ok', + $cacheId === '' ? 'warning' : 'ok', 'cache-id', 'Fixed cache id', - 'not set', + $cacheId === '' ? 'not set' : 'set', 'set', - 'https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks#cache-id', ), ); } diff --git a/src/Components/Health/Checker/PerformanceChecker/IncrementStorageChecker.php b/src/Components/Health/Checker/PerformanceChecker/IncrementStorageChecker.php index a4662a2c..dede5ca7 100644 --- a/src/Components/Health/Checker/PerformanceChecker/IncrementStorageChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/IncrementStorageChecker.php @@ -30,7 +30,6 @@ public function collect(HealthCollection $collection): void 'Increment storage', $this->userActivity === 'mysql' || $this->queueActivity === 'mysql' ? 'mysql' : 'array or redis', $recommended, - 'https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks#increment-storage', ), ); } diff --git a/src/Components/Health/Checker/PerformanceChecker/LoggerLevelChecker.php b/src/Components/Health/Checker/PerformanceChecker/LoggerLevelChecker.php index dadc2c0b..a0426f75 100644 --- a/src/Components/Health/Checker/PerformanceChecker/LoggerLevelChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/LoggerLevelChecker.php @@ -16,8 +16,6 @@ class LoggerLevelChecker implements PerformanceCheckerInterface, CheckerInterfac { private readonly Level $businessEventHandlerLevel; - private string $url = 'https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks#logging'; - public function __construct( #[Autowire(service: 'monolog.handler.business_event_handler_buffer')] AbstractHandler $businessEventHandlerLevel, @@ -34,7 +32,6 @@ public function collect(HealthCollection $collection): void 'BusinessEventHandler logging', Logger::toMonologLevel($this->businessEventHandlerLevel)->getName(), 'min WARNING', - $this->url, ), ); } diff --git a/src/Components/Health/Checker/PerformanceChecker/MailOverQueueChecker.php b/src/Components/Health/Checker/PerformanceChecker/MailOverQueueChecker.php index c3684b83..588ff354 100644 --- a/src/Components/Health/Checker/PerformanceChecker/MailOverQueueChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/MailOverQueueChecker.php @@ -26,7 +26,6 @@ public function collect(HealthCollection $collection): void 'Sending mails over queue', $this->mailerIsOverQueue ? 'enabled' : 'disabled', 'enabled', - 'https://developer.shopware.com/docs/guides/hosting/infrastructure/message-queue#sending-mails-over-the-message-queue', ), ); } diff --git a/src/Components/Health/Checker/PerformanceChecker/MessengerAutoSetupChecker.php b/src/Components/Health/Checker/PerformanceChecker/MessengerAutoSetupChecker.php index 2b2da909..dc63a621 100644 --- a/src/Components/Health/Checker/PerformanceChecker/MessengerAutoSetupChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/MessengerAutoSetupChecker.php @@ -30,9 +30,8 @@ public function collect(HealthCollection $collection): void $autoSetupState ? 'info' : 'ok', 'messenger-auto-setup', 'Messenger auto_setup', - 'enabled', + $autoSetupState ? 'enabled' : 'disabled', 'disabled', - 'https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks.html#disable-auto-setup', ), ); } diff --git a/src/Components/Health/Checker/PerformanceChecker/MysqlSettingsChecker.php b/src/Components/Health/Checker/PerformanceChecker/MysqlSettingsChecker.php index e35337ec..1303a8de 100644 --- a/src/Components/Health/Checker/PerformanceChecker/MysqlSettingsChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/MysqlSettingsChecker.php @@ -13,8 +13,6 @@ class MysqlSettingsChecker implements PerformanceCheckerInterface, CheckerInterface { - public const DOCUMENTATION_URL = 'https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks.html#mysql-configuration'; - public const MYSQL_GROUP_CONCAT_MAX_LEN = 320000; public const MYSQL_SQL_MODE_PART = 'ONLY_FULL_GROUP_BY'; @@ -52,7 +50,6 @@ private function checkGroupConcatMaxLen(HealthCollection $collection): void 'MySQL value group_concat_max_len', (string) $groupConcatMaxLen, 'min ' . self::MYSQL_GROUP_CONCAT_MAX_LEN, - self::DOCUMENTATION_URL, ), ); } @@ -68,7 +65,6 @@ private function checkSqlMode(HealthCollection $collection): void 'MySQL value sql_mode', (string) $sqlMode, 'No ' . self::MYSQL_SQL_MODE_PART, - self::DOCUMENTATION_URL, ), ); } @@ -84,7 +80,6 @@ private function checkTimeZone(HealthCollection $collection): void 'MySQL value time_zone', (string) $timeZone, implode(', ', self::MYSQL_TIME_ZONES), - self::DOCUMENTATION_URL, ), ); } @@ -105,7 +100,6 @@ private function checkCheckDefaultEnvironmentSessionVariables(HealthCollection $ 'MySQL session vars are set on each connect', $setSessionVariables ? 'enabled' : 'disabled', 'disabled', - self::DOCUMENTATION_URL, ), ); } diff --git a/src/Components/Health/Checker/PerformanceChecker/PhpSettingsChecker.php b/src/Components/Health/Checker/PerformanceChecker/PhpSettingsChecker.php index c8471395..4433ab9d 100644 --- a/src/Components/Health/Checker/PerformanceChecker/PhpSettingsChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/PhpSettingsChecker.php @@ -12,15 +12,14 @@ class PhpSettingsChecker implements PerformanceCheckerInterface, CheckerInterfac { public function collect(HealthCollection $collection): void { - $url = 'https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks#php-config-tweaks'; - $this->checkAssertActive($collection, $url); - $this->checkEnableFileOverride($collection, $url); - $this->checkInternedStringsBuffer($collection, $url); - $this->checkZendDetectUnicode($collection, $url); - $this->checkRealpathCacheTtl($collection, $url); + $this->checkAssertActive($collection); + $this->checkEnableFileOverride($collection); + $this->checkInternedStringsBuffer($collection); + $this->checkZendDetectUnicode($collection); + $this->checkRealpathCacheTtl($collection); } - private function checkAssertActive(HealthCollection $collection, string $url): void + private function checkAssertActive(HealthCollection $collection): void { $currentValue = $this->iniGetFailover('zend.assertions'); $collection->add( @@ -30,12 +29,11 @@ private function checkAssertActive(HealthCollection $collection, string $url): v 'PHP value zend.assertions', $currentValue, '-1', - $url, ), ); } - private function checkEnableFileOverride(HealthCollection $collection, string $url): void + private function checkEnableFileOverride(HealthCollection $collection): void { $currentValue = $this->iniGetFailover('opcache.enable_file_override'); $iniFailOver = !$this->isIniEnabled('opcache.enable_file_override'); @@ -46,12 +44,11 @@ private function checkEnableFileOverride(HealthCollection $collection, string $u 'PHP value opcache.enable_file_override', $currentValue, '1', - $url, ), ); } - private function checkInternedStringsBuffer(HealthCollection $collection, string $url): void + private function checkInternedStringsBuffer(HealthCollection $collection): void { $currentValue = $this->iniGetFailover('opcache.interned_strings_buffer'); $bufferTooSmall = (int) $currentValue < 20; @@ -62,12 +59,11 @@ private function checkInternedStringsBuffer(HealthCollection $collection, string 'PHP value opcache.interned_strings_buffer', $currentValue, 'min 20', - $url, ), ); } - private function checkZendDetectUnicode(HealthCollection $collection, string $url): void + private function checkZendDetectUnicode(HealthCollection $collection): void { $currentValue = $this->iniGetFailover('zend.detect_unicode'); $iniFailOver = $this->isIniEnabled('zend.detect_unicode'); @@ -78,12 +74,11 @@ private function checkZendDetectUnicode(HealthCollection $collection, string $ur 'PHP value zend.detect_unicode', $currentValue, '0', - $url, ), ); } - private function checkRealpathCacheTtl(HealthCollection $collection, string $url): void + private function checkRealpathCacheTtl(HealthCollection $collection): void { $currentValue = $this->iniGetFailover('realpath_cache_ttl'); $ttlTooLow = (int) $currentValue < 3600; @@ -94,7 +89,6 @@ private function checkRealpathCacheTtl(HealthCollection $collection, string $url 'PHP value realpath_cache_ttl', $currentValue, 'min 3600', - $url, ), ); } diff --git a/src/Components/Health/Checker/PerformanceChecker/ProductStreamIndexingChecker.php b/src/Components/Health/Checker/PerformanceChecker/ProductStreamIndexingChecker.php index 1fcdefd0..ba22c0fd 100644 --- a/src/Components/Health/Checker/PerformanceChecker/ProductStreamIndexingChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/ProductStreamIndexingChecker.php @@ -31,9 +31,8 @@ public function collect(HealthCollection $collection): void $this->productStreamIndexingEnabled ? 'info' : 'ok', 'product-stream-indexing', 'Product Stream Indexing', - 'enabled', + $this->productStreamIndexingEnabled ? 'enabled' : 'disabled', 'disabled', - 'https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks.html#disable-product-stream-indexer', ), ); } diff --git a/src/Components/Health/Checker/PerformanceChecker/QueueConnectionChecker.php b/src/Components/Health/Checker/PerformanceChecker/QueueConnectionChecker.php index 3dbd418e..040bbc02 100644 --- a/src/Components/Health/Checker/PerformanceChecker/QueueConnectionChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/QueueConnectionChecker.php @@ -12,7 +12,6 @@ class QueueConnectionChecker implements PerformanceCheckerInterface, CheckerInterface { private const ID = 'queue.adapter'; - private const URL = 'https://developer.shopware.com/docs/guides/hosting/infrastructure/message-queue.html#message-queue-on-production-systems'; private const RECOMMENDED = 'redis or rabbitmq'; public function __construct( @@ -34,7 +33,6 @@ public function collect(HealthCollection $collection): void $snippet, $schema, self::RECOMMENDED, - self::URL, ), ); } @@ -53,7 +51,7 @@ private function getSnippet(string $schema): string return match ($schema) { 'doctrine' => 'The queue storage in database does not scale well with multiple workers', 'sync' => 'The sync queue is not suitable for production environments', - 'redis', 'rabbitmq' => '', + 'redis', 'rabbitmq' => 'Queue adapter', default => 'Unknown queue adapter', }; } diff --git a/src/Components/Health/Checker/PerformanceChecker/RedisTagAwareChecker.php b/src/Components/Health/Checker/PerformanceChecker/RedisTagAwareChecker.php index 9f55fb6e..47713802 100644 --- a/src/Components/Health/Checker/PerformanceChecker/RedisTagAwareChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/RedisTagAwareChecker.php @@ -32,9 +32,8 @@ public function collect(HealthCollection $collection): void $notTagAware ? 'warning' : 'ok', 'redis-tag-aware', 'Redis adapter should be TagAware', - CacheAdapter::TYPE_REDIS, + $httpCacheType, CacheAdapter::TYPE_REDIS_TAG_AWARE, - 'https://developer.shopware.com/docs/guides/hosting/performance/caches.html#example-replace-some-cache-with-redis', ), ); } diff --git a/src/Components/Health/SettingsResult.php b/src/Components/Health/SettingsResult.php index 0701de29..2eaba144 100644 --- a/src/Components/Health/SettingsResult.php +++ b/src/Components/Health/SettingsResult.php @@ -19,13 +19,11 @@ class SettingsResult extends Struct public string $state; - public ?string $url = null; - public string $id; protected string $snippet; - public static function ok(string $id, string $snippet, string $current = '', string $recommended = '', ?string $url = null): self + public static function ok(string $id, string $snippet, string $current = '', string $recommended = ''): self { $me = new self(); $me->id = $id; @@ -33,12 +31,11 @@ public static function ok(string $id, string $snippet, string $current = '', str $me->snippet = $snippet; $me->current = $current; $me->recommended = $recommended; - $me->url = $url; return $me; } - public static function warning(string $id, string $snippet, string $current = '', string $recommended = '', ?string $url = null): self + public static function warning(string $id, string $snippet, string $current = '', string $recommended = ''): self { $me = new self(); $me->id = $id; @@ -46,12 +43,11 @@ public static function warning(string $id, string $snippet, string $current = '' $me->snippet = $snippet; $me->current = $current; $me->recommended = $recommended; - $me->url = $url; return $me; } - public static function error(string $id, string $snippet, string $current = '', string $recommended = '', ?string $url = null): self + public static function error(string $id, string $snippet, string $current = '', string $recommended = ''): self { $me = new self(); $me->id = $id; @@ -59,12 +55,11 @@ public static function error(string $id, string $snippet, string $current = '', $me->snippet = $snippet; $me->current = $current; $me->recommended = $recommended; - $me->url = $url; return $me; } - public static function info(string $id, string $snippet, string $current = '', string $recommended = '', ?string $url = null): self + public static function info(string $id, string $snippet, string $current = '', string $recommended = ''): self { $me = new self(); $me->id = $id; @@ -72,7 +67,6 @@ public static function info(string $id, string $snippet, string $current = '', s $me->snippet = $snippet; $me->current = $current; $me->recommended = $recommended; - $me->url = $url; return $me; } @@ -82,14 +76,13 @@ public static function create( string $id, string $snippet, string $current = '', - string $recommended = '', - ?string $url = null + string $recommended = '' ): self { return match ($state) { - 'ok' => self::ok($id, $snippet, $current, $recommended, $url), - 'warning' => self::warning($id, $snippet, $current, $recommended, $url), - 'error' => self::error($id, $snippet, $current, $recommended, $url), - 'info' => self::info($id, $snippet, $current, $recommended, $url), + 'ok' => self::ok($id, $snippet, $current, $recommended), + 'warning' => self::warning($id, $snippet, $current, $recommended), + 'error' => self::error($id, $snippet, $current, $recommended), + 'info' => self::info($id, $snippet, $current, $recommended), default => throw new \InvalidArgumentException("Invalid state: {$state}"), }; } diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-index/template.twig b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-index/template.twig index 28fdb4c5..f3e19071 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-index/template.twig +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-index/template.twig @@ -91,7 +91,7 @@ type="checkbox" v-model="showDone" > - {{ $t('frosh-tools.done') }} + {{ $t('frosh-tools.showDone') }} Date: Sat, 18 Jul 2026 22:06:20 +0200 Subject: [PATCH 12/12] fix: address review findings - restore error severity for group_concat_max_len check - show actual increment storage backend values instead of recommended text - skip sql_mode/timezone rows when the value cannot be read - type SettingsResult::create() state with class constants --- .../PerformanceChecker/AdminWorkerChecker.php | 2 +- .../DisableAppUrlExternalCheckChecker.php | 2 +- .../DisableSymfonySecretsChecker.php | 2 +- .../DisabledMailUpdatesChecker.php | 2 +- .../Checker/PerformanceChecker/EsChecker.php | 2 +- .../FineGrainedCachingChecker.php | 2 +- .../FixCacheIdSetChecker.php | 2 +- .../IncrementStorageChecker.php | 11 +++++--- .../PerformanceChecker/LoggerLevelChecker.php | 2 +- .../MailOverQueueChecker.php | 2 +- .../MessengerAutoSetupChecker.php | 2 +- .../MysqlSettingsChecker.php | 26 +++++++++++++------ .../PerformanceChecker/PhpSettingsChecker.php | 10 +++---- .../ProductStreamIndexingChecker.php | 2 +- .../QueueConnectionChecker.php | 6 ++--- .../RedisTagAwareChecker.php | 2 +- src/Components/Health/SettingsResult.php | 10 +++---- 17 files changed, 50 insertions(+), 37 deletions(-) diff --git a/src/Components/Health/Checker/PerformanceChecker/AdminWorkerChecker.php b/src/Components/Health/Checker/PerformanceChecker/AdminWorkerChecker.php index b6d14fdc..c91c137b 100644 --- a/src/Components/Health/Checker/PerformanceChecker/AdminWorkerChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/AdminWorkerChecker.php @@ -21,7 +21,7 @@ public function collect(HealthCollection $collection): void { $collection->add( SettingsResult::create( - $this->adminWorkerEnabled ? 'warning' : 'ok', + $this->adminWorkerEnabled ? SettingsResult::WARNING : SettingsResult::GREEN, 'admin-watcher', 'Admin-Worker', $this->adminWorkerEnabled ? 'enabled' : 'disabled', diff --git a/src/Components/Health/Checker/PerformanceChecker/DisableAppUrlExternalCheckChecker.php b/src/Components/Health/Checker/PerformanceChecker/DisableAppUrlExternalCheckChecker.php index 62655aa7..0168ed98 100644 --- a/src/Components/Health/Checker/PerformanceChecker/DisableAppUrlExternalCheckChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/DisableAppUrlExternalCheckChecker.php @@ -16,7 +16,7 @@ public function collect(HealthCollection $collection): void $appUrlCheckDisabled = (bool) EnvironmentHelper::getVariable('APP_URL_CHECK_DISABLED', false); $collection->add( SettingsResult::create( - !$appUrlCheckDisabled ? 'warning' : 'ok', + !$appUrlCheckDisabled ? SettingsResult::WARNING : SettingsResult::GREEN, 'app-url-check-disabled', 'App URL external check', !$appUrlCheckDisabled ? 'enabled' : 'disabled', diff --git a/src/Components/Health/Checker/PerformanceChecker/DisableSymfonySecretsChecker.php b/src/Components/Health/Checker/PerformanceChecker/DisableSymfonySecretsChecker.php index b064091a..b44120ba 100644 --- a/src/Components/Health/Checker/PerformanceChecker/DisableSymfonySecretsChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/DisableSymfonySecretsChecker.php @@ -22,7 +22,7 @@ public function collect(HealthCollection $collection): void { $collection->add( SettingsResult::create( - $this->vault ? 'info' : 'ok', + $this->vault ? SettingsResult::INFO : SettingsResult::GREEN, 'symfony-secrets', 'Disable Symfony Secrets', $this->vault ? 'enabled' : 'disabled', diff --git a/src/Components/Health/Checker/PerformanceChecker/DisabledMailUpdatesChecker.php b/src/Components/Health/Checker/PerformanceChecker/DisabledMailUpdatesChecker.php index c909a8fe..61f57124 100644 --- a/src/Components/Health/Checker/PerformanceChecker/DisabledMailUpdatesChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/DisabledMailUpdatesChecker.php @@ -25,7 +25,7 @@ public function collect(HealthCollection $collection): void $collection->add( SettingsResult::create( - !$setting ? 'ok' : 'warning', + !$setting ? SettingsResult::GREEN : SettingsResult::WARNING, 'mail_variables', 'MailVariables updates', $setting ? 'enabled' : 'disabled', diff --git a/src/Components/Health/Checker/PerformanceChecker/EsChecker.php b/src/Components/Health/Checker/PerformanceChecker/EsChecker.php index d36aaf26..841283a7 100644 --- a/src/Components/Health/Checker/PerformanceChecker/EsChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/EsChecker.php @@ -22,7 +22,7 @@ public function collect(HealthCollection $collection): void { $collection->add( SettingsResult::create( - !$this->esEnabled ? 'info' : 'ok', + !$this->esEnabled ? SettingsResult::INFO : SettingsResult::GREEN, 'elasticsearch', 'Elasticsearch', !$this->esEnabled ? 'disabled' : 'enabled', diff --git a/src/Components/Health/Checker/PerformanceChecker/FineGrainedCachingChecker.php b/src/Components/Health/Checker/PerformanceChecker/FineGrainedCachingChecker.php index 22679188..729436c7 100644 --- a/src/Components/Health/Checker/PerformanceChecker/FineGrainedCachingChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/FineGrainedCachingChecker.php @@ -38,7 +38,7 @@ public function collect(HealthCollection $collection): void $collection->add( // only info, because it only affects redis, varnish etc. SettingsResult::create( - $fineGrainedCachingEnabled ? 'info' : 'ok', + $fineGrainedCachingEnabled ? SettingsResult::INFO : SettingsResult::GREEN, 'fine-grained-caching', 'Fine-grained caching on Redis, Varnish etc.', $fineGrainedCachingEnabled ? 'enabled' : 'disabled', diff --git a/src/Components/Health/Checker/PerformanceChecker/FixCacheIdSetChecker.php b/src/Components/Health/Checker/PerformanceChecker/FixCacheIdSetChecker.php index 787d4f83..1c5df252 100644 --- a/src/Components/Health/Checker/PerformanceChecker/FixCacheIdSetChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/FixCacheIdSetChecker.php @@ -32,7 +32,7 @@ public function collect(HealthCollection $collection): void $collection->add( SettingsResult::create( - $cacheId === '' ? 'warning' : 'ok', + $cacheId === '' ? SettingsResult::WARNING : SettingsResult::GREEN, 'cache-id', 'Fixed cache id', $cacheId === '' ? 'not set' : 'set', diff --git a/src/Components/Health/Checker/PerformanceChecker/IncrementStorageChecker.php b/src/Components/Health/Checker/PerformanceChecker/IncrementStorageChecker.php index dede5ca7..d29d2bb6 100644 --- a/src/Components/Health/Checker/PerformanceChecker/IncrementStorageChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/IncrementStorageChecker.php @@ -21,15 +21,18 @@ public function __construct( public function collect(HealthCollection $collection): void { - $recommended = 'array or redis'; + $usesMysql = $this->userActivity === 'mysql' || $this->queueActivity === 'mysql'; + $current = $this->userActivity === $this->queueActivity + ? $this->userActivity + : $this->userActivity . ', ' . $this->queueActivity; $collection->add( SettingsResult::create( - $this->userActivity === 'mysql' || $this->queueActivity === 'mysql' ? 'warning' : 'ok', + $usesMysql ? SettingsResult::WARNING : SettingsResult::GREEN, 'increment-storage', 'Increment storage', - $this->userActivity === 'mysql' || $this->queueActivity === 'mysql' ? 'mysql' : 'array or redis', - $recommended, + $current, + 'array or redis', ), ); } diff --git a/src/Components/Health/Checker/PerformanceChecker/LoggerLevelChecker.php b/src/Components/Health/Checker/PerformanceChecker/LoggerLevelChecker.php index a0426f75..5c81a2c8 100644 --- a/src/Components/Health/Checker/PerformanceChecker/LoggerLevelChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/LoggerLevelChecker.php @@ -27,7 +27,7 @@ public function collect(HealthCollection $collection): void { $collection->add( SettingsResult::create( - $this->businessEventHandlerLevel->isLowerThan(Level::Warning) ? 'warning' : 'ok', + $this->businessEventHandlerLevel->isLowerThan(Level::Warning) ? SettingsResult::WARNING : SettingsResult::GREEN, 'business_logger', 'BusinessEventHandler logging', Logger::toMonologLevel($this->businessEventHandlerLevel)->getName(), diff --git a/src/Components/Health/Checker/PerformanceChecker/MailOverQueueChecker.php b/src/Components/Health/Checker/PerformanceChecker/MailOverQueueChecker.php index 588ff354..3d021d5d 100644 --- a/src/Components/Health/Checker/PerformanceChecker/MailOverQueueChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/MailOverQueueChecker.php @@ -21,7 +21,7 @@ public function collect(HealthCollection $collection): void { $collection->add( SettingsResult::create( - !$this->mailerIsOverQueue ? 'warning' : 'ok', + !$this->mailerIsOverQueue ? SettingsResult::WARNING : SettingsResult::GREEN, 'mail', 'Sending mails over queue', $this->mailerIsOverQueue ? 'enabled' : 'disabled', diff --git a/src/Components/Health/Checker/PerformanceChecker/MessengerAutoSetupChecker.php b/src/Components/Health/Checker/PerformanceChecker/MessengerAutoSetupChecker.php index dc63a621..56a839d7 100644 --- a/src/Components/Health/Checker/PerformanceChecker/MessengerAutoSetupChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/MessengerAutoSetupChecker.php @@ -27,7 +27,7 @@ public function collect(HealthCollection $collection): void $collection->add( SettingsResult::create( - $autoSetupState ? 'info' : 'ok', + $autoSetupState ? SettingsResult::INFO : SettingsResult::GREEN, 'messenger-auto-setup', 'Messenger auto_setup', $autoSetupState ? 'enabled' : 'disabled', diff --git a/src/Components/Health/Checker/PerformanceChecker/MysqlSettingsChecker.php b/src/Components/Health/Checker/PerformanceChecker/MysqlSettingsChecker.php index 1303a8de..4af9db9f 100644 --- a/src/Components/Health/Checker/PerformanceChecker/MysqlSettingsChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/MysqlSettingsChecker.php @@ -45,7 +45,7 @@ private function checkGroupConcatMaxLen(HealthCollection $collection): void $collection->add( SettingsResult::create( - $maxLenNotOk ? 'warning' : 'ok', + $maxLenNotOk ? SettingsResult::ERROR : SettingsResult::GREEN, 'sql_group_concat_max_len', 'MySQL value group_concat_max_len', (string) $groupConcatMaxLen, @@ -57,13 +57,18 @@ private function checkGroupConcatMaxLen(HealthCollection $collection): void private function checkSqlMode(HealthCollection $collection): void { $sqlMode = $this->connection->fetchOne('SELECT @@sql_mode'); - $hasForbiddenMode = \is_string($sqlMode) && \str_contains($sqlMode, self::MYSQL_SQL_MODE_PART); + + if (!\is_string($sqlMode)) { + return; + } + + $hasForbiddenMode = \str_contains($sqlMode, self::MYSQL_SQL_MODE_PART); $collection->add( SettingsResult::create( - $hasForbiddenMode ? 'error' : 'ok', + $hasForbiddenMode ? SettingsResult::ERROR : SettingsResult::GREEN, 'sql_mode', 'MySQL value sql_mode', - (string) $sqlMode, + $sqlMode, 'No ' . self::MYSQL_SQL_MODE_PART, ), ); @@ -72,13 +77,18 @@ private function checkSqlMode(HealthCollection $collection): void private function checkTimeZone(HealthCollection $collection): void { $timeZone = $this->connection->fetchOne('SELECT @@time_zone'); - $isInvalidTimeZone = \is_string($timeZone) && !\in_array($timeZone, self::MYSQL_TIME_ZONES, true); + + if (!\is_string($timeZone)) { + return; + } + + $isInvalidTimeZone = !\in_array($timeZone, self::MYSQL_TIME_ZONES, true); $collection->add( SettingsResult::create( - $isInvalidTimeZone ? 'warning' : 'ok', + $isInvalidTimeZone ? SettingsResult::WARNING : SettingsResult::GREEN, 'sql_time_zone', 'MySQL value time_zone', - (string) $timeZone, + $timeZone, implode(', ', self::MYSQL_TIME_ZONES), ), ); @@ -95,7 +105,7 @@ private function checkCheckDefaultEnvironmentSessionVariables(HealthCollection $ $collection->add( SettingsResult::create( - $setSessionVariables ? 'warning' : 'ok', + $setSessionVariables ? SettingsResult::WARNING : SettingsResult::GREEN, 'sql_set_default_session_variables', 'MySQL session vars are set on each connect', $setSessionVariables ? 'enabled' : 'disabled', diff --git a/src/Components/Health/Checker/PerformanceChecker/PhpSettingsChecker.php b/src/Components/Health/Checker/PerformanceChecker/PhpSettingsChecker.php index 4433ab9d..16e782de 100644 --- a/src/Components/Health/Checker/PerformanceChecker/PhpSettingsChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/PhpSettingsChecker.php @@ -24,7 +24,7 @@ private function checkAssertActive(HealthCollection $collection): void $currentValue = $this->iniGetFailover('zend.assertions'); $collection->add( SettingsResult::create( - $currentValue !== '-1' ? 'warning' : 'ok', + $currentValue !== '-1' ? SettingsResult::WARNING : SettingsResult::GREEN, 'zend.assertions', 'PHP value zend.assertions', $currentValue, @@ -39,7 +39,7 @@ private function checkEnableFileOverride(HealthCollection $collection): void $iniFailOver = !$this->isIniEnabled('opcache.enable_file_override'); $collection->add( SettingsResult::create( - $iniFailOver ? 'warning' : 'ok', + $iniFailOver ? SettingsResult::WARNING : SettingsResult::GREEN, 'php.opcache.enable_file_override', 'PHP value opcache.enable_file_override', $currentValue, @@ -54,7 +54,7 @@ private function checkInternedStringsBuffer(HealthCollection $collection): void $bufferTooSmall = (int) $currentValue < 20; $collection->add( SettingsResult::create( - $bufferTooSmall ? 'warning' : 'ok', + $bufferTooSmall ? SettingsResult::WARNING : SettingsResult::GREEN, 'php.opcache.interned_strings_buffer', 'PHP value opcache.interned_strings_buffer', $currentValue, @@ -69,7 +69,7 @@ private function checkZendDetectUnicode(HealthCollection $collection): void $iniFailOver = $this->isIniEnabled('zend.detect_unicode'); $collection->add( SettingsResult::create( - $iniFailOver ? 'warning' : 'ok', + $iniFailOver ? SettingsResult::WARNING : SettingsResult::GREEN, 'php.zend.detect_unicode', 'PHP value zend.detect_unicode', $currentValue, @@ -84,7 +84,7 @@ private function checkRealpathCacheTtl(HealthCollection $collection): void $ttlTooLow = (int) $currentValue < 3600; $collection->add( SettingsResult::create( - $ttlTooLow ? 'warning' : 'ok', + $ttlTooLow ? SettingsResult::WARNING : SettingsResult::GREEN, 'php.zend.realpath_cache_ttl', 'PHP value realpath_cache_ttl', $currentValue, diff --git a/src/Components/Health/Checker/PerformanceChecker/ProductStreamIndexingChecker.php b/src/Components/Health/Checker/PerformanceChecker/ProductStreamIndexingChecker.php index ba22c0fd..9254d86c 100644 --- a/src/Components/Health/Checker/PerformanceChecker/ProductStreamIndexingChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/ProductStreamIndexingChecker.php @@ -28,7 +28,7 @@ public function collect(HealthCollection $collection): void $collection->add( SettingsResult::create( - $this->productStreamIndexingEnabled ? 'info' : 'ok', + $this->productStreamIndexingEnabled ? SettingsResult::INFO : SettingsResult::GREEN, 'product-stream-indexing', 'Product Stream Indexing', $this->productStreamIndexingEnabled ? 'enabled' : 'disabled', diff --git a/src/Components/Health/Checker/PerformanceChecker/QueueConnectionChecker.php b/src/Components/Health/Checker/PerformanceChecker/QueueConnectionChecker.php index 040bbc02..7c7d529f 100644 --- a/src/Components/Health/Checker/PerformanceChecker/QueueConnectionChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/QueueConnectionChecker.php @@ -40,9 +40,9 @@ public function collect(HealthCollection $collection): void private function determineState(string $schema): string { return match ($schema) { - 'redis', 'rabbitmq' => 'ok', - 'doctrine', 'sync' => 'warning', - default => 'info', + 'redis', 'rabbitmq' => SettingsResult::GREEN, + 'doctrine', 'sync' => SettingsResult::WARNING, + default => SettingsResult::INFO, }; } diff --git a/src/Components/Health/Checker/PerformanceChecker/RedisTagAwareChecker.php b/src/Components/Health/Checker/PerformanceChecker/RedisTagAwareChecker.php index 47713802..0cbec3a4 100644 --- a/src/Components/Health/Checker/PerformanceChecker/RedisTagAwareChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/RedisTagAwareChecker.php @@ -29,7 +29,7 @@ public function collect(HealthCollection $collection): void $collection->add( SettingsResult::create( - $notTagAware ? 'warning' : 'ok', + $notTagAware ? SettingsResult::WARNING : SettingsResult::GREEN, 'redis-tag-aware', 'Redis adapter should be TagAware', $httpCacheType, diff --git a/src/Components/Health/SettingsResult.php b/src/Components/Health/SettingsResult.php index 2eaba144..e7396b05 100644 --- a/src/Components/Health/SettingsResult.php +++ b/src/Components/Health/SettingsResult.php @@ -72,17 +72,17 @@ public static function info(string $id, string $snippet, string $current = '', s } public static function create( - ?string $state, + string $state, string $id, string $snippet, string $current = '', string $recommended = '' ): self { return match ($state) { - 'ok' => self::ok($id, $snippet, $current, $recommended), - 'warning' => self::warning($id, $snippet, $current, $recommended), - 'error' => self::error($id, $snippet, $current, $recommended), - 'info' => self::info($id, $snippet, $current, $recommended), + self::GREEN => self::ok($id, $snippet, $current, $recommended), + self::WARNING => self::warning($id, $snippet, $current, $recommended), + self::ERROR => self::error($id, $snippet, $current, $recommended), + self::INFO => self::info($id, $snippet, $current, $recommended), default => throw new \InvalidArgumentException("Invalid state: {$state}"), }; }