aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Files/Cache/QuerySearchHelper.php
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2023-06-08 23:32:16 +0200
committerArthur Schiwon <blizzz@arthur-schiwon.de>2023-06-21 16:53:20 +0200
commitf6ac874dbf7d4e5cb2255f25464df214bb956ffb (patch)
treee3bcd4a4aa85e1f35af4124d3c578080c640954b /lib/private/Files/Cache/QuerySearchHelper.php
parent167a5f394d9baafaa450843f76864070412727ca (diff)
downloadnextcloud-server-f6ac874dbf7d4e5cb2255f25464df214bb956ffb.tar.gz
nextcloud-server-f6ac874dbf7d4e5cb2255f25464df214bb956ffb.zip
chore: ugly type juggling
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'lib/private/Files/Cache/QuerySearchHelper.php')
-rw-r--r--lib/private/Files/Cache/QuerySearchHelper.php18
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/private/Files/Cache/QuerySearchHelper.php b/lib/private/Files/Cache/QuerySearchHelper.php
index 52663213b16..b4376eb2d98 100644
--- a/lib/private/Files/Cache/QuerySearchHelper.php
+++ b/lib/private/Files/Cache/QuerySearchHelper.php
@@ -195,23 +195,33 @@ class QuerySearchHelper {
}
/**
- * @return array{array<string, ICache>, array<string, IMountPoint>}
+ * @return list{0?: array<array-key, ICache>, 1?: array<array-key, IMountPoint>}
*/
public function getCachesAndMountPointsForSearch(IRootFolder $root, string $path, bool $limitToHome = false): array {
$rootLength = strlen($path);
- $mount = $root->getMount($path);
- $storage = $mount->getStorage();
+ $storage = null;
+ if (method_exists($root, 'getMount')) {
+ /** @var IMountPoint $mount */
+ $mount = $root->getMount($path);
+ $storage = $mount->getStorage();
+ }
+ if ($storage === null) {
+ return [];
+ }
$internalPath = $mount->getInternalPath($path);
if ($internalPath !== '') {
// a temporary CacheJail is used to handle filtering down the results to within this folder
+ /** @var ICache[] $caches */
$caches = ['' => new CacheJail($storage->getCache(''), $internalPath)];
} else {
+ /** @var ICache[] $caches */
$caches = ['' => $storage->getCache('')];
}
+ /** @var IMountPoint[] $mountByMountPoint */
$mountByMountPoint = ['' => $mount];
- if (!$limitToHome) {
+ if (!$limitToHome && method_exists($root, 'getMountsIn')) {
/** @var IMountPoint[] $mounts */
$mounts = $root->getMountsIn($path);
foreach ($mounts as $mount) {