]> source.dussan.org Git - nextcloud-server.git/commitdiff
Mount personal mount points into filesystem
authorMichael Gapczynski <GapczynskiM@gmail.com>
Sun, 10 Jun 2012 20:34:21 +0000 (16:34 -0400)
committerMichael Gapczynski <GapczynskiM@gmail.com>
Sun, 10 Jun 2012 20:34:44 +0000 (16:34 -0400)
apps/files_external/lib/config.php
lib/util.php

index a87319d33b2fe1217bbe56e73464e659f2975549..56a61e9ab89f66d4ea20945fbc4c51a86da00d3c 100755 (executable)
@@ -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])) {
index 53096f029a2f664bb009839af5e8bc7284fd8253..7c85db71f5fed262277e1f24bf2120dd251c5bcb 100644 (file)
@@ -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);
+                                       }
+                               }
+                       }
                }
        }