Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-03-07 21:37:36 +0400
committerBernhard Posselt <nukeawhale@gmail.com>2013-03-07 21:37:36 +0400
commitd6bb627a62d22c5c061dd30b6d77bde366dd82e6 (patch)
tree12779aa9d13b6552a908924dbfcd4e4c54b929c4 /lib
parent99914a44a54f4421d17e1621d6f2db248188cbe4 (diff)
parentef2eb10ea4ea66b5bcaf420aa38cdeae55b4636b (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.php26
-rw-r--r--lib/files/view.php2
-rw-r--r--lib/public/share.php2
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 = '*';