Filesystem: add Mount::findById

remotes/origin/stable5
Robin Appelman 12 years ago
parent 03b947e3ec
commit 69f11151e9
  1. 18
      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;
}
}

Loading…
Cancel
Save