summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2023-06-15 23:21:56 +0200
committerbackportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com>2023-06-23 23:04:44 +0000
commit2b27a4cda0b6e4cad87e817cb9601f1816320992 (patch)
tree36d4b2286e7b898851b5d1a84b10a1440424617f /lib/private
parent3813b955eeacded0c991befe7d1f49cbfc33ef30 (diff)
downloadnextcloud-server-2b27a4cda0b6e4cad87e817cb9601f1816320992.tar.gz
nextcloud-server-2b27a4cda0b6e4cad87e817cb9601f1816320992.zip
refactor: declare getMount() and getMountsIn() at IRootFolder
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/Files/Cache/QuerySearchHelper.php11
-rw-r--r--lib/private/Files/Node/Folder.php8
-rw-r--r--lib/private/Files/Node/LazyFolder.php7
-rw-r--r--lib/private/Files/Node/Root.php8
4 files changed, 11 insertions, 23 deletions
diff --git a/lib/private/Files/Cache/QuerySearchHelper.php b/lib/private/Files/Cache/QuerySearchHelper.php
index b4376eb2d98..75e203d5fd9 100644
--- a/lib/private/Files/Cache/QuerySearchHelper.php
+++ b/lib/private/Files/Cache/QuerySearchHelper.php
@@ -199,12 +199,8 @@ class QuerySearchHelper {
*/
public function getCachesAndMountPointsForSearch(IRootFolder $root, string $path, bool $limitToHome = false): array {
$rootLength = strlen($path);
- $storage = null;
- if (method_exists($root, 'getMount')) {
- /** @var IMountPoint $mount */
- $mount = $root->getMount($path);
- $storage = $mount->getStorage();
- }
+ $mount = $root->getMount($path);
+ $storage = $mount->getStorage();
if ($storage === null) {
return [];
}
@@ -221,8 +217,7 @@ class QuerySearchHelper {
/** @var IMountPoint[] $mountByMountPoint */
$mountByMountPoint = ['' => $mount];
- if (!$limitToHome && method_exists($root, 'getMountsIn')) {
- /** @var IMountPoint[] $mounts */
+ if (!$limitToHome) {
$mounts = $root->getMountsIn($path);
foreach ($mounts as $mount) {
$storage = $mount->getStorage();
diff --git a/lib/private/Files/Node/Folder.php b/lib/private/Files/Node/Folder.php
index 35ad668386e..3349ce8c243 100644
--- a/lib/private/Files/Node/Folder.php
+++ b/lib/private/Files/Node/Folder.php
@@ -329,12 +329,8 @@ class Folder extends Node implements \OCP\Files\Folder {
* @return array
*/
protected function getByIdInRootMount(int $id): array {
- $storage = null;
- if (\method_exists($this->root, 'getMount')) {
- /** @var IMountPoint $mount */
- $mount = $this->root->getMount('');
- $storage = $mount->getStorage();
- }
+ $mount = $this->root->getMount('');
+ $storage = $mount->getStorage();
$cacheEntry = $storage?->getCache($this->path)->get($id);
if (!$cacheEntry) {
return [];
diff --git a/lib/private/Files/Node/LazyFolder.php b/lib/private/Files/Node/LazyFolder.php
index cc1f64889a1..1b4bfe5b83d 100644
--- a/lib/private/Files/Node/LazyFolder.php
+++ b/lib/private/Files/Node/LazyFolder.php
@@ -28,6 +28,7 @@ namespace OC\Files\Node;
use OC\Files\Utils\PathHelper;
use OCP\Constants;
+use OCP\Files\Mount\IMountPoint;
/**
* Class LazyFolder
@@ -110,14 +111,14 @@ class LazyFolder implements \OCP\Files\Folder {
/**
* @inheritDoc
*/
- public function getMount($mountPoint) {
+ public function getMount(string $mountPoint): IMountPoint {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
- * @inheritDoc
+ * @return IMountPoint[]
*/
- public function getMountsIn($mountPoint) {
+ public function getMountsIn(string $mountPoint): array {
return $this->__call(__FUNCTION__, func_get_args());
}
diff --git a/lib/private/Files/Node/Root.php b/lib/private/Files/Node/Root.php
index 6f64d192dd6..46b120bdd74 100644
--- a/lib/private/Files/Node/Root.php
+++ b/lib/private/Files/Node/Root.php
@@ -154,11 +154,7 @@ class Root extends Folder implements IRootFolder {
$this->mountManager->addMount($mount);
}
- /**
- * @param string $mountPoint
- * @return \OC\Files\Mount\MountPoint
- */
- public function getMount($mountPoint) {
+ public function getMount(string $mountPoint): IMountPoint {
return $this->mountManager->find($mountPoint);
}
@@ -166,7 +162,7 @@ class Root extends Folder implements IRootFolder {
* @param string $mountPoint
* @return \OC\Files\Mount\MountPoint[]
*/
- public function getMountsIn($mountPoint) {
+ public function getMountsIn(string $mountPoint): array {
return $this->mountManager->findIn($mountPoint);
}