summaryrefslogtreecommitdiffstats
path: root/apps/files_encryption/lib
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2014-12-04 16:48:07 +0100
committerMorris Jobke <hey@morrisjobke.de>2014-12-08 22:42:37 +0100
commit0d4f0ab87182cf2cb588bd3285fe41b46f26ee4d (patch)
tree68ee815c2f06e4f6ef049d56f65fdbf2cf8c4d18 /apps/files_encryption/lib
parent2d5fc9c1a6beec15f04277ccf1408b17f04631e9 (diff)
downloadnextcloud-server-0d4f0ab87182cf2cb588bd3285fe41b46f26ee4d.tar.gz
nextcloud-server-0d4f0ab87182cf2cb588bd3285fe41b46f26ee4d.zip
reduce OC_Preferences, OC_Config and \OCP\Config usage
* files_encryption * files_versions * files_trashbin * tests * status.php * core * server container
Diffstat (limited to 'apps/files_encryption/lib')
-rw-r--r--apps/files_encryption/lib/util.php20
1 files changed, 15 insertions, 5 deletions
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;
}
}