From 31d7f4df2a8870c288ed73a3a6c501d4b15365ea Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 25 Apr 2013 16:11:48 +0200 Subject: [PATCH 1/2] Make sure the filesystem is initialized when searching for mounts --- lib/files/mount.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/files/mount.php b/lib/files/mount.php index 59c98e9dcc8..0030d0ee7a6 100644 --- a/lib/files/mount.php +++ b/lib/files/mount.php @@ -136,6 +136,7 @@ class Mount { * @return Mount */ public static function find($path) { + \OC_Util::setupFS(); $path = self::formatPath($path); if (isset(self::$mounts[$path])) { return self::$mounts[$path]; @@ -163,6 +164,7 @@ class Mount { * @return Mount[] */ public static function findIn($path) { + \OC_Util::setupFS(); $path = self::formatPath($path); $result = array(); $pathLength = strlen($path); @@ -186,6 +188,7 @@ class Mount { * @return Mount[] */ public static function findByStorageId($id) { + \OC_Util::setupFS(); if (strlen($id) > 64) { $id = md5($id); } From cea56df59ec4530d78e66fd341738d77e0ab1745 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 25 Apr 2013 16:56:48 +0200 Subject: [PATCH 2/2] Have the filecache updater testcase clean the filesystem properly --- lib/files/filesystem.php | 1 + tests/lib/files/cache/updater.php | 9 +++------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/files/filesystem.php b/lib/files/filesystem.php index c0e9d215fb5..edd37d7b468 100644 --- a/lib/files/filesystem.php +++ b/lib/files/filesystem.php @@ -311,6 +311,7 @@ class Filesystem { */ static public function tearDown() { self::clearMounts(); + self::$defaultInstance = null; } /** diff --git a/tests/lib/files/cache/updater.php b/tests/lib/files/cache/updater.php index aaf932c97fe..dad3cd7e650 100644 --- a/tests/lib/files/cache/updater.php +++ b/tests/lib/files/cache/updater.php @@ -42,14 +42,11 @@ class Updater extends \PHPUnit_Framework_TestCase { $this->scanner->scan(''); $this->cache = $this->storage->getCache(); + \OC\Files\Filesystem::tearDown(); if (!self::$user) { - if (!\OC\Files\Filesystem::getView()) { - self::$user = uniqid(); - \OC\Files\Filesystem::init(self::$user, '/' . self::$user . '/files'); - } else { - self::$user = \OC_User::getUser(); - } + self::$user = uniqid(); } + \OC\Files\Filesystem::init(self::$user, '/' . self::$user . '/files'); Filesystem::clearMounts(); Filesystem::mount($this->storage, array(), '/' . self::$user . '/files');