diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2021-02-05 11:12:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-05 11:12:20 +0100 |
commit | 4b97ef9b41c876517b788dbae601b23f11d26096 (patch) | |
tree | 1f40b62a4a217fb827f345b07ca6a32cc9d11986 /lib/private | |
parent | c935f6a7769f7798754addac5147083aced71bf8 (diff) | |
parent | 91e1707498a6ceb3f85490acb4d85b371444bfbd (diff) | |
download | nextcloud-server-4b97ef9b41c876517b788dbae601b23f11d26096.tar.gz nextcloud-server-4b97ef9b41c876517b788dbae601b23f11d26096.zip |
Merge pull request #25487 from nextcloud/fix/generic-even-wrapper-log-once
Log deprecation notice of GenericEventWrapper just once
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/EventDispatcher/GenericEventWrapper.php | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/private/EventDispatcher/GenericEventWrapper.php b/lib/private/EventDispatcher/GenericEventWrapper.php index 916297f4998..1935c675812 100644 --- a/lib/private/EventDispatcher/GenericEventWrapper.php +++ b/lib/private/EventDispatcher/GenericEventWrapper.php @@ -41,6 +41,9 @@ class GenericEventWrapper extends GenericEvent { /** @var string */ private $eventName; + /** @var bool */ + private $deprecationNoticeLogged = false; + public function __construct(ILogger $logger, string $eventName, ?GenericEvent $event) { parent::__construct($eventName); $this->logger = $logger; @@ -49,11 +52,16 @@ class GenericEventWrapper extends GenericEvent { } private function log() { + if ($this->deprecationNoticeLogged) { + return; + } + $class = ($this->event !== null && is_object($this->event)) ? get_class($this->event) : 'null'; $this->logger->info( 'Deprecated event type for {name}: {class} is used', [ 'name' => $this->eventName, 'class' => $class] ); + $this->deprecationNoticeLogged = true; } public function isPropagationStopped(): bool { |