Skip to content

Commit

Permalink
Merge pull request #15799 from nextcloud/backport/15776/stable16
Browse files Browse the repository at this point in the history
[stable16] search files by id in shared storages last
  • Loading branch information
MorrisJobke authored May 31, 2019
2 parents 538a710 + 4488293 commit 62e2ce0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/private/Files/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
use OC\Files\Mount\MoveableMount;
use OC\Files\Storage\Storage;
use OC\User\User;
use OCA\Files_Sharing\SharedMount;
use OCP\Constants;
use OCP\Files\Cache\ICacheEntry;
use OCP\Files\EmptyFileNameException;
Expand Down Expand Up @@ -1718,6 +1719,13 @@ public function getPath($id) {
// reverse the array so we start with the storage this view is in
// which is the most likely to contain the file we're looking for
$mounts = array_reverse($mounts);

// put non shared mounts in front of the shared mount
// this prevent unneeded recursion into shares
usort($mounts, function(IMountPoint $a, IMountPoint $b) {
return $a instanceof SharedMount && (!$b instanceof SharedMount) ? 1 : -1;
});

foreach ($mounts as $mount) {
/**
* @var \OC\Files\Mount\MountPoint $mount
Expand Down

0 comments on commit 62e2ce0

Please sign in to comment.