summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2021-02-05 08:45:58 +0100
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2021-02-05 10:14:48 +0000
commita35bebd7d4e64c70924ded052466fe42e79a6545 (patch)
tree90a06ebfa875e0f9e90fb0c215909e4fddf5592e /lib/private
parentba63f588e7912a9953650a9231b1729f9c3cce49 (diff)
downloadnextcloud-server-a35bebd7d4e64c70924ded052466fe42e79a6545.tar.gz
nextcloud-server-a35bebd7d4e64c70924ded052466fe42e79a6545.zip
Log deprecation notice of GenericEventWrapper just once
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/EventDispatcher/GenericEventWrapper.php8
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 {