[Pkg-owncloud-commits] [owncloud] 36/104: Replace static usage of OC_Config and OC_Preferences with the injected \OC\ConfigAll

David Prévot taffit at moszumanska.debian.org
Sat Jan 18 13:33:38 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit 208037b56a3289d5dd88748424ace506e0b426f9
Author: Robin Appelman <icewind at owncloud.com>
Date:   Mon Dec 16 16:02:03 2013 +0100

    Replace static usage of OC_Config and OC_Preferences with the injected \OC\ConfigAll
---
 lib/private/user/user.php | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/lib/private/user/user.php b/lib/private/user/user.php
index b0b4657..ef5364c 100644
--- a/lib/private/user/user.php
+++ b/lib/private/user/user.php
@@ -62,9 +62,13 @@ class User {
 		}
 		$this->backend = $backend;
 		$this->emitter = $emitter;
-		$enabled = \OC_Preferences::getValue($uid, 'core', 'enabled', 'true'); //TODO: DI for OC_Preferences
-		$this->enabled = ($enabled === 'true');
 		$this->config = $config;
+		if ($this->config) {
+			$enabled = $this->config->getUserValue($uid, 'core', 'enabled', 'true');
+			$this->enabled = ($enabled === 'true');
+		} else {
+			$this->enabled = true;
+		}
 	}
 
 	/**
@@ -148,8 +152,10 @@ class User {
 		if (!$this->home) {
 			if ($this->backend->implementsActions(\OC_USER_BACKEND_GET_HOME) and $home = $this->backend->getHome($this->uid)) {
 				$this->home = $home;
+			} elseif ($this->config) {
+				$this->home = $this->config->getSystemValue('datadirectory') . '/' . $this->uid;
 			} else {
-				$this->home = \OC_Config::getValue("datadirectory", \OC::$SERVERROOT . "/data") . '/' . $this->uid; //TODO switch to Config object once implemented
+				$this->home = \OC::$SERVERROOT . '/data/' . $this->uid;
 			}
 		}
 		return $this->home;
@@ -205,7 +211,9 @@ class User {
 	 */
 	public function setEnabled($enabled) {
 		$this->enabled = $enabled;
-		$enabled = ($enabled) ? 'true' : 'false';
-		\OC_Preferences::setValue($this->uid, 'core', 'enabled', $enabled);
+		if ($this->config) {
+			$enabled = ($enabled) ? 'true' : 'false';
+			$this->config->setUserValue($this->uid, 'core', 'enabled', $enabled);
+		}
 	}
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list