Skip to content
Open
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,14 @@ public function __construct(

public function collect(HealthCollection $collection): void
{
if ($this->adminWorkerEnabled) {
$collection->add(
SettingsResult::warning(
'admin-watcher',
'Admin-Worker',
'enabled',
'disabled',
),
);
}
$collection->add(
SettingsResult::create(
$this->adminWorkerEnabled ? SettingsResult::WARNING : SettingsResult::GREEN,
'admin-watcher',
'Admin-Worker',
$this->adminWorkerEnabled ? 'enabled' : 'disabled',
'disabled',
),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@ 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',
),
);
}
$collection->add(
SettingsResult::create(
!$appUrlCheckDisabled ? SettingsResult::WARNING : SettingsResult::GREEN,
'app-url-check-disabled',
'App URL external check',
!$appUrlCheckDisabled ? 'enabled' : 'disabled',
'disabled',
)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,14 @@ public function __construct(

public function collect(HealthCollection $collection): void
{
if ($this->vault) {
$collection->add(
SettingsResult::info(
'symfony-secrets',
'Disable Symfony Secrets',
'enabled',
'disabled',
),
);
}
$collection->add(
SettingsResult::create(
$this->vault ? SettingsResult::INFO : SettingsResult::GREEN,
'symfony-secrets',
'Disable Symfony Secrets',
$this->vault ? 'enabled' : 'disabled',
'disabled',
),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ public function collect(HealthCollection $collection): void

$setting = $this->params->get('shopware.mail.update_mail_variables_on_send');

if (!$setting) {
return;
}

$result = SettingsResult::warning('mail_variables', 'MailVariables updates', 'enabled', 'disabled');

$collection->add($result);
$collection->add(
SettingsResult::create(
!$setting ? SettingsResult::GREEN : SettingsResult::WARNING,
'mail_variables',
'MailVariables updates',
$setting ? 'enabled' : 'disabled',
'disabled'
)
);
}
}
19 changes: 9 additions & 10 deletions src/Components/Health/Checker/PerformanceChecker/EsChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,14 @@ public function __construct(ElasticsearchManager $elasticsearchManager)

public function collect(HealthCollection $collection): void
{
if (!$this->esEnabled) {
$collection->add(
SettingsResult::info(
'elasticsearch',
'Elasticsearch',
'disabled',
'enabled',
),
);
}
$collection->add(
SettingsResult::create(
!$this->esEnabled ? SettingsResult::INFO : SettingsResult::GREEN,
'elasticsearch',
'Elasticsearch',
!$this->esEnabled ? 'disabled' : 'enabled',
'enabled',
)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ public function collect(HealthCollection $collection): void
if (\version_compare($this->shopwareVersion, '6.7.0.0', '>=')) {
return;
}
$fineGrainedCachingEnabled = $this->cacheTaggingEachConfig || $this->cacheTaggingEachSnippet || $this->cacheTaggingEachThemeConfig;

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',
),
);
}
$collection->add(
// only info, because it only affects redis, varnish etc.
SettingsResult::create(
$fineGrainedCachingEnabled ? SettingsResult::INFO : SettingsResult::GREEN,
'fine-grained-caching',
'Fine-grained caching on Redis, Varnish etc.',
$fineGrainedCachingEnabled ? 'enabled' : 'disabled',
'disabled',
),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,14 @@ 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',
),
);
}
$collection->add(
SettingsResult::create(
$cacheId === '' ? SettingsResult::WARNING : SettingsResult::GREEN,
'cache-id',
'Fixed cache id',
$cacheId === '' ? 'not set' : 'set',
'set',
),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,19 @@ 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;

if ($this->userActivity === 'mysql' || $this->queueActivity === 'mysql') {
$collection->add(
SettingsResult::warning(
'increment-storage',
'Increment storage',
'mysql',
$recommended,
),
);
}
$collection->add(
SettingsResult::create(
$usesMysql ? SettingsResult::WARNING : SettingsResult::GREEN,
'increment-storage',
'Increment storage',
$current,
'array or redis',
),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@ 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) ? SettingsResult::WARNING : SettingsResult::GREEN,
'business_logger',
'BusinessEventHandler logging',
Logger::toMonologLevel($this->businessEventHandlerLevel)->getName(),
'min WARNING',
));
}
),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,14 @@ public function __construct(

public function collect(HealthCollection $collection): void
{
if (!$this->mailerIsOverQueue) {
$collection->add(
SettingsResult::warning(
'mail',
'Sending mails over queue',
'disabled',
'enabled',
),
);
}
$collection->add(
SettingsResult::create(
!$this->mailerIsOverQueue ? SettingsResult::WARNING : SettingsResult::GREEN,
'mail',
'Sending mails over queue',
$this->mailerIsOverQueue ? 'enabled' : 'disabled',
'enabled',
),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,17 @@ 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',
),
);
}
$autoSetupState = $this->isAutoSetupEnabled($this->messageTransportDsn) || $this->isAutoSetupEnabled($this->messageTransportDsnLowPriority) || $this->isAutoSetupEnabled($this->messageTransportDsnFailure);

$collection->add(
SettingsResult::create(
$autoSetupState ? SettingsResult::INFO : SettingsResult::GREEN,
'messenger-auto-setup',
'Messenger auto_setup',
$autoSetupState ? 'enabled' : 'disabled',
'disabled',
),
);
}

private function isAutoSetupEnabled(string $messageTransportDsn): bool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,46 +41,57 @@ 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,
),
);
}
$maxLenNotOk = (int) $groupConcatMaxLen < self::MYSQL_GROUP_CONCAT_MAX_LEN;

$collection->add(
SettingsResult::create(
$maxLenNotOk ? SettingsResult::ERROR : SettingsResult::GREEN,
'sql_group_concat_max_len',
'MySQL value group_concat_max_len',
(string) $groupConcatMaxLen,
'min ' . self::MYSQL_GROUP_CONCAT_MAX_LEN,
),
);
}

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,
),
);

if (!\is_string($sqlMode)) {
return;
}

$hasForbiddenMode = \str_contains($sqlMode, self::MYSQL_SQL_MODE_PART);
$collection->add(
SettingsResult::create(
$hasForbiddenMode ? SettingsResult::ERROR : SettingsResult::GREEN,
'sql_mode',
'MySQL value sql_mode',
$sqlMode,
'No ' . self::MYSQL_SQL_MODE_PART,
),
);
}

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),
),
);

if (!\is_string($timeZone)) {
return;
}

$isInvalidTimeZone = !\in_array($timeZone, self::MYSQL_TIME_ZONES, true);
$collection->add(
SettingsResult::create(
$isInvalidTimeZone ? SettingsResult::WARNING : SettingsResult::GREEN,
'sql_time_zone',
'MySQL value time_zone',
$timeZone,
implode(', ', self::MYSQL_TIME_ZONES),
),
);
}

private function checkCheckDefaultEnvironmentSessionVariables(HealthCollection $collection): void
Expand All @@ -91,15 +102,15 @@ 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',
),
);
}

$collection->add(
SettingsResult::create(
$setSessionVariables ? SettingsResult::WARNING : SettingsResult::GREEN,
'sql_set_default_session_variables',
'MySQL session vars are set on each connect',
$setSessionVariables ? 'enabled' : 'disabled',
'disabled',
),
);
}
}
Loading
Loading