diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_encryption/hooks/hooks.php | 2 | ||||
-rw-r--r-- | apps/files_encryption/lib/util.php | 20 | ||||
-rwxr-xr-x | apps/files_encryption/tests/util.php | 4 | ||||
-rw-r--r-- | apps/files_trashbin/lib/trashbin.php | 6 | ||||
-rw-r--r-- | apps/files_versions/lib/storage.php | 7 |
5 files changed, 27 insertions, 12 deletions
diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php index a6b7555b376..f26eefa30e2 100644 --- a/apps/files_encryption/hooks/hooks.php +++ b/apps/files_encryption/hooks/hooks.php @@ -502,7 +502,7 @@ class Hooks { public static function preDisable($params) {
if ($params['app'] === 'files_encryption') {
- \OC_Preferences::deleteAppFromAllUsers('files_encryption');
+ \OC::$server->getConfig()->deleteAppFromAllUsers('files_encryption');
$session = new \OCA\Encryption\Session(new \OC\Files\View('/'));
$session->setInitialized(\OCA\Encryption\Session::NOT_INITIALIZED);
diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php index 42a7e20c87f..2b4a50d6e2b 100644 --- a/apps/files_encryption/lib/util.php +++ b/apps/files_encryption/lib/util.php @@ -225,7 +225,7 @@ class Util { */ public function recoveryEnabledForUser() { - $recoveryMode = \OC_Preferences::getValue($this->userId, 'files_encryption', 'recovery_enabled', '0'); + $recoveryMode = \OC::$server->getConfig()->getUserValue($this->userId, 'files_encryption', 'recovery_enabled', '0'); return ($recoveryMode === '1') ? true : false; @@ -239,7 +239,12 @@ class Util { public function setRecoveryForUser($enabled) { $value = $enabled ? '1' : '0'; - return \OC_Preferences::setValue($this->userId, 'files_encryption', 'recovery_enabled', $value); + try { + \OC::$server->getConfig()->setUserValue($this->userId, 'files_encryption', 'recovery_enabled', $value); + return true; + } catch(\OCP\PreConditionNotMetException $e) { + return false; + } } @@ -1102,7 +1107,12 @@ class Util { // convert to string if preCondition is set $preCondition = ($preCondition === null) ? null : (string)$preCondition; - return \OC_Preferences::setValue($this->userId, 'files_encryption', 'migration_status', (string)$status, $preCondition); + try { + \OC::$server->getConfig()->setUserValue($this->userId, 'files_encryption', 'migration_status', (string)$status, $preCondition); + return true; + } catch(\OCP\PreConditionNotMetException $e) { + return false; + } } @@ -1154,9 +1164,9 @@ class Util { $migrationStatus = false; if (\OCP\User::userExists($this->userId)) { - $migrationStatus = \OC_Preferences::getValue($this->userId, 'files_encryption', 'migration_status'); + $migrationStatus = \OC::$server->getConfig()->getUserValue($this->userId, 'files_encryption', 'migration_status', null); if ($migrationStatus === null) { - \OC_Preferences::setValue($this->userId, 'files_encryption', 'migration_status', (string)self::MIGRATION_OPEN); + \OC::$server->getConfig()->setUserValue($this->userId, 'files_encryption', 'migration_status', (string)self::MIGRATION_OPEN); $migrationStatus = self::MIGRATION_OPEN; } } diff --git a/apps/files_encryption/tests/util.php b/apps/files_encryption/tests/util.php index 8d9aba423cd..2d58db2128c 100755 --- a/apps/files_encryption/tests/util.php +++ b/apps/files_encryption/tests/util.php @@ -617,7 +617,9 @@ class Test_Encryption_Util extends \OCA\Files_Encryption\Tests\TestCase { * @return boolean */ private function setMigrationStatus($status, $user) { - return \OC_Preferences::setValue($user, 'files_encryption', 'migration_status', (string)$status); + \OC::$server->getConfig()->setUserValue($user, 'files_encryption', 'migration_status', (string)$status); + // the update will definitely be executed -> return value is always true + return true; } } diff --git a/apps/files_trashbin/lib/trashbin.php b/apps/files_trashbin/lib/trashbin.php index 661fc271dfc..b9d7a4aa6cf 100644 --- a/apps/files_trashbin/lib/trashbin.php +++ b/apps/files_trashbin/lib/trashbin.php @@ -621,11 +621,13 @@ class Trashbin { * @return int available free space for trash bin */ private static function calculateFreeSpace($trashbinSize, $user) { + $config = \OC::$server->getConfig(); + $softQuota = true; - $quota = \OC_Preferences::getValue($user, 'files', 'quota'); + $quota = $config->getUserValue($user, 'files', 'quota', null); $view = new \OC\Files\View('/' . $user); if ($quota === null || $quota === 'default') { - $quota = \OC::$server->getAppConfig()->getValue('files', 'default_quota'); + $quota = $config->getAppValue('files', 'default_quota', null); } if ($quota === null || $quota === 'none') { $quota = \OC\Files\Filesystem::free_space('/'); diff --git a/apps/files_versions/lib/storage.php b/apps/files_versions/lib/storage.php index 82e0ecc3e2f..3d30ada863a 100644 --- a/apps/files_versions/lib/storage.php +++ b/apps/files_versions/lib/storage.php @@ -479,15 +479,16 @@ class Storage { * Erase a file's versions which exceed the set quota */ private static function expire($filename, $versionsSize = null, $offset = 0) { - if(\OCP\Config::getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true') { + $config = \OC::$server->getConfig(); + if($config->getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true') { list($uid, $filename) = self::getUidAndFilename($filename); $versionsFileview = new \OC\Files\View('/'.$uid.'/files_versions'); // get available disk space for user $softQuota = true; - $quota = \OC_Preferences::getValue($uid, 'files', 'quota'); + $quota = $config->getUserValue($uid, 'files', 'quota', null); if ( $quota === null || $quota === 'default') { - $quota = \OC::$server->getAppConfig()->getValue('files', 'default_quota'); + $quota = $config->getAppValue('files', 'default_quota', null); } if ( $quota === null || $quota === 'none' ) { $quota = \OC\Files\Filesystem::free_space('/'); |