diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-07 21:37:36 +0400 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-07 21:37:36 +0400 |
commit | d6bb627a62d22c5c061dd30b6d77bde366dd82e6 (patch) | |
tree | 12779aa9d13b6552a908924dbfcd4e4c54b929c4 /lib | |
parent | 99914a44a54f4421d17e1621d6f2db248188cbe4 (diff) | |
parent | ef2eb10ea4ea66b5bcaf420aa38cdeae55b4636b (diff) |
Merge pull request #2173 from owncloud/fix-shared-storage
Fix fetching source path of shared files
Diffstat (limited to 'lib')
-rw-r--r-- | lib/files/mount.php | 26 | ||||
-rw-r--r-- | lib/files/view.php | 2 | ||||
-rw-r--r-- | lib/public/share.php | 2 |
3 files changed, 26 insertions, 4 deletions
diff --git a/lib/files/mount.php b/lib/files/mount.php index 6e99d8eabb4..1c9382d78e7 100644 --- a/lib/files/mount.php +++ b/lib/files/mount.php @@ -176,10 +176,12 @@ class Mount { } /** + * Find mounts by storage id + * * @param string $id - * @return \OC\Files\Storage\Storage[] + * @return Mount[] */ - public static function findById($id) { + public static function findByStorageId($id) { if (strlen($id) > 64) { $id = md5($id); } @@ -191,4 +193,24 @@ class Mount { } return $result; } + + /** + * Find mounts by numeric storage id + * + * @param string $id + * @return Mount + */ + public static function findByNumericId($id) { + $query = \OC_DB::prepare('SELECT `id` FROM `*PREFIX*storages` WHERE `numeric_id` = ?'); + $result = $query->execute(array($id))->fetchOne(); + if ($result) { + $id = $result; + foreach (self::$mounts as $mount) { + if ($mount->getStorageId() === $id) { + return $mount; + } + } + } + return false; + } } diff --git a/lib/files/view.php b/lib/files/view.php index 3e2cb080e1d..4ed3234552e 100644 --- a/lib/files/view.php +++ b/lib/files/view.php @@ -960,7 +960,7 @@ class View { */ public function getPath($id) { list($storage, $internalPath) = Cache\Cache::getById($id); - $mounts = Mount::findById($storage); + $mounts = Mount::findByStorageId($storage); foreach ($mounts as $mount) { /** * @var \OC\Files\Mount $mount diff --git a/lib/public/share.php b/lib/public/share.php index 8146a23f360..59f41a9bfd6 100644 --- a/lib/public/share.php +++ b/lib/public/share.php @@ -786,7 +786,7 @@ class Share { } else { $select = '`*PREFIX*share`.`id`, `item_type`, `item_source`, `item_target`, `*PREFIX*share`.`parent`, `share_type`, `share_with`, `uid_owner`, - `file_source`, `path`, `file_target`, `permissions`, `stime`, `expiration`, `token`'; + `file_source`, `path`, `file_target`, `permissions`, `stime`, `expiration`, `token`, `storage`'; } } else { $select = '*'; |