summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/lib
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2015-08-05 15:41:29 +0200
committerRobin Appelman <icewind@owncloud.com>2015-08-06 14:30:36 +0200
commitb91f002bafcfed6654868c55f4946cddb9ad9783 (patch)
tree1bd6f2fc02867434a346c04eef0fe0664876856a /apps/files_sharing/lib
parentcb791c7fe28dc7f2cda469a1e9890f62d4202ef5 (diff)
downloadnextcloud-server-b91f002bafcfed6654868c55f4946cddb9ad9783.tar.gz
nextcloud-server-b91f002bafcfed6654868c55f4946cddb9ad9783.zip
just pass the share instead of searching for it
Diffstat (limited to 'apps/files_sharing/lib')
-rw-r--r--apps/files_sharing/lib/cache.php4
-rw-r--r--apps/files_sharing/lib/share/file.php26
-rw-r--r--apps/files_sharing/lib/sharedstorage.php4
3 files changed, 11 insertions, 23 deletions
diff --git a/apps/files_sharing/lib/cache.php b/apps/files_sharing/lib/cache.php
index 49f5a4e8e7c..a5d6474dc3c 100644
--- a/apps/files_sharing/lib/cache.php
+++ b/apps/files_sharing/lib/cache.php
@@ -60,7 +60,7 @@ class Shared_Cache extends Cache {
if ($target === false || $target === $this->storage->getMountPoint()) {
$target = '';
}
- $source = \OC_Share_Backend_File::getSource($target, $this->storage->getMountPoint(), $this->storage->getItemType());
+ $source = \OC_Share_Backend_File::getSource($target, $this->storage->getShare());
if (isset($source['path']) && isset($source['fileOwner'])) {
\OC\Files\Filesystem::initMountPoints($source['fileOwner']);
$mounts = \OC\Files\Filesystem::getMountByNumericId($source['storage']);
@@ -242,7 +242,7 @@ class Shared_Cache extends Cache {
*/
protected function getMoveInfo($path) {
$cache = $this->getSourceCache($path);
- $file = \OC_Share_Backend_File::getSource($path, $this->storage->getMountPoint(), $this->storage->getItemType());
+ $file = \OC_Share_Backend_File::getSource($path, $this->storage->getShare());
return [$cache->getNumericStorageId(), $file['path']];
}
diff --git a/apps/files_sharing/lib/share/file.php b/apps/files_sharing/lib/share/file.php
index 1822c2468f1..82ef49beac9 100644
--- a/apps/files_sharing/lib/share/file.php
+++ b/apps/files_sharing/lib/share/file.php
@@ -206,27 +206,15 @@ class OC_Share_Backend_File implements OCP\Share_Backend_File_Dependent {
/**
* @param string $target
- * @param string $mountPoint
- * @param string $itemType
+ * @param array $share
* @return array|false source item
*/
- public static function getSource($target, $mountPoint, $itemType) {
- if ($itemType === 'folder') {
- $source = \OCP\Share::getItemSharedWith('folder', $mountPoint, \OC_Share_Backend_File::FORMAT_SHARED_STORAGE);
- if ($source && $target !== '') {
- // note: in case of ext storage mount points the path might be empty
- // which would cause a leading slash to appear
- $source['path'] = ltrim($source['path'] . '/' . $target, '/');
- }
- } else {
- $source = \OCP\Share::getItemSharedWith('file', $mountPoint, \OC_Share_Backend_File::FORMAT_SHARED_STORAGE);
- }
- if ($source) {
- return self::resolveReshares($source);
+ public static function getSource($target, $share) {
+ if ($share['item_type'] === 'folder' && $target !== '') {
+ // note: in case of ext storage mount points the path might be empty
+ // which would cause a leading slash to appear
+ $share['path'] = ltrim($share['path'] . '/' . $target, '/');
}
-
- \OCP\Util::writeLog('files_sharing', 'File source not found for: '.$target, \OCP\Util::DEBUG);
- return false;
+ return self::resolveReshares($share);
}
-
}
diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php
index ff01489d77b..66803db1425 100644
--- a/apps/files_sharing/lib/sharedstorage.php
+++ b/apps/files_sharing/lib/sharedstorage.php
@@ -83,14 +83,14 @@ class Shared extends \OC\Files\Storage\Common implements ISharedStorage {
if (!isset($this->files[$target])) {
// Check for partial files
if (pathinfo($target, PATHINFO_EXTENSION) === 'part') {
- $source = \OC_Share_Backend_File::getSource(substr($target, 0, -5), $this->getMountPoint(), $this->getItemType());
+ $source = \OC_Share_Backend_File::getSource(substr($target, 0, -5), $this->getShare());
if ($source) {
$source['path'] .= '.part';
// All partial files have delete permission
$source['permissions'] |= \OCP\Constants::PERMISSION_DELETE;
}
} else {
- $source = \OC_Share_Backend_File::getSource($target, $this->getMountPoint(), $this->getItemType());
+ $source = \OC_Share_Backend_File::getSource($target, $this->getShare());
}
$this->files[$target] = $source;
}