diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2021-10-05 15:09:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-05 15:09:45 +0200 |
commit | b28f4989ffac9d86136da319ac71594520cb2af9 (patch) | |
tree | dd88b4949b94a05b222d9d32a7a8cd8997a47f47 | |
parent | d68f0282515cb5122cdbd834217b62079dcad9bc (diff) | |
parent | 04b368f2bd6611dfbf1aa72d7e543a1ff86d922e (diff) | |
download | nextcloud-server-b28f4989ffac9d86136da319ac71594520cb2af9.tar.gz nextcloud-server-b28f4989ffac9d86136da319ac71594520cb2af9.zip |
Merge pull request #29019 from nextcloud/bugfix/noid/improve-log-and-allow-duplicate-notifications-section
Improve log and allow duplicate notifications section
-rw-r--r-- | lib/private/Settings/Manager.php | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/private/Settings/Manager.php b/lib/private/Settings/Manager.php index 6c567204253..ebda3fe021d 100644 --- a/lib/private/Settings/Manager.php +++ b/lib/private/Settings/Manager.php @@ -131,8 +131,9 @@ class Manager implements IManager { $sectionID = $section->getID(); - if ($sectionID !== 'connected-accounts' && isset($this->sections[$type][$sectionID])) { - $this->log->info('', ['exception' => new \InvalidArgumentException('Section with the same ID already registered: ' . $sectionID . ', class: ' . $class)]); + if (!$this->isKnownDuplicateSectionId($sectionID) && isset($this->sections[$type][$sectionID])) { + $e = new \InvalidArgumentException('Section with the same ID already registered: ' . $sectionID . ', class: ' . $class); + $this->log->info($e->getMessage(), ['exception' => $e]); continue; } @@ -144,6 +145,13 @@ class Manager implements IManager { return $this->sections[$type]; } + protected function isKnownDuplicateSectionId(string $sectionID): bool { + return in_array($sectionID, [ + 'connected-accounts', + 'notifications', + ], true); + } + /** @var array */ protected $settingClasses = []; @@ -190,7 +198,8 @@ class Manager implements IManager { } if (!$setting instanceof ISettings) { - $this->log->info('', ['exception' => new \InvalidArgumentException('Invalid settings setting registered (' . $class . ')')]); + $e = new \InvalidArgumentException('Invalid settings setting registered (' . $class . ')'); + $this->log->info($e->getMessage(), ['exception' => $e]); continue; } |