aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Files
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2022-03-03 17:15:02 +0100
committerRobin Appelman <robin@icewind.nl>2022-03-04 16:30:16 +0100
commit917c74e214094e321ff96e1aa067ae60d22e2c58 (patch)
tree1b0c418966bec4c28785d1191a676310923c1180 /lib/private/Files
parent07a7dcb8249c9e25ea7a702e8c932520e2b32de6 (diff)
downloadnextcloud-server-917c74e214094e321ff96e1aa067ae60d22e2c58.tar.gz
nextcloud-server-917c74e214094e321ff96e1aa067ae60d22e2c58.zip
type fixes
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/Files')
-rw-r--r--lib/private/Files/Filesystem.php16
-rw-r--r--lib/private/Files/Mount/Manager.php8
-rw-r--r--lib/private/Files/Node/Root.php10
-rw-r--r--lib/private/Files/SetupManager.php6
-rw-r--r--lib/private/Files/View.php16
5 files changed, 17 insertions, 39 deletions
diff --git a/lib/private/Files/Filesystem.php b/lib/private/Files/Filesystem.php
index b392b1aa3cb..1aedad93aa1 100644
--- a/lib/private/Files/Filesystem.php
+++ b/lib/private/Files/Filesystem.php
@@ -38,16 +38,12 @@
namespace OC\Files;
use OC\Cache\CappedMemoryCache;
-use OC\Files\Config\MountProviderCollection;
use OC\Files\Mount\MountPoint;
-use OC\Lockdown\Filesystem\NullStorage;
use OC\User\NoUserException;
use OCP\EventDispatcher\IEventDispatcher;
-use OCP\Files\Config\IMountProvider;
use OCP\Files\Events\Node\FilesystemTornDownEvent;
use OCP\Files\NotFoundException;
use OCP\Files\Storage\IStorageFactory;
-use OCP\ILogger;
use OCP\IUser;
use OCP\IUserManager;
@@ -262,11 +258,7 @@ class Filesystem {
\OC_Util::setupFS();
}
$mount = self::$mounts->find($path);
- if ($mount) {
- return $mount->getMountPoint();
- } else {
- return '';
- }
+ return $mount->getMountPoint();
}
/**
@@ -322,11 +314,7 @@ class Filesystem {
*/
public static function resolvePath($path) {
$mount = self::getMountManager()->find($path);
- if ($mount) {
- return [$mount->getStorage(), rtrim($mount->getInternalPath($path), '/')];
- } else {
- return [null, null];
- }
+ return [$mount->getStorage(), rtrim($mount->getInternalPath($path), '/')];
}
public static function init($user, $root) {
diff --git a/lib/private/Files/Mount/Manager.php b/lib/private/Files/Mount/Manager.php
index 5544b218658..66832690363 100644
--- a/lib/private/Files/Mount/Manager.php
+++ b/lib/private/Files/Mount/Manager.php
@@ -105,10 +105,8 @@ class Manager implements IMountManager {
if (isset($this->mounts[$mountPoint])) {
$this->pathCache[$path] = $this->mounts[$mountPoint];
return $this->mounts[$mountPoint];
- }
-
- if ($current === '') {
- throw new NotFoundException("No mount for path " . $path . " existing mounts: " . implode(",", array_keys($this->mounts)));
+ } elseif ($current === '') {
+ break;
}
$current = dirname($current);
@@ -116,6 +114,8 @@ class Manager implements IMountManager {
$current = '';
}
}
+
+ throw new NotFoundException("No mount for path " . $path . " existing mounts: " . implode(",", array_keys($this->mounts)));
}
/**
diff --git a/lib/private/Files/Node/Root.php b/lib/private/Files/Node/Root.php
index 4e4dc0ec0de..88ac4a31d34 100644
--- a/lib/private/Files/Node/Root.php
+++ b/lib/private/Files/Node/Root.php
@@ -271,21 +271,21 @@ class Root extends Folder implements IRootFolder {
* @return int
*/
public function getId() {
- return null;
+ return 0;
}
/**
* @return array
*/
public function stat() {
- return null;
+ return [];
}
/**
* @return int
*/
public function getMTime() {
- return null;
+ return 0;
}
/**
@@ -293,14 +293,14 @@ class Root extends Folder implements IRootFolder {
* @return int
*/
public function getSize($includeMounts = true) {
- return null;
+ return 0;
}
/**
* @return string
*/
public function getEtag() {
- return null;
+ return '';
}
/**
diff --git a/lib/private/Files/SetupManager.php b/lib/private/Files/SetupManager.php
index 853c50884a2..f9276ef4171 100644
--- a/lib/private/Files/SetupManager.php
+++ b/lib/private/Files/SetupManager.php
@@ -41,13 +41,11 @@ use OCP\Constants;
use OCP\Diagnostics\IEventLogger;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\Config\IMountProvider;
-use OCP\Files\Config\IMountProviderCollection;
use OCP\Files\Config\IUserMountCache;
use OCP\Files\Events\Node\FilesystemTornDownEvent;
use OCP\Files\Mount\IMountManager;
use OCP\Files\Mount\IMountPoint;
use OCP\Files\Storage\IStorage;
-use OCP\ILogger;
use OCP\IUser;
use OCP\IUserManager;
use OCP\Lockdown\ILockdownManager;
@@ -55,7 +53,7 @@ use OCP\Lockdown\ILockdownManager;
class SetupManager {
private bool $rootSetup = false;
private IEventLogger $eventLogger;
- private IMountProviderCollection $mountProviderCollection;
+ private MountProviderCollection $mountProviderCollection;
private IMountManager $mountManager;
private IUserManager $userManager;
private array $setupUsers = [];
@@ -66,7 +64,7 @@ class SetupManager {
public function __construct(
IEventLogger $eventLogger,
- IMountProviderCollection $mountProviderCollection,
+ MountProviderCollection $mountProviderCollection,
IMountManager $mountManager,
IUserManager $userManager,
IEventDispatcher $eventDispatcher,
diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php
index 6f96f911785..779e0611591 100644
--- a/lib/private/Files/View.php
+++ b/lib/private/Files/View.php
@@ -274,7 +274,7 @@ class View {
/**
* remove mount point
*
- * @param \OC\Files\Mount\MoveableMount $mount
+ * @param IMountPoint $mount
* @param string $path relative to data/
* @return boolean
*/
@@ -719,7 +719,7 @@ class View {
$postFix = (substr($path, -1) === '/') ? '/' : '';
$absolutePath = Filesystem::normalizePath($this->getAbsolutePath($path));
$mount = Filesystem::getMountManager()->find($absolutePath . $postFix);
- if ($mount and $mount->getInternalPath($absolutePath) === '') {
+ if ($mount->getInternalPath($absolutePath) === '') {
return $this->removeMount($mount, $absolutePath);
}
if ($this->is_dir($path)) {
@@ -1383,10 +1383,6 @@ class View {
$path = Filesystem::normalizePath($this->fakeRoot . '/' . $path);
$mount = Filesystem::getMountManager()->find($path);
- if (!$mount) {
- \OC::$server->getLogger()->warning('Mountpoint not found for path: ' . $path);
- return false;
- }
$storage = $mount->getStorage();
$internalPath = $mount->getInternalPath($path);
if ($storage) {
@@ -1488,7 +1484,7 @@ class View {
$rootEntry = $subCache->get('');
if (!$rootEntry) {
- $subScanner = $subStorage->getScanner('');
+ $subScanner = $subStorage->getScanner();
try {
$subScanner->scanFile('');
} catch (\OCP\Files\StorageNotAvailableException $e) {
@@ -1916,14 +1912,10 @@ class View {
* @param string $absolutePath absolute path
* @param bool $useParentMount true to return parent mount instead of whatever
* is mounted directly on the given path, false otherwise
- * @return \OC\Files\Mount\MountPoint mount point for which to apply locks
+ * @return IMountPoint mount point for which to apply locks
*/
private function getMountForLock($absolutePath, $useParentMount = false) {
- $results = [];
$mount = Filesystem::getMountManager()->find($absolutePath);
- if (!$mount) {
- return $results;
- }
if ($useParentMount) {
// find out if something is mounted directly on the path