diff options
author | Vincent Petry <pvince81@owncloud.com> | 2013-11-12 18:46:01 +0400 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2013-11-12 21:01:02 +0400 |
commit | 34c92f665639baf6ea86a265855a2b2862755537 (patch) | |
tree | c8cc2b73f2cee74a449593673bf4213dbb4e81e7 /lib | |
parent | 1a65e3a72593a2eb343386e5008faea78f0b9c8f (diff) |
Now using HomeStorage for legacy home storage ids
Legacy home storage ids with the format "local://path/to/datadir/user1"
are now also wrapped by the HomeStorage.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/files/filesystem.php | 14 | ||||
-rw-r--r-- | lib/private/files/storage/home.php | 14 |
2 files changed, 24 insertions, 4 deletions
diff --git a/lib/private/files/filesystem.php b/lib/private/files/filesystem.php index e40502bbe64..899666f3e1a 100644 --- a/lib/private/files/filesystem.php +++ b/lib/private/files/filesystem.php @@ -307,10 +307,18 @@ class Filesystem { $root = \OC_User::getHome($user); $userObject = \OC_User::getManager()->get($user); - if (\OC\Files\Cache\Storage::exists('local::' . $root . '/') or is_null($userObject)) { + + if (!is_null($userObject)) { + // check for legacy home id (<= 5.0.12) + if (\OC\Files\Cache\Storage::exists('local::' . $root . '/')) { + self::mount('\OC\Files\Storage\Home', array('user' => $userObject, 'legacy' => true), $user); + } + else { + self::mount('\OC\Files\Storage\Home', array('user' => $userObject), $user); + } + } + else { self::mount('\OC\Files\Storage\Local', array('datadir' => $root), $user); - } else { - self::mount('\OC\Files\Storage\Home', array('user' => $userObject), $user); } $datadir = \OC_Config::getValue("datadirectory", \OC::$SERVERROOT . "/data"); diff --git a/lib/private/files/storage/home.php b/lib/private/files/storage/home.php index 22753519ad3..b4ceb8f4f9b 100644 --- a/lib/private/files/storage/home.php +++ b/lib/private/files/storage/home.php @@ -13,6 +13,11 @@ namespace OC\Files\Storage; */ class Home extends Local { /** + * @var string + */ + protected $id; + + /** * @var \OC\User\User $user */ protected $user; @@ -20,12 +25,19 @@ class Home extends Local { public function __construct($arguments) { $this->user = $arguments['user']; $datadir = $this->user->getHome(); + if (isset($arguments['legacy']) && $arguments['legacy']) { + // legacy home id (<= 5.0.12) + $this->id = 'local::' . $datadir . '/'; + } + else { + $this->id = 'home::' . $this->user->getUID(); + } parent::__construct(array('datadir' => $datadir)); } public function getId() { - return 'home::' . $this->user->getUID(); + return $this->id; } public function getCache($path = '') { |