Cache usermanager instance in view

This commit is contained in:
Robin Appelman 2015-12-30 14:28:53 +01:00
parent 9c4ab51735
commit 2d9d0aedf8

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 {