]> source.dussan.org Git - nextcloud-server.git/commitdiff
ignore duplicate setting sections 22476/head
authorRobin Appelman <robin@icewind.nl>
Fri, 28 Aug 2020 15:06:48 +0000 (17:06 +0200)
committerRobin Appelman <robin@icewind.nl>
Fri, 28 Aug 2020 15:06:48 +0000 (17:06 +0200)
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>
lib/private/Settings/Manager.php

index ac4f8f9342c9ab602c17410f681a2a93c5ce028f..b775e364c390ffac8d38f9a5f5498b74aa3a951b 100644 (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;
                        }