Skip to content

Commit

Permalink
reuse usermanager instance when processing search results
Browse files Browse the repository at this point in the history
saves some time when processing large search results

Signed-off-by: Robin Appelman <robin@icewind.nl>
  • Loading branch information
icewind1991 committed Mar 10, 2021
1 parent 62929cc commit f98fed3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/private/Files/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -1643,6 +1643,7 @@ private function searchCommon($method, $args) {
$mount = $this->getMount('');
$mountPoint = $mount->getMountPoint();
$storage = $mount->getStorage();
$userManager = \OC::$server->getUserManager();
if ($storage) {
$cache = $storage->getCache('');

Expand All @@ -1652,7 +1653,7 @@ private function searchCommon($method, $args) {
$internalPath = $result['path'];
$path = $mountPoint . $result['path'];
$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);
}
}
Expand All @@ -1671,7 +1672,7 @@ private function searchCommon($method, $args) {
$internalPath = $result['path'];
$result['path'] = rtrim($relativeMountPoint . $result['path'], '/');
$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);
}
}
Expand Down

0 comments on commit f98fed3

Please sign in to comment.