mirror of https://github.com/nextcloud/server
type fixes
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
07a7dcb824
commit
917c74e214
|
@ -26,6 +26,7 @@
|
|||
*/
|
||||
namespace OCA\Files_Sharing;
|
||||
|
||||
use OC\Files\Mount\MountPoint;
|
||||
use OCP\Constants;
|
||||
use OCP\Share\IShare;
|
||||
|
||||
|
@ -105,6 +106,7 @@ class Updater {
|
|||
$mountManager = \OC\Files\Filesystem::getMountManager();
|
||||
$mountedShares = $mountManager->findIn('/' . \OC_User::getUser() . '/files/' . $oldPath);
|
||||
foreach ($mountedShares as $mount) {
|
||||
/** @var MountPoint $mount */
|
||||
if ($mount->getStorage()->instanceOfStorage(ISharedStorage::class)) {
|
||||
$mountPoint = $mount->getMountPoint();
|
||||
$target = str_replace($absOldPath, $absNewPath, $mountPoint);
|
||||
|
|
|
@ -51,7 +51,7 @@ class CappedMemoryCache implements ICache, \ArrayAccess {
|
|||
|
||||
/**
|
||||
* @param string $key
|
||||
* @param T$value
|
||||
* @param T $value
|
||||
* @param int $ttl
|
||||
* @return bool
|
||||
*/
|
||||
|
@ -89,7 +89,7 @@ class CappedMemoryCache implements ICache, \ArrayAccess {
|
|||
|
||||
/**
|
||||
* @param string $key
|
||||
* @param T$value
|
||||
* @param T $value
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value): void {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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 '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -27,6 +27,8 @@ use OCP\EventDispatcher\Event;
|
|||
|
||||
/**
|
||||
* Event fired after the filesystem has been torn down
|
||||
*
|
||||
* @since 24.0.0
|
||||
*/
|
||||
class FilesystemTornDownEvent extends Event {
|
||||
}
|
||||
|
|
|
@ -10,10 +10,6 @@ namespace Test\Files\Mount;
|
|||
|
||||
use OC\Files\SetupManagerFactory;
|
||||
use OC\Files\Storage\Temporary;
|
||||
use OCP\Diagnostics\IEventLogger;
|
||||
use OCP\EventDispatcher\IEventDispatcher;
|
||||
use OCP\Files\Config\IMountProviderCollection;
|
||||
use OCP\IUserManager;
|
||||
|
||||
class LongId extends Temporary {
|
||||
public function getId() {
|
||||
|
|
Loading…
Reference in New Issue