From 3c57fb935bec7b431596c8aec3f344df7dba354a Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Sun, 10 Jun 2012 16:34:21 -0400 Subject: [PATCH] Mount personal mount points into filesystem --- apps/files_external/lib/config.php | 9 ++++++--- lib/util.php | 9 +++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/apps/files_external/lib/config.php b/apps/files_external/lib/config.php index a87319d33b..56a61e9ab8 100755 --- a/apps/files_external/lib/config.php +++ b/apps/files_external/lib/config.php @@ -98,8 +98,8 @@ class OC_Mount_Config { $personal = array(); if (isset($mountPoints[self::MOUNT_TYPE_USER][$uid])) { foreach ($mountPoints[self::MOUNT_TYPE_USER][$uid] as $mountPoint => $mount) { - // Remove '/$user/files/' from mount point - $personal[substr($mountPoint, 13)] = array('class' => $mount['class'], 'backend' => $backends[$mount['class']]['backend'], 'configuration' => $mount['options']); + // Remove '/uid/files/' from mount point + $personal[substr($mountPoint, strlen($uid) + 8)] = array('class' => $mount['class'], 'backend' => $backends[$mount['class']]['backend'], 'configuration' => $mount['options']); } } return $personal; @@ -123,8 +123,11 @@ class OC_Mount_Config { if ($applicable != OCP\User::getUser() || $class == 'OC_Filestorage_Local') { return false; } + $mountPoint = '/'.$applicable.'/files/'.ltrim($mountPoint, '/'); + } else { + $mountPoint = '/$user/files/'.ltrim($mountPoint, '/'); } - $mount = array($applicable => array('/$user/files/'.$mountPoint => array('class' => $class, 'options' => $classOptions))); + $mount = array($applicable => array($mountPoint => array('class' => $class, 'options' => $classOptions))); $mountPoints = self::readData($isPersonal); // Merge the new mount point into the current mount points if (isset($mountPoints[$mountType])) { diff --git a/lib/util.php b/lib/util.php index 53096f029a..7c85db71f5 100644 --- a/lib/util.php +++ b/lib/util.php @@ -70,6 +70,15 @@ class OC_Util { $quotaProxy=new OC_FileProxy_Quota(); OC_FileProxy::register($quotaProxy); self::$fsSetup=true; + // Load personal mount config + if (is_file($CONFIG_DATADIRECTORY_ROOT.'/'.$user.'/mount.php')) { + $mountConfig = include($CONFIG_DATADIRECTORY_ROOT.'/'.$user.'/mount.php'); + if (isset($mountConfig['user'][$user])) { + foreach ($mountConfig['user'][$user] as $mountPoint => $options) { + OC_Filesystem::mount($options['class'], $options['options'], $mountPoint); + } + } + } } }