summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/lib
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2014-08-07 13:40:17 +0200
committerRobin Appelman <icewind@owncloud.com>2014-08-07 13:40:17 +0200
commitf1091280de5bca203e3233206e75c0c7421065c1 (patch)
treea9b4165a405bff7d57de84607e996bddcb534a9b /apps/files_sharing/lib
parent9e6b65fabe959706cca4342d650dc1a028d06ac3 (diff)
parenteb8683e6eeb0baa81395118f261cbfe6f002f411 (diff)
downloadnextcloud-server-f1091280de5bca203e3233206e75c0c7421065c1.tar.gz
nextcloud-server-f1091280de5bca203e3233206e75c0c7421065c1.zip
Merge pull request #10184 from owncloud/getbyid-node
Fix Folder::getById
Diffstat (limited to 'apps/files_sharing/lib')
-rw-r--r--apps/files_sharing/lib/cache.php24
1 files changed, 5 insertions, 19 deletions
diff --git a/apps/files_sharing/lib/cache.php b/apps/files_sharing/lib/cache.php
index 7f7197307bd..e4fd85fd2a7 100644
--- a/apps/files_sharing/lib/cache.php
+++ b/apps/files_sharing/lib/cache.php
@@ -43,6 +43,7 @@ class Shared_Cache extends Cache {
/**
* Get the source cache of a shared file or folder
+ *
* @param string $target Shared target file path
* @return \OC\Files\Cache\Cache
*/
@@ -275,7 +276,7 @@ class Shared_Cache extends Cache {
*/
public function search($pattern) {
- $pattern = trim($pattern,'%');
+ $pattern = trim($pattern, '%');
$normalizedPattern = $this->normalize($pattern);
@@ -403,8 +404,7 @@ class Shared_Cache extends Cache {
*/
public function getPathById($id, $pathEnd = '') {
// direct shares are easy
- $path = $this->getShareById($id);
- if (is_string($path)) {
+ if ($id === $this->storage->getSourceId()) {
return ltrim($pathEnd, '/');
} else {
// if the item is a direct share we try and get the path of the parent and append the name of the item to it
@@ -419,28 +419,14 @@ class Shared_Cache extends Cache {
/**
* @param integer $id
- */
- private function getShareById($id) {
- $item = \OCP\Share::getItemSharedWithBySource('file', $id);
- if ($item) {
- return trim($item['file_target'], '/');
- }
- $item = \OCP\Share::getItemSharedWithBySource('folder', $id);
- if ($item) {
- return trim($item['file_target'], '/');
- }
- return null;
- }
-
- /**
- * @param integer $id
+ * @return array
*/
private function getParentInfo($id) {
$sql = 'SELECT `parent`, `name` FROM `*PREFIX*filecache` WHERE `fileid` = ?';
$query = \OC_DB::prepare($sql);
$result = $query->execute(array($id));
if ($row = $result->fetchRow()) {
- return array($row['parent'], $row['name']);
+ return array((int)$row['parent'], $row['name']);
} else {
return array(-1, '');
}