[Pkg-owncloud-commits] [owncloud] 52/67: check for mount points if file was shared from a different user

David Prévot taffit at alioth.debian.org
Fri Nov 8 23:10:43 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 f5c6a22f17b504acfe41aca0a892351cc17594d7
Author: Björn Schießle <schiessle at owncloud.com>
Date:   Thu Oct 18 16:38:36 2012 +0200

    check for mount points if file was shared from a different user
---
 lib/filesystem.php |    6 ++++++
 lib/util.php       |   37 ++++++++++++++++++++++---------------
 2 files changed, 28 insertions(+), 15 deletions(-)

diff --git a/lib/filesystem.php b/lib/filesystem.php
index da524d7..5dc4b2f 100644
--- a/lib/filesystem.php
+++ b/lib/filesystem.php
@@ -184,6 +184,12 @@ class OC_Filesystem{
 	* @return OC_Filestorage
 	*/
 	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()) {
+			OC_Util::loadMountPoints($user);
+		}
+
 		$mountpoint=self::getMountPoint($path);
 		if($mountpoint) {
 			if(!isset(OC_Filesystem::$storages[$mountpoint])) {
diff --git a/lib/util.php b/lib/util.php
index 1471b0c..135465c 100755
--- a/lib/util.php
+++ b/lib/util.php
@@ -53,21 +53,7 @@ class OC_Util {
 			OC_FileProxy::register($quotaProxy);
 			OC_FileProxy::register($fileOperationProxy);
 			// Load personal mount config
-			if (is_file($user_root.'/mount.php')) {
-				$mountConfig = include($user_root.'/mount.php');
-				if (isset($mountConfig['user'][$user])) {
-					foreach ($mountConfig['user'][$user] as $mountPoint => $options) {
-						OC_Filesystem::mount($options['class'], $options['options'], $mountPoint);
-					}
-				}
-
-				$mtime=filemtime($user_root.'/mount.php');
-				$previousMTime=OC_Preferences::getValue($user,'files','mountconfigmtime',0);
-				if($mtime>$previousMTime) {//mount config has changed, filecache needs to be updated
-					OC_FileCache::triggerUpdate($user);
-					OC_Preferences::setValue($user,'files','mountconfigmtime',$mtime);
-				}
-			}
+			self::loadMountPoints($user);
 			OC_Hook::emit('OC_Filesystem', 'setup', array('user' => $user, 'user_dir' => $user_dir));
 		}
 	}
@@ -76,6 +62,27 @@ class OC_Util {
 		OC_Filesystem::tearDown();
 		self::$fsSetup=false;
 	}
+	
+	public static function loadMountPoints($user) {
+		$user_dir = '/'.$user.'/files';
+		$user_root = OC_User::getHome($user);
+		$userdirectory = $user_root . '/files';
+		if (is_file($user_root.'/mount.php')) {
+			$mountConfig = include($user_root.'/mount.php');
+			if (isset($mountConfig['user'][$user])) {
+				foreach ($mountConfig['user'][$user] as $mountPoint => $options) {
+					OC_Filesystem::mount($options['class'], $options['options'], $mountPoint);
+				}
+			}
+		
+			$mtime=filemtime($user_root.'/mount.php');
+			$previousMTime=OC_Preferences::getValue($user,'files','mountconfigmtime',0);
+			if($mtime>$previousMTime) {//mount config has changed, filecache needs to be updated
+				OC_FileCache::triggerUpdate($user);
+				OC_Preferences::setValue($user,'files','mountconfigmtime',$mtime);
+			}
+		}		
+	}
 
 	/**
 	 * get the current installed version of ownCloud

-- 
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