aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn Schießle <schiessle@owncloud.com>2012-10-18 17:30:01 +0200
committerBjörn Schießle <schiessle@owncloud.com>2012-10-18 17:30:01 +0200
commit08ee2fcf93322f2deba913b096e08277c37e1a94 (patch)
tree473b9e145405fd0ac51479091b852e0d9aac238c
parent65b0824d35db1e2288250533d8ea5fa820055ece (diff)
downloadnextcloud-server-08ee2fcf93322f2deba913b096e08277c37e1a94.tar.gz
nextcloud-server-08ee2fcf93322f2deba913b096e08277c37e1a94.zip
check if mount point was already loaded to avoid redundant read operations
-rw-r--r--lib/filesystem.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/filesystem.php b/lib/filesystem.php
index 8afef050832..8b44ab6e6c6 100644
--- a/lib/filesystem.php
+++ b/lib/filesystem.php
@@ -46,6 +46,7 @@
class OC_Filesystem{
static private $storages=array();
static private $mounts=array();
+ static private $loadedUsers=array();
public static $loaded=false;
/**
* @var OC_Filestorage $defaultInstance
@@ -178,6 +179,11 @@ class OC_Filesystem{
$internalPath=substr($path,strlen($mountPoint));
return $internalPath;
}
+
+ static private function mountPointsLoaded($user) {
+ return in_array($user, self::$loadedUsers);
+ }
+
/**
* get the storage object for a path
* @param string path
@@ -186,9 +192,10 @@ class OC_Filesystem{
static public function getStorage($path) {
$user = ltrim(substr($path, 0, strpos($path, '/', 1)), '/');
// check mount points if file was shared from a different user
- if ($user != OC_User::getUser()) {
+ if ($user != OC_User::getUser() && !self::mountPointsLoaded($user)) {
OC_Util::loadUserMountPoints($user);
self::loadSystemMountPoints($user);
+ self::$loadedUsers[] = $user;
}
$mountpoint=self::getMountPoint($path);