From 8abb5276cc4640259a0dae5674d38a2093174ab4 Mon Sep 17 00:00:00 2001 From: peterjaap Date: Thu, 13 Feb 2025 14:17:16 +0100 Subject: [PATCH] Removed our checks from our extension since they were merged into the Vendic one..... --- Checks/RabbitmqConnection.php | 89 ----------------------------------- Checks/SentryConnection.php | 54 --------------------- composer.json | 2 +- etc/di.xml | 12 ----- 4 files changed, 1 insertion(+), 156 deletions(-) delete mode 100644 Checks/RabbitmqConnection.php delete mode 100644 Checks/SentryConnection.php delete mode 100644 etc/di.xml diff --git a/Checks/RabbitmqConnection.php b/Checks/RabbitmqConnection.php deleted file mode 100644 index 3e93ee6..0000000 --- a/Checks/RabbitmqConnection.php +++ /dev/null @@ -1,89 +0,0 @@ -deploymentConfig; - $options = []; - /** @var CheckResultInterface $checkResult */ - - $checkResult = $this->checkResultFactory->create(); - $checkResult->setName('rabbitmq_connection'); - $checkResult->setLabel('Rabbitmq Connection'); - $checkResult->setMeta($deploymentConfig->get('queue') ?? []); - - if ($this->checkIsRabbitmqConfigured($deploymentConfig) === CheckStatus::STATUS_OK) { - $checkResult->setStatus(CheckStatus::STATUS_OK); - $checkResult->setShortSummary('Rabbitmq is correctly configured'); - $checkResult->setNotificationMessage('Rabbitmq is correctly configured'); - } else { - $checkResult->setStatus(CheckStatus::STATUS_FAILED); - $checkResult->setShortSummary('Rabbitmq is not configured (correctly)'); - $checkResult->setNotificationMessage('Rabbitmq is not configured (correctly): ' . $this->error); - } - - return $checkResult; - } - - private function checkIsRabbitmqConfigured(DeploymentConfig $deploymentConfig): CheckStatus - { - $host = $deploymentConfig->get('queue/amqp/host'); - $port = $deploymentConfig->get('queue/amqp/port'); - $user = $deploymentConfig->get('queue/amqp/user'); - $password = $deploymentConfig->get('queue/amqp/password'); - $vhost = $deploymentConfig->get('queue/amqp/virtualhost'); - $connectionTimeout = 0.01337; - - if ( - $deploymentConfig->get('queue') - && !empty($deploymentConfig->get('queue/amqp')) - && $host - && $port - && $user - && $password - ) { - try { - $connection = new AMQPStreamConnection( - host: $host, - port: $port, - user: $user, - password: $password, - vhost: $vhost, - connection_timeout: $connectionTimeout - ); - if ($connection->isConnected()) { - return CheckStatus::STATUS_OK; - } else { - $this->error = 'Error unknown'; - return CheckStatus::STATUS_FAILED; - } - } catch (\Exception $e) { - if (str_contains($e->getMessage(), 'after ' . $connectionTimeout . ' sec')) { - return CheckStatus::STATUS_OK; - } - $this->error = $e->getMessage(); - return CheckStatus::STATUS_FAILED; - } - } - - return CheckStatus::STATUS_FAILED; - } -} diff --git a/Checks/SentryConnection.php b/Checks/SentryConnection.php deleted file mode 100644 index 8864e72..0000000 --- a/Checks/SentryConnection.php +++ /dev/null @@ -1,54 +0,0 @@ -deploymentConfig; - $options = []; - /** @var CheckResultInterface $checkResult */ - - $checkResult = $this->checkResultFactory->create(); - $checkResult->setName('sentry_connection'); - $checkResult->setLabel('Sentry connection'); - $checkResult->setMeta($deploymentConfig->get('sentry') ?? []); - - if ($this->checkisSentryConfigured($deploymentConfig) === false) { - $checkResult->setStatus(CheckStatus::STATUS_FAILED); - $checkResult->setShortSummary('Sentry not configured'); - $checkResult->setNotificationMessage('Sentry is not configured'); - } else { - $checkResult->setStatus(CheckStatus::STATUS_OK); - $checkResult->setShortSummary('Sentry is configured'); - $checkResult->setNotificationMessage('Sentry is configured'); - } - - return $checkResult; - } - - private function checkisSentryConfigured(DeploymentConfig $deploymentConfig): bool - { - if ( - !empty($deploymentConfig->get('sentry/dsn')) && - !empty($deploymentConfig->get('sentry/environment')) - ) { - return true; - } - - return false; - } -} diff --git a/composer.json b/composer.json index 09904e9..7ac5b34 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "type": "magento2-module", "license": "MIT", "require": { - "vendic/magento2-oh-dear-checks": "^1.0" + "vendic/magento2-oh-dear-checks": "^1.5" }, "autoload": { "files": [ diff --git a/etc/di.xml b/etc/di.xml deleted file mode 100644 index c61d6ef..0000000 --- a/etc/di.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - Elgentos\OhDearChecks\Checks\SentryConnection - Elgentos\OhDearChecks\Checks\RabbitmqConnection - - - -