*/
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 [];
}
/** @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();
* @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 [];
use OC\Files\Utils\PathHelper;
use OCP\Files\Folder;
use OCP\Constants;
+use OCP\Files\Mount\IMountPoint;
/**
* Class LazyFolder
/**
* @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());
}
$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);
}
* @param string $mountPoint
* @return \OC\Files\Mount\MountPoint[]
*/
- public function getMountsIn($mountPoint) {
+ public function getMountsIn(string $mountPoint): array {
return $this->mountManager->findIn($mountPoint);
}
use OC\Hooks\Emitter;
use OC\User\NoUserException;
+use OCP\Files\Mount\IMountPoint;
/**
* Interface IRootFolder
* @since 24.0.0
*/
public function getByIdInPath(int $id, string $path);
+
+ /**
+ * @return IMountPoint[]
+ *
+ * @since 28.0.0
+ */
+ public function getMountsIn(string $mountPoint): array;
+
+ /**
+ * @since 28.0.0
+ */
+ public function getMount(string $mountPoint): IMountPoint;
}