summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-12-02 14:25:07 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2015-12-02 14:44:41 +0100
commit28ceab2f616d45a53dcc00c2cff53d5524bf0e9e (patch)
tree2c74c0dfb996625aad559e959c35860ba243770c /lib/private
parentf558ac7dd583c8135e40933e9e35d3505b9b6cb6 (diff)
downloadnextcloud-server-28ceab2f616d45a53dcc00c2cff53d5524bf0e9e.tar.gz
nextcloud-server-28ceab2f616d45a53dcc00c2cff53d5524bf0e9e.zip
Fix endless recursion
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/user/user.php16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/private/user/user.php b/lib/private/user/user.php
index d60ffe95fc3..d1fa641504c 100644
--- a/lib/private/user/user.php
+++ b/lib/private/user/user.php
@@ -71,14 +71,14 @@ class User implements IUser {
* @param string $uid
* @param \OC_User_Interface $backend
* @param \OC\Hooks\Emitter $emitter
- * @param \OCP\IConfig $config
+ * @param IConfig|null $config
+ * @param IURLGenerator $urlGenerator
*/
- public function __construct($uid, $backend, $emitter = null, IConfig $config = null, $avatarManager = null, $urlGenerator = null) {
+ public function __construct($uid, $backend, $emitter = null, IConfig $config = null, $urlGenerator = null) {
$this->uid = $uid;
$this->backend = $backend;
$this->emitter = $emitter;
$this->config = $config;
- $this->avatarManager = $avatarManager;
$this->urlGenerator = $urlGenerator;
if ($this->config) {
$enabled = $this->config->getUserValue($uid, 'core', 'enabled', 'true');
@@ -88,9 +88,6 @@ class User implements IUser {
$this->enabled = true;
$this->lastLogin = \OC::$server->getConfig()->getUserValue($uid, 'login', 'lastLogin', 0);
}
- if (is_null($this->avatarManager)) {
- $this->avatarManager = \OC::$server->getAvatarManager();
- }
if (is_null($this->urlGenerator)) {
$this->urlGenerator = \OC::$server->getURLGenerator();
}
@@ -106,7 +103,7 @@ class User implements IUser {
}
/**
- * get the displayname for the user, if no specific displayname is set it will fallback to the user id
+ * get the display name for the user, if no specific display name is set it will fallback to the user id
*
* @return string
*/
@@ -326,6 +323,11 @@ class User implements IUser {
* @since 9.0.0
*/
public function getAvatarImage($size) {
+ // delay the initialization
+ if (is_null($this->avatarManager)) {
+ $this->avatarManager = \OC::$server->getAvatarManager();
+ }
+
$avatar = $this->avatarManager->getAvatar($this->uid);
$image = $avatar->get(-1);
if ($image) {