summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorjld3103 <jld3103yt@gmail.com>2023-03-31 08:53:56 +0200
committerjld3103 <jld3103yt@gmail.com>2023-04-05 09:08:56 +0200
commitd9f85220038b2421870a36f9b6a860d6444a988a (patch)
tree10b8cbdb0c0ded7947b50654a4e1d4a30390768a /apps
parent54140dd6bfda81276bd889a9a141d51e328100d1 (diff)
downloadnextcloud-server-d9f85220038b2421870a36f9b6a860d6444a988a.tar.gz
nextcloud-server-d9f85220038b2421870a36f9b6a860d6444a988a.zip
Fix types for reading and writing config values
Signed-off-by: jld3103 <jld3103yt@gmail.com>
Diffstat (limited to 'apps')
-rw-r--r--apps/settings/lib/Controller/CheckSetupController.php2
-rw-r--r--apps/settings/lib/Settings/Admin/Sharing.php2
-rw-r--r--apps/settings/tests/Settings/Admin/SharingTest.php4
-rw-r--r--apps/updatenotification/lib/Controller/AdminController.php4
-rw-r--r--apps/updatenotification/lib/Notification/BackgroundJob.php6
-rw-r--r--apps/updatenotification/lib/Notification/Notifier.php2
-rw-r--r--apps/updatenotification/lib/Settings/Admin.php2
-rw-r--r--apps/user_ldap/lib/Jobs/Sync.php10
-rw-r--r--apps/user_ldap/lib/User/User.php4
9 files changed, 18 insertions, 18 deletions
diff --git a/apps/settings/lib/Controller/CheckSetupController.php b/apps/settings/lib/Controller/CheckSetupController.php
index 82a7e118d06..81a112cac55 100644
--- a/apps/settings/lib/Controller/CheckSetupController.php
+++ b/apps/settings/lib/Controller/CheckSetupController.php
@@ -632,7 +632,7 @@ Raw output
}
protected function getLastCronInfo(): array {
- $lastCronRun = $this->config->getAppValue('core', 'lastcron', 0);
+ $lastCronRun = (int)$this->config->getAppValue('core', 'lastcron', '0');
return [
'diffInSeconds' => time() - $lastCronRun,
'relativeTime' => $this->dateTimeFormatter->formatTimeSpan($lastCronRun),
diff --git a/apps/settings/lib/Settings/Admin/Sharing.php b/apps/settings/lib/Settings/Admin/Sharing.php
index d3c6839b8f7..32b09f333a9 100644
--- a/apps/settings/lib/Settings/Admin/Sharing.php
+++ b/apps/settings/lib/Settings/Admin/Sharing.php
@@ -104,7 +104,7 @@ class Sharing implements IDelegatedSettings {
'shareExcludedGroupsList' => $excludeGroupsList,
'publicShareDisclaimerText' => $this->config->getAppValue('core', 'shareapi_public_link_disclaimertext', null),
'enableLinkPasswordByDefault' => $this->config->getAppValue('core', 'shareapi_enable_link_password_by_default', 'no'),
- 'shareApiDefaultPermissions' => $this->config->getAppValue('core', 'shareapi_default_permissions', Constants::PERMISSION_ALL),
+ 'shareApiDefaultPermissions' => (int)$this->config->getAppValue('core', 'shareapi_default_permissions', (string)Constants::PERMISSION_ALL),
'shareApiDefaultPermissionsCheckboxes' => $this->getSharePermissionList(),
'shareDefaultInternalExpireDateSet' => $this->config->getAppValue('core', 'shareapi_default_internal_expire_date', 'no'),
'shareInternalExpireAfterNDays' => $this->config->getAppValue('core', 'shareapi_internal_expire_after_n_days', '7'),
diff --git a/apps/settings/tests/Settings/Admin/SharingTest.php b/apps/settings/tests/Settings/Admin/SharingTest.php
index 2468ad97d1e..c0b5861f549 100644
--- a/apps/settings/tests/Settings/Admin/SharingTest.php
+++ b/apps/settings/tests/Settings/Admin/SharingTest.php
@@ -93,7 +93,7 @@ class SharingTest extends TestCase {
['core', 'shareapi_exclude_groups', 'no', 'no'],
['core', 'shareapi_public_link_disclaimertext', null, 'Lorem ipsum'],
['core', 'shareapi_enable_link_password_by_default', 'no', 'yes'],
- ['core', 'shareapi_default_permissions', Constants::PERMISSION_ALL, Constants::PERMISSION_ALL],
+ ['core', 'shareapi_default_permissions', (string)Constants::PERMISSION_ALL, Constants::PERMISSION_ALL],
['core', 'shareapi_default_internal_expire_date', 'no', 'no'],
['core', 'shareapi_internal_expire_after_n_days', '7', '7'],
['core', 'shareapi_enforce_internal_expire_date', 'no', 'no'],
@@ -175,7 +175,7 @@ class SharingTest extends TestCase {
['core', 'shareapi_exclude_groups', 'no', 'yes'],
['core', 'shareapi_public_link_disclaimertext', null, 'Lorem ipsum'],
['core', 'shareapi_enable_link_password_by_default', 'no', 'yes'],
- ['core', 'shareapi_default_permissions', Constants::PERMISSION_ALL, Constants::PERMISSION_ALL],
+ ['core', 'shareapi_default_permissions', (string)Constants::PERMISSION_ALL, Constants::PERMISSION_ALL],
['core', 'shareapi_default_internal_expire_date', 'no', 'no'],
['core', 'shareapi_internal_expire_after_n_days', '7', '7'],
['core', 'shareapi_enforce_internal_expire_date', 'no', 'no'],
diff --git a/apps/updatenotification/lib/Controller/AdminController.php b/apps/updatenotification/lib/Controller/AdminController.php
index b13ba66efd5..74a3a86c7e1 100644
--- a/apps/updatenotification/lib/Controller/AdminController.php
+++ b/apps/updatenotification/lib/Controller/AdminController.php
@@ -85,7 +85,7 @@ class AdminController extends Controller {
*/
public function setChannel(string $channel): DataResponse {
Util::setChannel($channel);
- $this->config->setAppValue('core', 'lastupdatedat', 0);
+ $this->config->setAppValue('core', 'lastupdatedat', '0');
return new DataResponse(['status' => 'success', 'data' => ['message' => $this->l10n->t('Channel updated')]]);
}
@@ -99,7 +99,7 @@ class AdminController extends Controller {
// Create a new job and store the creation date
$this->jobList->add(ResetTokenBackgroundJob::class);
- $this->config->setAppValue('core', 'updater.secret.created', $this->timeFactory->getTime());
+ $this->config->setAppValue('core', 'updater.secret.created', (string)$this->timeFactory->getTime());
// Create a new token
$newToken = $this->secureRandom->generate(64);
diff --git a/apps/updatenotification/lib/Notification/BackgroundJob.php b/apps/updatenotification/lib/Notification/BackgroundJob.php
index c1b3cddf945..f8f1f41e589 100644
--- a/apps/updatenotification/lib/Notification/BackgroundJob.php
+++ b/apps/updatenotification/lib/Notification/BackgroundJob.php
@@ -108,14 +108,14 @@ class BackgroundJob extends TimedJob {
$status = $updater->check();
if ($status === false) {
- $errors = 1 + (int) $this->config->getAppValue('updatenotification', 'update_check_errors', 0);
- $this->config->setAppValue('updatenotification', 'update_check_errors', $errors);
+ $errors = 1 + (int) $this->config->getAppValue('updatenotification', 'update_check_errors', '0');
+ $this->config->setAppValue('updatenotification', 'update_check_errors', (string)$errors);
if (\in_array($errors, $this->connectionNotifications, true)) {
$this->sendErrorNotifications($errors);
}
} elseif (\is_array($status)) {
- $this->config->setAppValue('updatenotification', 'update_check_errors', 0);
+ $this->config->setAppValue('updatenotification', 'update_check_errors', '0');
$this->clearErrorNotifications();
if (isset($status['version'])) {
diff --git a/apps/updatenotification/lib/Notification/Notifier.php b/apps/updatenotification/lib/Notification/Notifier.php
index c1269daaa30..9ce233ed721 100644
--- a/apps/updatenotification/lib/Notification/Notifier.php
+++ b/apps/updatenotification/lib/Notification/Notifier.php
@@ -115,7 +115,7 @@ class Notifier implements INotifier {
$l = $this->l10NFactory->get('updatenotification', $languageCode);
if ($notification->getSubject() === 'connection_error') {
- $errors = (int) $this->config->getAppValue('updatenotification', 'update_check_errors', 0);
+ $errors = (int) $this->config->getAppValue('updatenotification', 'update_check_errors', '0');
if ($errors === 0) {
$this->notificationManager->markProcessed($notification);
throw new \InvalidArgumentException('Update checked worked again');
diff --git a/apps/updatenotification/lib/Settings/Admin.php b/apps/updatenotification/lib/Settings/Admin.php
index fded4451408..7f47a46f8f9 100644
--- a/apps/updatenotification/lib/Settings/Admin.php
+++ b/apps/updatenotification/lib/Settings/Admin.php
@@ -78,7 +78,7 @@ class Admin implements ISettings {
}
public function getForm(): TemplateResponse {
- $lastUpdateCheckTimestamp = $this->config->getAppValue('core', 'lastupdatedat');
+ $lastUpdateCheckTimestamp = (int)$this->config->getAppValue('core', 'lastupdatedat');
$lastUpdateCheck = $this->dateTimeFormatter->formatDateTime($lastUpdateCheckTimestamp);
$channels = [
diff --git a/apps/user_ldap/lib/Jobs/Sync.php b/apps/user_ldap/lib/Jobs/Sync.php
index b231089b79b..1ba24af5399 100644
--- a/apps/user_ldap/lib/Jobs/Sync.php
+++ b/apps/user_ldap/lib/Jobs/Sync.php
@@ -73,10 +73,10 @@ class Sync extends TimedJob {
parent::__construct($time);
$this->userManager = $userManager;
$this->setInterval(
- \OC::$server->getConfig()->getAppValue(
+ (int)\OC::$server->getConfig()->getAppValue(
'user_ldap',
'background_sync_interval',
- self::MIN_INTERVAL
+ (string)self::MIN_INTERVAL
)
);
}
@@ -97,7 +97,7 @@ class Sync extends TimedJob {
$interval = floor(24 * 60 * 60 / $runsPerDay);
$interval = min(max($interval, self::MIN_INTERVAL), self::MAX_INTERVAL);
- $this->config->setAppValue('user_ldap', 'background_sync_interval', $interval);
+ $this->config->setAppValue('user_ldap', 'background_sync_interval', (string)$interval);
}
/**
@@ -198,7 +198,7 @@ class Sync extends TimedJob {
$cycleData = [
'prefix' => $this->config->getAppValue('user_ldap', 'background_sync_prefix', null),
- 'offset' => (int)$this->config->getAppValue('user_ldap', 'background_sync_offset', 0),
+ 'offset' => (int)$this->config->getAppValue('user_ldap', 'background_sync_offset', '0'),
];
if (
@@ -255,7 +255,7 @@ class Sync extends TimedJob {
* @return bool
*/
public function qualifiesToRun($cycleData) {
- $lastChange = $this->config->getAppValue('user_ldap', $cycleData['prefix'] . '_lastChange', 0);
+ $lastChange = (int)$this->config->getAppValue('user_ldap', $cycleData['prefix'] . '_lastChange', '0');
if ((time() - $lastChange) > 60 * 30) {
return true;
}
diff --git a/apps/user_ldap/lib/User/User.php b/apps/user_ldap/lib/User/User.php
index 15894ce04b7..edf43494777 100644
--- a/apps/user_ldap/lib/User/User.php
+++ b/apps/user_ldap/lib/User/User.php
@@ -303,7 +303,7 @@ class User {
}
if (!is_null($attr)
- && $this->config->getAppValue('user_ldap', 'enforce_home_folder_naming_rule', true)
+ && $this->config->getAppValue('user_ldap', 'enforce_home_folder_naming_rule', 'true')
) {
// a naming rule attribute is defined, but it doesn't exist for that LDAP user
throw new \Exception('Home dir attribute can\'t be read from LDAP for uid: ' . $this->getUsername());
@@ -355,7 +355,7 @@ class User {
*/
public function markLogin() {
$this->config->setUserValue(
- $this->uid, 'user_ldap', self::USER_PREFKEY_FIRSTLOGIN, 1);
+ $this->uid, 'user_ldap', self::USER_PREFKEY_FIRSTLOGIN, '1');
}
/**