diff --git a/CHANGELOG.md b/CHANGELOG.md index 29253af..2032f6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGELOG +## 2.5.13 + +* Fix database error when cache is being cleared before installation of plugin. + ## 2.5.12 * Fix strpos() type error. diff --git a/Plugin.php b/Plugin.php index e8f327d..91fb6e5 100644 --- a/Plugin.php +++ b/Plugin.php @@ -365,9 +365,13 @@ private function registerEventListeners(): void * When one or more redirects have been changed. */ Event::listen('vdlp.redirect.changed', static function (array $redirectIds): void { - /** @var PublishManagerInterface $publishManager */ - $publishManager = resolve(PublishManagerInterface::class); - $publishManager->publish(); + try { + /** @var PublishManagerInterface $publishManager */ + $publishManager = resolve(PublishManagerInterface::class); + $publishManager->publish(); + } catch (Throwable $throwable) { + // @ignoreException + } }); /* @@ -376,9 +380,13 @@ private function registerEventListeners(): void * Re-publish all redirect if cache has been cleared. */ Event::listen('cache:cleared', static function (): void { - /** @var PublishManagerInterface $publishManager */ - $publishManager = resolve(PublishManagerInterface::class); - $publishManager->publish(); + try { + /** @var PublishManagerInterface $publishManager */ + $publishManager = resolve(PublishManagerInterface::class); + $publishManager->publish(); + } catch (Throwable $throwable) { + // @ignoreException + } }); } } diff --git a/updates/version.yaml b/updates/version.yaml index daea95e..f27f200 100644 --- a/updates/version.yaml +++ b/updates/version.yaml @@ -95,3 +95,5 @@ - "Minor fixes -- See: https://github.com/vdlp/oc-redirect-plugin/releases/tag/2.5.11" 2.5.12: - "Fix strpos() type error" +2.5.13: + - "Fix database error when cache is being cleared before installation of plugin."