Skip to content

Commit d22e50c

Browse files
committed
Add typings to config
Signed-off-by: J0WI <J0WI@users.noreply.github.com>
1 parent c19e7a9 commit d22e50c

29 files changed

Lines changed: 154 additions & 266 deletions

File tree

apps/encryption/lib/Recovery.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public function isRecoveryEnabledForUser($user = '') {
169169
* @return bool
170170
*/
171171
public function isRecoveryKeyEnabled() {
172-
$enabled = $this->config->getAppValue('encryption', 'recoveryAdminEnabled', 0);
172+
$enabled = $this->config->getAppValue('encryption', 'recoveryAdminEnabled', '0');
173173

174174
return ($enabled === '1');
175175
}

apps/files/lib/Controller/ViewController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -315,10 +315,10 @@ public function index($dir = '', $view = '', $fileid = null, $fileNotFound = fal
315315
$params['allowShareWithLink'] = $this->shareManager->shareApiAllowLinks() ? 'yes' : 'no';
316316
$params['defaultFileSorting'] = $this->config->getUserValue($user, 'files', 'file_sorting', 'name');
317317
$params['defaultFileSortingDirection'] = $this->config->getUserValue($user, 'files', 'file_sorting_direction', 'asc');
318-
$params['showgridview'] = $this->config->getUserValue($user, 'files', 'show_grid', false);
319-
$showHidden = (bool) $this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'show_hidden', false);
318+
$params['showgridview'] = $this->config->getUserValue($user, 'files', 'show_grid', 'false');
319+
$showHidden = (bool) $this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'show_hidden', 'false');
320320
$params['showHiddenFiles'] = $showHidden ? 1 : 0;
321-
$cropImagePreviews = (bool) $this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'crop_image_previews', true);
321+
$cropImagePreviews = (bool) $this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'crop_image_previews', 'true');
322322
$params['cropImagePreviews'] = $cropImagePreviews ? 1 : 0;
323323
$params['fileNotFound'] = $fileNotFound ? 1 : 0;
324324
$params['appNavigation'] = $nav;

apps/files/list.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
$shareManager = Server::get(IManager::class);
3535
$publicUploadEnabled = $shareManager->shareApiLinkAllowPublicUpload() ? 'yes' : 'no';
3636

37-
$showgridview = $config->getUserValue($userSession->getUser()->getUID(), 'files', 'show_grid', false);
37+
$showgridview = $config->getUserValue($userSession->getUser()->getUID(), 'files', 'show_grid', 'false');
3838

3939
// renders the controls and table headers template
4040
$tmpl = new OCP\Template('files', 'list', '');

apps/files/recentlist.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
$config = \OC::$server->getConfig();
2828
$userSession = \OC::$server->getUserSession();
2929

30-
$showgridview = $config->getUserValue($userSession->getUser()->getUID(), 'files', 'show_grid', false);
30+
$showgridview = $config->getUserValue($userSession->getUser()->getUID(), 'files', 'show_grid', 'false');
3131

3232
$tmpl = new OCP\Template('files', 'recentlist', '');
3333

apps/files/simplelist.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
$config = \OC::$server->getConfig();
2626
$userSession = \OC::$server->getUserSession();
2727

28-
$showgridview = $config->getUserValue($userSession->getUser()->getUID(), 'files', 'show_grid', false);
28+
$showgridview = $config->getUserValue($userSession->getUser()->getUID(), 'files', 'show_grid', 'false');
2929

3030
// renders the controls and table headers template
3131
$tmpl = new OCP\Template('files', 'simplelist', '');

apps/files_sharing/list.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
$config = Server::get(IConfig::class);
3131
$userSession = Server::get(IUserSession::class);
3232

33-
$showgridview = $config->getUserValue($userSession->getUser()->getUID(), 'files', 'show_grid', false);
33+
$showgridview = $config->getUserValue($userSession->getUser()->getUID(), 'files', 'show_grid', 'false');
3434

3535
$tmpl = new OCP\Template('files_sharing', 'list', '');
3636

apps/files_trashbin/list.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
$config = \OC::$server->getConfig();
2929
$userSession = \OC::$server->getUserSession();
3030

31-
$showgridview = $config->getUserValue($userSession->getUser()->getUID(), 'files', 'show_grid', false);
31+
$showgridview = $config->getUserValue($userSession->getUser()->getUID(), 'files', 'show_grid', 'false');
3232

3333
$tmpl = new OCP\Template('files_trashbin', 'index', '');
3434

apps/lookup_server_connector/lib/BackgroundJobs/RetryJob.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ protected function run($argument): void {
180180
$user->getUID(),
181181
'lookup_server_connector',
182182
'update_retries',
183-
$this->retries + 1
183+
(string)($this->retries + 1)
184184
);
185185
}
186186
}

apps/theming/lib/Migration/MigrateUserConfig.php

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -91,20 +91,18 @@ public function run(IOutput $output) {
9191
$this->userManager->callForSeenUsers(function (IUser $user) use ($output) {
9292
$config = [];
9393

94-
$font = $this->config->getUserValue($user->getUID(), 'accessibility', 'font', false);
95-
$highcontrast = $this->config->getUserValue($user->getUID(), 'accessibility', 'highcontrast', false);
96-
$theme = $this->config->getUserValue($user->getUID(), 'accessibility', 'theme', false);
97-
98-
if ($highcontrast || $theme) {
99-
if ($theme === 'dark' && $highcontrast === 'highcontrast') {
100-
$config[] = $this->darkHighContrastTheme->getId();
101-
} else if ($theme === 'dark') {
102-
$config[] = $this->darkTheme->getId();
103-
} else if ($highcontrast === 'highcontrast') {
104-
$config[] = $this->highContrastTheme->getId();
105-
}
94+
$font = $this->config->getUserValue($user->getUID(), 'accessibility', 'font', '');
95+
$highcontrast = $this->config->getUserValue($user->getUID(), 'accessibility', 'highcontrast', '');
96+
$theme = $this->config->getUserValue($user->getUID(), 'accessibility', 'theme', '');
97+
98+
if ($theme === 'dark' && $highcontrast === 'highcontrast') {
99+
$config[] = $this->darkHighContrastTheme->getId();
100+
} else if ($theme === 'dark') {
101+
$config[] = $this->darkTheme->getId();
102+
} else if ($highcontrast === 'highcontrast') {
103+
$config[] = $this->highContrastTheme->getId();
106104
}
107-
105+
108106
if ($font === 'fontdyslexic') {
109107
$config[] = $this->dyslexiaFont->getId();
110108
}

apps/theming/lib/ThemingDefaults.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ public function getLogo($useSvg = true): string {
268268
// explanation: if an SVG is requested and the app config value for logoMime is set then the logo is there.
269269
// otherwise we need to check it and maybe also generate a PNG from the SVG (that's done in getImage() which
270270
// needs to be called then)
271-
if ($useSvg === true && $logo !== false) {
271+
if ($useSvg === true && $logo !== null) {
272272
$logoExists = true;
273273
} else {
274274
try {

0 commit comments

Comments
 (0)