Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2022-01-31 17:53:28 +0300
committerRobin Appelman <robin@icewind.nl>2022-02-09 18:01:21 +0300
commit0217949715ecbb45982967523c2b4bf9fb53375b (patch)
tree798ac90d8b4654612a3b0da3422f8c747a4587cb /lib/private/Files
parent17e7a7ba17da9420a4dee66fdc78df50ef80105f (diff)
only setup part of the filesystem for appdata requests
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/Files')
-rw-r--r--lib/private/Files/Filesystem.php24
-rw-r--r--lib/private/Files/Mount/Manager.php13
2 files changed, 16 insertions, 21 deletions
diff --git a/lib/private/Files/Filesystem.php b/lib/private/Files/Filesystem.php
index fb300134c86..980fdef6831 100644
--- a/lib/private/Files/Filesystem.php
+++ b/lib/private/Files/Filesystem.php
@@ -240,9 +240,7 @@ class Filesystem {
* @return \OC\Files\Mount\Manager
*/
public static function getMountManager($user = '') {
- if (!self::$mounts) {
- \OC_Util::setupFS($user);
- }
+ self::initMountManager();
return self::$mounts;
}
@@ -292,10 +290,7 @@ class Filesystem {
* @return \OC\Files\Storage\Storage|null
*/
public static function getStorage($mountPoint) {
- if (!self::$mounts) {
- \OC_Util::setupFS();
- }
- $mount = self::$mounts->find($mountPoint);
+ $mount = self::getMountManager()->find($mountPoint);
return $mount->getStorage();
}
@@ -304,10 +299,7 @@ class Filesystem {
* @return Mount\MountPoint[]
*/
public static function getMountByStorageId($id) {
- if (!self::$mounts) {
- \OC_Util::setupFS();
- }
- return self::$mounts->findByStorageId($id);
+ return self::getMountManager()->findByStorageId($id);
}
/**
@@ -315,10 +307,7 @@ class Filesystem {
* @return Mount\MountPoint[]
*/
public static function getMountByNumericId($id) {
- if (!self::$mounts) {
- \OC_Util::setupFS();
- }
- return self::$mounts->findByNumericId($id);
+ return self::getMountManager()->findByNumericId($id);
}
/**
@@ -328,10 +317,7 @@ class Filesystem {
* @return array an array consisting of the storage and the internal path
*/
public static function resolvePath($path) {
- if (!self::$mounts) {
- \OC_Util::setupFS();
- }
- $mount = self::$mounts->find($path);
+ $mount = self::getMountManager()->find($path);
if ($mount) {
return [$mount->getStorage(), rtrim($mount->getInternalPath($path), '/')];
} else {
diff --git a/lib/private/Files/Mount/Manager.php b/lib/private/Files/Mount/Manager.php
index d9abab8997a..8c6f1acceec 100644
--- a/lib/private/Files/Mount/Manager.php
+++ b/lib/private/Files/Mount/Manager.php
@@ -81,6 +81,15 @@ class Manager implements IMountManager {
$this->inPathCache->clear();
}
+ private function setupForFind(string $path) {
+ if (strpos($path, '/appdata_' . \OC_Util::getInstanceId()) === 0) {
+ // for appdata, we only setup the root bits, not the user bits
+ \OC_Util::setupRootFS();
+ } else {
+ \OC_Util::setupFS();
+ }
+ }
+
/**
* Find the mount for $path
*
@@ -88,7 +97,7 @@ class Manager implements IMountManager {
* @return MountPoint|null
*/
public function find(string $path) {
- \OC_Util::setupFS();
+ $this->setupForFind($path);
$path = Filesystem::normalizePath($path);
if (isset($this->pathCache[$path])) {
@@ -121,7 +130,7 @@ class Manager implements IMountManager {
* @return MountPoint[]
*/
public function findIn(string $path): array {
- \OC_Util::setupFS();
+ $this->setupForFind($path);
$path = $this->formatPath($path);
if (isset($this->inPathCache[$path])) {