From dc6afc99b4504b033785180edda0a30ffcc3c552 Mon Sep 17 00:00:00 2001 From: jekuaitk Date: Mon, 16 Dec 2024 10:37:00 +0100 Subject: [PATCH 1/3] Fixed missing queue error --- CHANGELOG.md | 7 ++++++- src/Service/Logger.php | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 812872a..e4b28fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.1.6] - 2024-12-16 + +- Fixed missing queue error during installation. + ## [0.1.5] - 2024-12-16 - Added module dependency. @@ -48,7 +52,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - First version of the module - Added submodule to log user CUD events. -[Unreleased]: https://github.com/OS2web/os2web_audit/compare/0.1.5...HEAD +[Unreleased]: https://github.com/OS2web/os2web_audit/compare/0.1.6...HEAD +[0.1.6]: https://github.com/OS2web/os2web_audit/compare/0.1.5...0.1.6 [0.1.5]: https://github.com/OS2web/os2web_audit/compare/0.1.4...0.1.5 [0.1.4]: https://github.com/OS2web/os2web_audit/compare/0.1.3...0.1.4 [0.1.3]: https://github.com/OS2web/os2web_audit/compare/0.1.2...0.1.3 diff --git a/src/Service/Logger.php b/src/Service/Logger.php index 1882573..d063b7d 100644 --- a/src/Service/Logger.php +++ b/src/Service/Logger.php @@ -113,6 +113,10 @@ private function createLoggingJob(string $type, int $timestamp, string $line, bo /** @var \Drupal\advancedqueue\Entity\Queue $queue */ $queue = $queueStorage->load(self::OS2WEB_AUDIT_QUEUE_ID); + if (NULL === $queue) { + throw new \Exception(sprintf('Queue (%s) not found.', self::OS2WEB_AUDIT_QUEUE_ID)); + } + $job = Job::create(LogMessages::class, $payload); $queue->enqueueJob($job); From 70d5eaa64b4f21c647d6edc0392472d675ea12ec Mon Sep 17 00:00:00 2001 From: jekuaitk Date: Mon, 16 Dec 2024 10:40:37 +0100 Subject: [PATCH 2/3] Applied coding standards --- src/Service/Logger.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Service/Logger.php b/src/Service/Logger.php index d063b7d..f0794a5 100644 --- a/src/Service/Logger.php +++ b/src/Service/Logger.php @@ -113,8 +113,8 @@ private function createLoggingJob(string $type, int $timestamp, string $line, bo /** @var \Drupal\advancedqueue\Entity\Queue $queue */ $queue = $queueStorage->load(self::OS2WEB_AUDIT_QUEUE_ID); - if (NULL === $queue) { - throw new \Exception(sprintf('Queue (%s) not found.', self::OS2WEB_AUDIT_QUEUE_ID)); + if (is_null($queue)) { + throw new \Exception(sprintf('Queue (%s) not found.', self::OS2WEB_AUDIT_QUEUE_ID)); } $job = Job::create(LogMessages::class, $payload); From 1592f1516288487384b54332143b4cf62acc5601 Mon Sep 17 00:00:00 2001 From: jekuaitk Date: Mon, 16 Dec 2024 10:44:03 +0100 Subject: [PATCH 3/3] Fixed variable docs --- src/Service/Logger.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Service/Logger.php b/src/Service/Logger.php index f0794a5..0d2e963 100644 --- a/src/Service/Logger.php +++ b/src/Service/Logger.php @@ -110,10 +110,10 @@ private function createLoggingJob(string $type, int $timestamp, string $line, bo try { $queueStorage = $this->entityTypeManager->getStorage('advancedqueue_queue'); - /** @var \Drupal\advancedqueue\Entity\Queue $queue */ + /** @var \Drupal\advancedqueue\Entity\Queue|null $queue */ $queue = $queueStorage->load(self::OS2WEB_AUDIT_QUEUE_ID); - if (is_null($queue)) { + if (NULL === $queue) { throw new \Exception(sprintf('Queue (%s) not found.', self::OS2WEB_AUDIT_QUEUE_ID)); }