Merge pull request #22476 from nextcloud/setting-sections-unique

ignore duplicate setting sections
This commit is contained in:
Roeland Jago Douma 2020-08-30 21:15:50 +02:00 committed by GitHub
commit c43189beae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -106,7 +106,7 @@ class Manager implements IManager {
return $this->sections[$type]; return $this->sections[$type];
} }
foreach ($this->sectionClasses[$type] as $index => $class) { foreach (array_unique($this->sectionClasses[$type]) as $index => $class) {
try { try {
/** @var ISection $section */ /** @var ISection $section */
$section = \OC::$server->query($class); $section = \OC::$server->query($class);
@ -123,7 +123,7 @@ class Manager implements IManager {
$sectionID = $section->getID(); $sectionID = $section->getID();
if (isset($this->sections[$type][$sectionID])) { 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; continue;
} }