summaryrefslogtreecommitdiffstats
path: root/lib/files/filesystem.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/files/filesystem.php')
-rw-r--r--lib/files/filesystem.php39
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);
}
/**