From 28fd18de43ee4371c614782a2a4b9cf0eb497faa Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Fri, 19 May 2017 17:34:57 +0200 Subject: add missing pieces to Settings Manager and fix and extend its unit tests Signed-off-by: Arthur Schiwon --- lib/private/Settings/Manager.php | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'lib/private/Settings/Manager.php') diff --git a/lib/private/Settings/Manager.php b/lib/private/Settings/Manager.php index 62a74b706f6..7da8bfe65df 100644 --- a/lib/private/Settings/Manager.php +++ b/lib/private/Settings/Manager.php @@ -464,6 +464,22 @@ class Manager implements IManager { 15 => [new Section('sync-clients', $this->l->t('Sync clients'), 0, $this->url->imagePath('settings', 'change.svg'))], 98 => [new Section('additional', $this->l->t('Additional settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))], ]; + + $rows = $this->mapper->getPersonalSectionsFromDB(); + + foreach ($rows as $row) { + if (!isset($sections[$row['priority']])) { + $sections[$row['priority']] = []; + } + try { + $sections[$row['priority']][] = $this->query($row['class']); + } catch (QueryException $e) { + // skip + } + } + + ksort($sections); + return $sections; } @@ -472,6 +488,20 @@ class Manager implements IManager { */ public function getPersonalSettings($section) { $settings = $this->getBuiltInPersonalSettings($section); + $dbRows = $this->mapper->getPersonalSettingsFromDB($section); + + foreach ($dbRows as $row) { + if (!isset($settings[$row['priority']])) { + $settings[$row['priority']] = []; + } + try { + $settings[$row['priority']][] = $this->query($row['class']); + } catch (QueryException $e) { + // skip + } + } + + ksort($settings); return $settings; } } -- cgit v1.2.3