Merge pull request #21402 from owncloud/view-getuserobject-cache

Cache usermanager instance in view
This commit is contained in:
Thomas Müller 2015-12-30 20:04:51 +01:00
commit 42897ac5cb
1 changed files with 4 additions and 1 deletions

View File

@ -86,6 +86,8 @@ class View {
private $updaterEnabled = true; private $updaterEnabled = true;
private $userManager;
/** /**
* @param string $root * @param string $root
* @throws \Exception If $root contains an invalid path * @throws \Exception If $root contains an invalid path
@ -101,6 +103,7 @@ class View {
$this->fakeRoot = $root; $this->fakeRoot = $root;
$this->lockingProvider = \OC::$server->getLockingProvider(); $this->lockingProvider = \OC::$server->getLockingProvider();
$this->lockingEnabled = !($this->lockingProvider instanceof \OC\Lock\NoopLockingProvider); $this->lockingEnabled = !($this->lockingProvider instanceof \OC\Lock\NoopLockingProvider);
$this->userManager = \OC::$server->getUserManager();
} }
public function getAbsolutePath($path = '/') { public function getAbsolutePath($path = '/') {
@ -1196,7 +1199,7 @@ class View {
* @return \OC\User\User * @return \OC\User\User
*/ */
private function getUserObjectForOwner($ownerId) { private function getUserObjectForOwner($ownerId) {
$owner = \OC::$server->getUserManager()->get($ownerId); $owner = $this->userManager->get($ownerId);
if ($owner instanceof IUser) { if ($owner instanceof IUser) {
return $owner; return $owner;
} else { } else {