diff options
author | icewind1991 <icewind1991@gmail.com> | 2013-04-26 06:55:21 -0700 |
---|---|---|
committer | icewind1991 <icewind1991@gmail.com> | 2013-04-26 06:55:21 -0700 |
commit | 5474fea1f657b95f4007af6ef673862273f18e1c (patch) | |
tree | e4a86a03e66ead867df83b0f4267b936a2edeaec /lib/files/filesystem.php | |
parent | d825669265f0296b4981a99e31a78fb514ac1146 (diff) | |
parent | 809b5f81f6ee448563462ae8f642fbb8a6a11499 (diff) | |
download | nextcloud-server-5474fea1f657b95f4007af6ef673862273f18e1c.tar.gz nextcloud-server-5474fea1f657b95f4007af6ef673862273f18e1c.zip |
Merge pull request #3136 from owncloud/mount-cleanup
Separation of mount management
Diffstat (limited to 'lib/files/filesystem.php')
-rw-r--r-- | lib/files/filesystem.php | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/lib/files/filesystem.php b/lib/files/filesystem.php index 09732e67ac6..ad21a98fabc 100644 --- a/lib/files/filesystem.php +++ b/lib/files/filesystem.php @@ -34,6 +34,11 @@ const FREE_SPACE_UNKNOWN = -2; const FREE_SPACE_UNLIMITED = -3; class Filesystem { + /** + * @var Mount\Manager $mounts + */ + private static $mounts; + public static $loaded = false; /** * @var \OC\Files\View $defaultInstance @@ -147,7 +152,7 @@ class Filesystem { * @return string */ static public function getMountPoint($path) { - $mount = Mount::find($path); + $mount = self::$mounts->find($path); if ($mount) { return $mount->getMountPoint(); } else { @@ -163,7 +168,7 @@ class Filesystem { */ static public function getMountPoints($path) { $result = array(); - $mounts = Mount::findIn($path); + $mounts = self::$mounts->findIn($path); foreach ($mounts as $mount) { $result[] = $mount->getMountPoint(); } @@ -177,18 +182,34 @@ class Filesystem { * @return \OC\Files\Storage\Storage */ public static function getStorage($mountPoint) { - $mount = Mount::find($mountPoint); + $mount = self::$mounts->find($mountPoint); return $mount->getStorage(); } /** + * @param $id + * @return Mount\Mount[] + */ + public static function getMountByStorageId($id) { + return self::$mounts->findByStorageId($id); + } + + /** + * @param $id + * @return Mount\Mount[] + */ + public static function getMountByNumericId($id) { + return self::$mounts->findByStorageId($id); + } + + /** * resolve a path to a storage and internal path * * @param string $path * @return array consisting of the storage and the internal path */ static public function resolvePath($path) { - $mount = Mount::find($path); + $mount = self::$mounts->find($path); if ($mount) { return array($mount->getStorage(), $mount->getInternalPath($path)); } else { @@ -201,6 +222,7 @@ class Filesystem { return false; } self::$defaultInstance = new View($root); + self::$mounts = new Mount\Manager(); //load custom mount config self::initMountPoints($user); @@ -210,6 +232,10 @@ class Filesystem { return true; } + static public function initMounts(){ + self::$mounts = new Mount\Manager(); + } + /** * Initialize system and personal mount points for a user * @@ -328,7 +354,7 @@ class Filesystem { * clear all mounts and storage backends */ public static function clearMounts() { - Mount::clear(); + self::$mounts->clear(); } /** @@ -339,7 +365,8 @@ class Filesystem { * @param string $mountpoint */ static public function mount($class, $arguments, $mountpoint) { - new Mount($class, $mountpoint, $arguments); + $mount = new Mount\Mount($class, $mountpoint, $arguments); + self::$mounts->addMount($mount); } /** |