ignore duplicate setting sections

this prevents some 'Section with the same ID already registered' errors in the log

also includes an improvement of the error message to make other cases easier to find

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2020-08-28 17:06:48 +02:00
parent aad30d3b33
commit eb4154cee0
No known key found for this signature in database
GPG Key ID: 42B69D8A64526EFB
1 changed files with 2 additions and 2 deletions

View File

@ -106,7 +106,7 @@ class Manager implements IManager {
return $this->sections[$type];
}
foreach ($this->sectionClasses[$type] as $index => $class) {
foreach (array_unique($this->sectionClasses[$type]) as $index => $class) {
try {
/** @var ISection $section */
$section = \OC::$server->query($class);
@ -123,7 +123,7 @@ class Manager implements IManager {
$sectionID = $section->getID();
if (isset($this->sections[$type][$sectionID])) {
$this->log->logException(new \InvalidArgumentException('Section with the same ID already registered'), ['level' => ILogger::INFO]);
$this->log->logException(new \InvalidArgumentException('Section with the same ID already registered: ' . $sectionID . ', class: ' . $class), ['level' => ILogger::INFO]);
continue;
}