Merge pull request #26050 from nextcloud/view-search-reuse-usermanager

reuse usermanager instance when processing search results
This commit is contained in:
Vincent Petry 2021-03-11 10:27:30 +01:00 committed by GitHub
commit b78dc6a6bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -1643,6 +1643,7 @@ class View {
$mount = $this->getMount(''); $mount = $this->getMount('');
$mountPoint = $mount->getMountPoint(); $mountPoint = $mount->getMountPoint();
$storage = $mount->getStorage(); $storage = $mount->getStorage();
$userManager = \OC::$server->getUserManager();
if ($storage) { if ($storage) {
$cache = $storage->getCache(''); $cache = $storage->getCache('');
@ -1652,7 +1653,7 @@ class View {
$internalPath = $result['path']; $internalPath = $result['path'];
$path = $mountPoint . $result['path']; $path = $mountPoint . $result['path'];
$result['path'] = substr($mountPoint . $result['path'], $rootLength); $result['path'] = substr($mountPoint . $result['path'], $rootLength);
$owner = \OC::$server->getUserManager()->get($storage->getOwner($internalPath)); $owner = $userManager->get($storage->getOwner($internalPath));
$files[] = new FileInfo($path, $storage, $internalPath, $result, $mount, $owner); $files[] = new FileInfo($path, $storage, $internalPath, $result, $mount, $owner);
} }
} }
@ -1671,7 +1672,7 @@ class View {
$internalPath = $result['path']; $internalPath = $result['path'];
$result['path'] = rtrim($relativeMountPoint . $result['path'], '/'); $result['path'] = rtrim($relativeMountPoint . $result['path'], '/');
$path = rtrim($mountPoint . $internalPath, '/'); $path = rtrim($mountPoint . $internalPath, '/');
$owner = \OC::$server->getUserManager()->get($storage->getOwner($internalPath)); $owner = $userManager->get($storage->getOwner($internalPath));
$files[] = new FileInfo($path, $storage, $internalPath, $result, $mount, $owner); $files[] = new FileInfo($path, $storage, $internalPath, $result, $mount, $owner);
} }
} }