Skip to content
Snippets Groups Projects
Unverified Commit be4db2d4 authored by Roeland Jago Douma's avatar Roeland Jago Douma Committed by GitHub
Browse files

Merge pull request #25496 from nextcloud/backport/25487/stable21

[stable21] Log deprecation notice of GenericEventWrapper just once
parents f24ce397 a35bebd7
No related branches found
No related tags found
No related merge requests found
...@@ -41,6 +41,9 @@ class GenericEventWrapper extends GenericEvent { ...@@ -41,6 +41,9 @@ class GenericEventWrapper extends GenericEvent {
/** @var string */ /** @var string */
private $eventName; private $eventName;
/** @var bool */
private $deprecationNoticeLogged = false;
public function __construct(ILogger $logger, string $eventName, ?GenericEvent $event) { public function __construct(ILogger $logger, string $eventName, ?GenericEvent $event) {
parent::__construct($eventName); parent::__construct($eventName);
$this->logger = $logger; $this->logger = $logger;
...@@ -49,11 +52,16 @@ class GenericEventWrapper extends GenericEvent { ...@@ -49,11 +52,16 @@ class GenericEventWrapper extends GenericEvent {
} }
private function log() { private function log() {
if ($this->deprecationNoticeLogged) {
return;
}
$class = ($this->event !== null && is_object($this->event)) ? get_class($this->event) : 'null'; $class = ($this->event !== null && is_object($this->event)) ? get_class($this->event) : 'null';
$this->logger->info( $this->logger->info(
'Deprecated event type for {name}: {class} is used', 'Deprecated event type for {name}: {class} is used',
[ 'name' => $this->eventName, 'class' => $class] [ 'name' => $this->eventName, 'class' => $class]
); );
$this->deprecationNoticeLogged = true;
} }
public function isPropagationStopped(): bool { public function isPropagationStopped(): bool {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment