summaryrefslogtreecommitdiffstats
path: root/lib/private/Files/Filesystem.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Files/Filesystem.php')
-rw-r--r--lib/private/Files/Filesystem.php45
1 files changed, 30 insertions, 15 deletions
diff --git a/lib/private/Files/Filesystem.php b/lib/private/Files/Filesystem.php
index 55cf38bbdc9..51e494c372e 100644
--- a/lib/private/Files/Filesystem.php
+++ b/lib/private/Files/Filesystem.php
@@ -62,6 +62,7 @@ use OC\Cache\CappedMemoryCache;
use OC\Files\Config\MountProviderCollection;
use OC\Files\Mount\MountPoint;
use OC\Files\Storage\StorageFactory;
+use OC\Lockdown\Filesystem\NullStorage;
use OCP\Files\Config\IMountProvider;
use OCP\Files\Mount\IMountPoint;
use OCP\Files\NotFoundException;
@@ -213,10 +214,13 @@ class Filesystem {
/**
* @param bool $shouldLog
+ * @return bool previous value
* @internal
*/
public static function logWarningWhenAddingStorageWrapper($shouldLog) {
+ $previousValue = self::$logWarningWhenAddingStorageWrapper;
self::$logWarningWhenAddingStorageWrapper = (bool) $shouldLog;
+ return $previousValue;
}
/**
@@ -225,7 +229,7 @@ class Filesystem {
* @param int $priority
*/
public static function addStorageWrapper($wrapperName, $wrapper, $priority = 50) {
- if (self::$logWarningWhenAddingStorageWrapper && $wrapperName !== 'readonly') {
+ if (self::$logWarningWhenAddingStorageWrapper) {
\OC::$server->getLogger()->warning("Storage wrapper '{wrapper}' was not registered via the 'OC_Filesystem - preSetup' hook which could cause potential problems.", [
'wrapper' => $wrapperName,
'app' => 'filesystem',
@@ -426,25 +430,36 @@ class Filesystem {
self::$usersSetup[$user] = true;
}
- /** @var \OC\Files\Config\MountProviderCollection $mountConfigManager */
- $mountConfigManager = \OC::$server->getMountProviderCollection();
+ if (\OC::$server->getLockdownManager()->canAccessFilesystem()) {
+ /** @var \OC\Files\Config\MountProviderCollection $mountConfigManager */
+ $mountConfigManager = \OC::$server->getMountProviderCollection();
- // home mounts are handled seperate since we need to ensure this is mounted before we call the other mount providers
- $homeMount = $mountConfigManager->getHomeMountForUser($userObject);
+ // home mounts are handled seperate since we need to ensure this is mounted before we call the other mount providers
+ $homeMount = $mountConfigManager->getHomeMountForUser($userObject);
- self::getMountManager()->addMount($homeMount);
+ self::getMountManager()->addMount($homeMount);
- \OC\Files\Filesystem::getStorage($user);
+ \OC\Files\Filesystem::getStorage($user);
- // Chance to mount for other storages
- if ($userObject) {
- $mounts = $mountConfigManager->getMountsForUser($userObject);
- array_walk($mounts, array(self::$mounts, 'addMount'));
- $mounts[] = $homeMount;
- $mountConfigManager->registerMounts($userObject, $mounts);
- }
+ // Chance to mount for other storages
+ if ($userObject) {
+ $mounts = $mountConfigManager->getMountsForUser($userObject);
+ array_walk($mounts, array(self::$mounts, 'addMount'));
+ $mounts[] = $homeMount;
+ $mountConfigManager->registerMounts($userObject, $mounts);
+ }
- self::listenForNewMountProviders($mountConfigManager, $userManager);
+ self::listenForNewMountProviders($mountConfigManager, $userManager);
+ } else {
+ self::getMountManager()->addMount(new MountPoint(
+ new NullStorage([]),
+ '/' . $user
+ ));
+ self::getMountManager()->addMount(new MountPoint(
+ new NullStorage([]),
+ '/' . $user . '/files'
+ ));
+ }
\OC_Hook::emit('OC_Filesystem', 'post_initMountPoints', array('user' => $user));
}