[Pkg-owncloud-commits] [owncloud] 55/67: check if mount point was already loaded to avoid redundant read operations

David Prévot taffit at alioth.debian.org
Fri Nov 8 23:10:44 UTC 2013


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag v4.5.1
in repository owncloud.

commit 71d33fa0656bce367133893275a5a48def659d81
Author: Björn Schießle <schiessle at owncloud.com>
Date:   Thu Oct 18 17:30:01 2012 +0200

    check if mount point was already loaded to avoid redundant read operations
---
 lib/filesystem.php |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lib/filesystem.php b/lib/filesystem.php
index 8afef05..8b44ab6 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);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list