Completed
Pull Request — master (#9585)
by Julius
51:29 queued 28:39
created
lib/private/Settings/Manager.php 1 patch
Indentation   +355 added lines, -355 removed lines patch added patch discarded remove patch
@@ -49,359 +49,359 @@
 block discarded – undo
49 49
 use OCP\Util;
50 50
 
51 51
 class Manager implements IManager {
52
-	/** @var ILogger */
53
-	private $log;
54
-	/** @var IDBConnection */
55
-	private $dbc;
56
-	/** @var IL10N */
57
-	private $l;
58
-	/** @var IConfig */
59
-	private $config;
60
-	/** @var EncryptionManager */
61
-	private $encryptionManager;
62
-	/** @var IUserManager */
63
-	private $userManager;
64
-	/** @var ILockingProvider */
65
-	private $lockingProvider;
66
-	/** @var IRequest */
67
-	private $request;
68
-	/** @var IURLGenerator */
69
-	private $url;
70
-	/** @var AccountManager */
71
-	private $accountManager;
72
-	/** @var IGroupManager */
73
-	private $groupManager;
74
-	/** @var IFactory */
75
-	private $l10nFactory;
76
-	/** @var IAppManager */
77
-	private $appManager;
78
-
79
-	/**
80
-	 * @param ILogger $log
81
-	 * @param IDBConnection $dbc
82
-	 * @param IL10N $l
83
-	 * @param IConfig $config
84
-	 * @param EncryptionManager $encryptionManager
85
-	 * @param IUserManager $userManager
86
-	 * @param ILockingProvider $lockingProvider
87
-	 * @param IRequest $request
88
-	 * @param IURLGenerator $url
89
-	 * @param AccountManager $accountManager
90
-	 * @param IGroupManager $groupManager
91
-	 * @param IFactory $l10nFactory
92
-	 * @param IAppManager $appManager
93
-	 */
94
-	public function __construct(
95
-		ILogger $log,
96
-		IDBConnection $dbc,
97
-		IL10N $l,
98
-		IConfig $config,
99
-		EncryptionManager $encryptionManager,
100
-		IUserManager $userManager,
101
-		ILockingProvider $lockingProvider,
102
-		IRequest $request,
103
-		IURLGenerator $url,
104
-		AccountManager $accountManager,
105
-		IGroupManager $groupManager,
106
-		IFactory $l10nFactory,
107
-		IAppManager $appManager
108
-	) {
109
-		$this->log = $log;
110
-		$this->dbc = $dbc;
111
-		$this->l = $l;
112
-		$this->config = $config;
113
-		$this->encryptionManager = $encryptionManager;
114
-		$this->userManager = $userManager;
115
-		$this->lockingProvider = $lockingProvider;
116
-		$this->request = $request;
117
-		$this->url = $url;
118
-		$this->accountManager = $accountManager;
119
-		$this->groupManager = $groupManager;
120
-		$this->l10nFactory = $l10nFactory;
121
-		$this->appManager = $appManager;
122
-	}
123
-
124
-	/** @var array */
125
-	protected $sectionClasses = [];
126
-
127
-	/** @var array */
128
-	protected $sections = [];
129
-
130
-	/**
131
-	 * @param string $type 'admin' or 'personal'
132
-	 * @param string $section Class must implement OCP\Settings\ISection
133
-	 * @return void
134
-	 */
135
-	public function registerSection(string $type, string $section) {
136
-		$this->sectionClasses[$section] = $type;
137
-	}
138
-
139
-	/**
140
-	 * @param string $type 'admin' or 'personal'
141
-	 * @return ISection[]
142
-	 */
143
-	protected function getSections(string $type): array {
144
-		if (!isset($this->sections[$type])) {
145
-			$this->sections[$type] = [];
146
-		}
147
-
148
-		foreach ($this->sectionClasses as $class => $sectionType) {
149
-			try {
150
-				/** @var ISection $section */
151
-				$section = \OC::$server->query($class);
152
-			} catch (QueryException $e) {
153
-				$this->log->logException($e, ['level' => ILogger::INFO]);
154
-				continue;
155
-			}
156
-
157
-			if (!$section instanceof ISection) {
158
-				$this->log->logException(new \InvalidArgumentException('Invalid settings section registered'), ['level' => ILogger::INFO]);
159
-				continue;
160
-			}
161
-
162
-			$this->sections[$sectionType][$section->getID()] = $section;
163
-
164
-			unset($this->sectionClasses[$class]);
165
-		}
166
-
167
-		return $this->sections[$type];
168
-	}
169
-
170
-	/** @var array */
171
-	protected $settingClasses = [];
172
-
173
-	/** @var array */
174
-	protected $settings = [];
175
-
176
-	/**
177
-	 * @param string $type 'admin' or 'personal'
178
-	 * @param string $setting Class must implement OCP\Settings\ISetting
179
-	 * @return void
180
-	 */
181
-	public function registerSetting(string $type, string $setting) {
182
-		$this->settingClasses[$setting] = $type;
183
-	}
184
-
185
-	/**
186
-	 * @param string $type 'admin' or 'personal'
187
-	 * @param string $section
188
-	 * @return ISettings[]
189
-	 */
190
-	protected function getSettings(string $type, string $section): array {
191
-		if (!isset($this->settings[$type])) {
192
-			$this->settings[$type] = [];
193
-		}
194
-		if (!isset($this->settings[$type][$section])) {
195
-			$this->settings[$type][$section] = [];
196
-		}
197
-
198
-		foreach ($this->settingClasses as $class => $settingsType) {
199
-			try {
200
-				/** @var ISettings $setting */
201
-				$setting = \OC::$server->query($class);
202
-			} catch (QueryException $e) {
203
-				$this->log->logException($e, ['level' => ILogger::INFO]);
204
-				continue;
205
-			}
206
-
207
-			if (!$setting instanceof ISettings) {
208
-				$this->log->logException(new \InvalidArgumentException('Invalid settings setting registered'), ['level' => ILogger::INFO]);
209
-				continue;
210
-			}
211
-
212
-			if (!isset($this->settings[$settingsType][$setting->getSection()])) {
213
-				$this->settings[$settingsType][$setting->getSection()] = [];
214
-			}
215
-			$this->settings[$settingsType][$setting->getSection()][] = $setting;
216
-
217
-			unset($this->settingClasses[$class]);
218
-		}
219
-
220
-		return $this->settings[$type][$section];
221
-	}
222
-
223
-	/**
224
-	 * @inheritdoc
225
-	 */
226
-	public function getAdminSections(): array {
227
-		// built-in sections
228
-		$sections = [
229
-			0 => [new Section('overview', $this->l->t('Overview'), 0, $this->url->imagePath('settings', 'admin.svg'))],
230
-			1 => [new Section('server', $this->l->t('Basic settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))],
231
-			5 => [new Section('sharing', $this->l->t('Sharing'), 0, $this->url->imagePath('core', 'actions/share.svg'))],
232
-			10 => [new Section('security', $this->l->t('Security'), 0, $this->url->imagePath('core', 'actions/password.svg'))],
233
-			45 => [new Section('encryption', $this->l->t('Encryption'), 0, $this->url->imagePath('core', 'actions/password.svg'))],
234
-			98 => [new Section('additional', $this->l->t('Additional settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))],
235
-			99 => [new Section('tips-tricks', $this->l->t('Tips & tricks'), 0, $this->url->imagePath('settings', 'help.svg'))],
236
-		];
237
-
238
-		$appSections = $this->getSections('admin');
239
-
240
-		foreach ($appSections as $section) {
241
-			/** @var ISection $section */
242
-			if (!isset($sections[$section->getPriority()])) {
243
-				$sections[$section->getPriority()] = [];
244
-			}
245
-
246
-			$sections[$section->getPriority()][] = $section;
247
-		}
248
-
249
-		ksort($sections);
250
-
251
-		return $sections;
252
-	}
253
-
254
-	/**
255
-	 * @param string $section
256
-	 * @return ISection[]
257
-	 */
258
-	private function getBuiltInAdminSettings($section): array {
259
-		$forms = [];
260
-
261
-		if ($section === 'overview') {
262
-			/** @var ISettings $form */
263
-			$form = new Admin\Overview($this->dbc, $this->request, $this->config, $this->lockingProvider, $this->l);
264
-			$forms[$form->getPriority()] = [$form];
265
-			$form = new Admin\ServerDevNotice();
266
-			$forms[$form->getPriority()] = [$form];
267
-		}
268
-		if ($section === 'server') {
269
-			/** @var ISettings $form */
270
-			$form = new Admin\Server($this->dbc, $this->request, $this->config, $this->lockingProvider, $this->l);
271
-			$forms[$form->getPriority()] = [$form];
272
-			$form = new Admin\Mail($this->config);
273
-			$forms[$form->getPriority()] = [$form];
274
-		}
275
-		if ($section === 'encryption') {
276
-			/** @var ISettings $form */
277
-			$form = new Admin\Encryption($this->encryptionManager, $this->userManager);
278
-			$forms[$form->getPriority()] = [$form];
279
-		}
280
-		if ($section === 'sharing') {
281
-			/** @var ISettings $form */
282
-			$form = new Admin\Sharing($this->config, $this->l);
283
-			$forms[$form->getPriority()] = [$form];
284
-		}
285
-		if ($section === 'tips-tricks') {
286
-			/** @var ISettings $form */
287
-			$form = new Admin\TipsTricks($this->config);
288
-			$forms[$form->getPriority()] = [$form];
289
-		}
290
-
291
-		return $forms;
292
-	}
293
-
294
-	/**
295
-	 * @param string $section
296
-	 * @return ISection[]
297
-	 */
298
-	private function getBuiltInPersonalSettings($section): array {
299
-		$forms = [];
300
-
301
-		if ($section === 'personal-info') {
302
-			/** @var ISettings $form */
303
-			$form = new Personal\PersonalInfo(
304
-				$this->config,
305
-				$this->userManager,
306
-				$this->groupManager,
307
-				$this->accountManager,
308
-				$this->appManager,
309
-				$this->l10nFactory,
310
-				$this->l
311
-			);
312
-			$forms[$form->getPriority()] = [$form];
313
-		}
314
-		if($section === 'security') {
315
-			/** @var ISettings $form */
316
-			$form = new Personal\Security();
317
-			$forms[$form->getPriority()] = [$form];
318
-		}
319
-		if ($section === 'additional') {
320
-			/** @var ISettings $form */
321
-			$form = new Personal\Additional();
322
-			$forms[$form->getPriority()] = [$form];
323
-		}
324
-
325
-		return $forms;
326
-	}
327
-
328
-	/**
329
-	 * @inheritdoc
330
-	 */
331
-	public function getAdminSettings($section): array {
332
-		$settings = $this->getBuiltInAdminSettings($section);
333
-		$appSettings = $this->getSettings('admin', $section);
334
-
335
-		foreach ($appSettings as $setting) {
336
-			if (!isset($settings[$setting->getPriority()])) {
337
-				$settings[$setting->getPriority()] = [];
338
-			}
339
-			$settings[$setting->getPriority()][] = $setting;
340
-		}
341
-
342
-		ksort($settings);
343
-		return $settings;
344
-	}
345
-
346
-	/**
347
-	 * @inheritdoc
348
-	 */
349
-	public function getPersonalSections(): array {
350
-		$sections = [
351
-			0 => [new Section('personal-info', $this->l->t('Personal info'), 0, $this->url->imagePath('core', 'actions/info.svg'))],
352
-			5 => [new Section('security', $this->l->t('Security'), 0, $this->url->imagePath('settings', 'password.svg'))],
353
-			15 => [new Section('sync-clients', $this->l->t('Mobile & desktop'), 0, $this->url->imagePath('core', 'clients/phone.svg'))],
354
-		];
355
-
356
-		$legacyForms = \OC_App::getForms('personal');
357
-		if(!empty($legacyForms) && $this->hasLegacyPersonalSettingsToRender($legacyForms)) {
358
-			$sections[98] = [new Section('additional', $this->l->t('Additional settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))];
359
-		}
360
-
361
-		$appSections = $this->getSections('personal');
362
-
363
-		foreach ($appSections as $section) {
364
-			/** @var ISection $section */
365
-			if (!isset($sections[$section->getPriority()])) {
366
-				$sections[$section->getPriority()] = [];
367
-			}
368
-
369
-			$sections[$section->getPriority()][] = $section;
370
-		}
371
-
372
-		ksort($sections);
373
-
374
-		return $sections;
375
-	}
376
-
377
-	/**
378
-	 * @param string[] $forms
379
-	 * @return bool
380
-	 */
381
-	private function hasLegacyPersonalSettingsToRender(array $forms): bool {
382
-		foreach ($forms as $form) {
383
-			if(trim($form) !== '') {
384
-				return true;
385
-			}
386
-		}
387
-		return false;
388
-	}
389
-
390
-	/**
391
-	 * @inheritdoc
392
-	 */
393
-	public function getPersonalSettings($section): array {
394
-		$settings = $this->getBuiltInPersonalSettings($section);
395
-		$appSettings = $this->getSettings('personal', $section);
396
-
397
-		foreach ($appSettings as $setting) {
398
-			if (!isset($settings[$setting->getPriority()])) {
399
-				$settings[$setting->getPriority()] = [];
400
-			}
401
-			$settings[$setting->getPriority()][] = $setting;
402
-		}
403
-
404
-		ksort($settings);
405
-		return $settings;
406
-	}
52
+    /** @var ILogger */
53
+    private $log;
54
+    /** @var IDBConnection */
55
+    private $dbc;
56
+    /** @var IL10N */
57
+    private $l;
58
+    /** @var IConfig */
59
+    private $config;
60
+    /** @var EncryptionManager */
61
+    private $encryptionManager;
62
+    /** @var IUserManager */
63
+    private $userManager;
64
+    /** @var ILockingProvider */
65
+    private $lockingProvider;
66
+    /** @var IRequest */
67
+    private $request;
68
+    /** @var IURLGenerator */
69
+    private $url;
70
+    /** @var AccountManager */
71
+    private $accountManager;
72
+    /** @var IGroupManager */
73
+    private $groupManager;
74
+    /** @var IFactory */
75
+    private $l10nFactory;
76
+    /** @var IAppManager */
77
+    private $appManager;
78
+
79
+    /**
80
+     * @param ILogger $log
81
+     * @param IDBConnection $dbc
82
+     * @param IL10N $l
83
+     * @param IConfig $config
84
+     * @param EncryptionManager $encryptionManager
85
+     * @param IUserManager $userManager
86
+     * @param ILockingProvider $lockingProvider
87
+     * @param IRequest $request
88
+     * @param IURLGenerator $url
89
+     * @param AccountManager $accountManager
90
+     * @param IGroupManager $groupManager
91
+     * @param IFactory $l10nFactory
92
+     * @param IAppManager $appManager
93
+     */
94
+    public function __construct(
95
+        ILogger $log,
96
+        IDBConnection $dbc,
97
+        IL10N $l,
98
+        IConfig $config,
99
+        EncryptionManager $encryptionManager,
100
+        IUserManager $userManager,
101
+        ILockingProvider $lockingProvider,
102
+        IRequest $request,
103
+        IURLGenerator $url,
104
+        AccountManager $accountManager,
105
+        IGroupManager $groupManager,
106
+        IFactory $l10nFactory,
107
+        IAppManager $appManager
108
+    ) {
109
+        $this->log = $log;
110
+        $this->dbc = $dbc;
111
+        $this->l = $l;
112
+        $this->config = $config;
113
+        $this->encryptionManager = $encryptionManager;
114
+        $this->userManager = $userManager;
115
+        $this->lockingProvider = $lockingProvider;
116
+        $this->request = $request;
117
+        $this->url = $url;
118
+        $this->accountManager = $accountManager;
119
+        $this->groupManager = $groupManager;
120
+        $this->l10nFactory = $l10nFactory;
121
+        $this->appManager = $appManager;
122
+    }
123
+
124
+    /** @var array */
125
+    protected $sectionClasses = [];
126
+
127
+    /** @var array */
128
+    protected $sections = [];
129
+
130
+    /**
131
+     * @param string $type 'admin' or 'personal'
132
+     * @param string $section Class must implement OCP\Settings\ISection
133
+     * @return void
134
+     */
135
+    public function registerSection(string $type, string $section) {
136
+        $this->sectionClasses[$section] = $type;
137
+    }
138
+
139
+    /**
140
+     * @param string $type 'admin' or 'personal'
141
+     * @return ISection[]
142
+     */
143
+    protected function getSections(string $type): array {
144
+        if (!isset($this->sections[$type])) {
145
+            $this->sections[$type] = [];
146
+        }
147
+
148
+        foreach ($this->sectionClasses as $class => $sectionType) {
149
+            try {
150
+                /** @var ISection $section */
151
+                $section = \OC::$server->query($class);
152
+            } catch (QueryException $e) {
153
+                $this->log->logException($e, ['level' => ILogger::INFO]);
154
+                continue;
155
+            }
156
+
157
+            if (!$section instanceof ISection) {
158
+                $this->log->logException(new \InvalidArgumentException('Invalid settings section registered'), ['level' => ILogger::INFO]);
159
+                continue;
160
+            }
161
+
162
+            $this->sections[$sectionType][$section->getID()] = $section;
163
+
164
+            unset($this->sectionClasses[$class]);
165
+        }
166
+
167
+        return $this->sections[$type];
168
+    }
169
+
170
+    /** @var array */
171
+    protected $settingClasses = [];
172
+
173
+    /** @var array */
174
+    protected $settings = [];
175
+
176
+    /**
177
+     * @param string $type 'admin' or 'personal'
178
+     * @param string $setting Class must implement OCP\Settings\ISetting
179
+     * @return void
180
+     */
181
+    public function registerSetting(string $type, string $setting) {
182
+        $this->settingClasses[$setting] = $type;
183
+    }
184
+
185
+    /**
186
+     * @param string $type 'admin' or 'personal'
187
+     * @param string $section
188
+     * @return ISettings[]
189
+     */
190
+    protected function getSettings(string $type, string $section): array {
191
+        if (!isset($this->settings[$type])) {
192
+            $this->settings[$type] = [];
193
+        }
194
+        if (!isset($this->settings[$type][$section])) {
195
+            $this->settings[$type][$section] = [];
196
+        }
197
+
198
+        foreach ($this->settingClasses as $class => $settingsType) {
199
+            try {
200
+                /** @var ISettings $setting */
201
+                $setting = \OC::$server->query($class);
202
+            } catch (QueryException $e) {
203
+                $this->log->logException($e, ['level' => ILogger::INFO]);
204
+                continue;
205
+            }
206
+
207
+            if (!$setting instanceof ISettings) {
208
+                $this->log->logException(new \InvalidArgumentException('Invalid settings setting registered'), ['level' => ILogger::INFO]);
209
+                continue;
210
+            }
211
+
212
+            if (!isset($this->settings[$settingsType][$setting->getSection()])) {
213
+                $this->settings[$settingsType][$setting->getSection()] = [];
214
+            }
215
+            $this->settings[$settingsType][$setting->getSection()][] = $setting;
216
+
217
+            unset($this->settingClasses[$class]);
218
+        }
219
+
220
+        return $this->settings[$type][$section];
221
+    }
222
+
223
+    /**
224
+     * @inheritdoc
225
+     */
226
+    public function getAdminSections(): array {
227
+        // built-in sections
228
+        $sections = [
229
+            0 => [new Section('overview', $this->l->t('Overview'), 0, $this->url->imagePath('settings', 'admin.svg'))],
230
+            1 => [new Section('server', $this->l->t('Basic settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))],
231
+            5 => [new Section('sharing', $this->l->t('Sharing'), 0, $this->url->imagePath('core', 'actions/share.svg'))],
232
+            10 => [new Section('security', $this->l->t('Security'), 0, $this->url->imagePath('core', 'actions/password.svg'))],
233
+            45 => [new Section('encryption', $this->l->t('Encryption'), 0, $this->url->imagePath('core', 'actions/password.svg'))],
234
+            98 => [new Section('additional', $this->l->t('Additional settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))],
235
+            99 => [new Section('tips-tricks', $this->l->t('Tips & tricks'), 0, $this->url->imagePath('settings', 'help.svg'))],
236
+        ];
237
+
238
+        $appSections = $this->getSections('admin');
239
+
240
+        foreach ($appSections as $section) {
241
+            /** @var ISection $section */
242
+            if (!isset($sections[$section->getPriority()])) {
243
+                $sections[$section->getPriority()] = [];
244
+            }
245
+
246
+            $sections[$section->getPriority()][] = $section;
247
+        }
248
+
249
+        ksort($sections);
250
+
251
+        return $sections;
252
+    }
253
+
254
+    /**
255
+     * @param string $section
256
+     * @return ISection[]
257
+     */
258
+    private function getBuiltInAdminSettings($section): array {
259
+        $forms = [];
260
+
261
+        if ($section === 'overview') {
262
+            /** @var ISettings $form */
263
+            $form = new Admin\Overview($this->dbc, $this->request, $this->config, $this->lockingProvider, $this->l);
264
+            $forms[$form->getPriority()] = [$form];
265
+            $form = new Admin\ServerDevNotice();
266
+            $forms[$form->getPriority()] = [$form];
267
+        }
268
+        if ($section === 'server') {
269
+            /** @var ISettings $form */
270
+            $form = new Admin\Server($this->dbc, $this->request, $this->config, $this->lockingProvider, $this->l);
271
+            $forms[$form->getPriority()] = [$form];
272
+            $form = new Admin\Mail($this->config);
273
+            $forms[$form->getPriority()] = [$form];
274
+        }
275
+        if ($section === 'encryption') {
276
+            /** @var ISettings $form */
277
+            $form = new Admin\Encryption($this->encryptionManager, $this->userManager);
278
+            $forms[$form->getPriority()] = [$form];
279
+        }
280
+        if ($section === 'sharing') {
281
+            /** @var ISettings $form */
282
+            $form = new Admin\Sharing($this->config, $this->l);
283
+            $forms[$form->getPriority()] = [$form];
284
+        }
285
+        if ($section === 'tips-tricks') {
286
+            /** @var ISettings $form */
287
+            $form = new Admin\TipsTricks($this->config);
288
+            $forms[$form->getPriority()] = [$form];
289
+        }
290
+
291
+        return $forms;
292
+    }
293
+
294
+    /**
295
+     * @param string $section
296
+     * @return ISection[]
297
+     */
298
+    private function getBuiltInPersonalSettings($section): array {
299
+        $forms = [];
300
+
301
+        if ($section === 'personal-info') {
302
+            /** @var ISettings $form */
303
+            $form = new Personal\PersonalInfo(
304
+                $this->config,
305
+                $this->userManager,
306
+                $this->groupManager,
307
+                $this->accountManager,
308
+                $this->appManager,
309
+                $this->l10nFactory,
310
+                $this->l
311
+            );
312
+            $forms[$form->getPriority()] = [$form];
313
+        }
314
+        if($section === 'security') {
315
+            /** @var ISettings $form */
316
+            $form = new Personal\Security();
317
+            $forms[$form->getPriority()] = [$form];
318
+        }
319
+        if ($section === 'additional') {
320
+            /** @var ISettings $form */
321
+            $form = new Personal\Additional();
322
+            $forms[$form->getPriority()] = [$form];
323
+        }
324
+
325
+        return $forms;
326
+    }
327
+
328
+    /**
329
+     * @inheritdoc
330
+     */
331
+    public function getAdminSettings($section): array {
332
+        $settings = $this->getBuiltInAdminSettings($section);
333
+        $appSettings = $this->getSettings('admin', $section);
334
+
335
+        foreach ($appSettings as $setting) {
336
+            if (!isset($settings[$setting->getPriority()])) {
337
+                $settings[$setting->getPriority()] = [];
338
+            }
339
+            $settings[$setting->getPriority()][] = $setting;
340
+        }
341
+
342
+        ksort($settings);
343
+        return $settings;
344
+    }
345
+
346
+    /**
347
+     * @inheritdoc
348
+     */
349
+    public function getPersonalSections(): array {
350
+        $sections = [
351
+            0 => [new Section('personal-info', $this->l->t('Personal info'), 0, $this->url->imagePath('core', 'actions/info.svg'))],
352
+            5 => [new Section('security', $this->l->t('Security'), 0, $this->url->imagePath('settings', 'password.svg'))],
353
+            15 => [new Section('sync-clients', $this->l->t('Mobile & desktop'), 0, $this->url->imagePath('core', 'clients/phone.svg'))],
354
+        ];
355
+
356
+        $legacyForms = \OC_App::getForms('personal');
357
+        if(!empty($legacyForms) && $this->hasLegacyPersonalSettingsToRender($legacyForms)) {
358
+            $sections[98] = [new Section('additional', $this->l->t('Additional settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))];
359
+        }
360
+
361
+        $appSections = $this->getSections('personal');
362
+
363
+        foreach ($appSections as $section) {
364
+            /** @var ISection $section */
365
+            if (!isset($sections[$section->getPriority()])) {
366
+                $sections[$section->getPriority()] = [];
367
+            }
368
+
369
+            $sections[$section->getPriority()][] = $section;
370
+        }
371
+
372
+        ksort($sections);
373
+
374
+        return $sections;
375
+    }
376
+
377
+    /**
378
+     * @param string[] $forms
379
+     * @return bool
380
+     */
381
+    private function hasLegacyPersonalSettingsToRender(array $forms): bool {
382
+        foreach ($forms as $form) {
383
+            if(trim($form) !== '') {
384
+                return true;
385
+            }
386
+        }
387
+        return false;
388
+    }
389
+
390
+    /**
391
+     * @inheritdoc
392
+     */
393
+    public function getPersonalSettings($section): array {
394
+        $settings = $this->getBuiltInPersonalSettings($section);
395
+        $appSettings = $this->getSettings('personal', $section);
396
+
397
+        foreach ($appSettings as $setting) {
398
+            if (!isset($settings[$setting->getPriority()])) {
399
+                $settings[$setting->getPriority()] = [];
400
+            }
401
+            $settings[$setting->getPriority()][] = $setting;
402
+        }
403
+
404
+        ksort($settings);
405
+        return $settings;
406
+    }
407 407
 }
Please login to merge, or discard this patch.