From 69f11151e90f0a17b02e58f7f94ca7f7a521f13a Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sat, 26 Jan 2013 23:49:05 +0100 Subject: [PATCH] Filesystem: add Mount::findById --- lib/files/mount.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/files/mount.php b/lib/files/mount.php index c6746d2a33..e28b6471fe 100644 --- a/lib/files/mount.php +++ b/lib/files/mount.php @@ -9,6 +9,9 @@ namespace OC\Files; class Mount { + /** + * @var Mount[] + */ static private $mounts = array(); /** @@ -23,7 +26,7 @@ class Mount { /** * @param string|\OC\Files\Storage\Storage $storage * @param string $mountpoint - * @param array $arguments + * @param array $arguments (optional) */ public function __construct($storage, $mountpoint, $arguments = null) { if (is_null($arguments)) { @@ -168,4 +171,17 @@ class Mount { public static function clear() { self::$mounts = array(); } + + /** + * @param string $id + * @return \OC\Files\Storage\Storage + */ + public static function findById($id) { + foreach (self::$mounts as $mount) { + if ($mount->getStorageId() === $id) { + return $mount; + } + } + return null; + } }