summaryrefslogtreecommitdiffstats
path: root/lib/private/share/share.php
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2015-04-29 14:12:12 +0200
committerJoas Schilling <nickvergessen@owncloud.com>2015-04-29 14:12:12 +0200
commit3c37cbdfe7eb29db30dc5b9b62b7430f19419412 (patch)
tree20e875f93d9505ae572c8edf84bf87a92aba912b /lib/private/share/share.php
parent09d479e79d5cacfec9423d58a1ef411d2789e2a1 (diff)
downloadnextcloud-server-3c37cbdfe7eb29db30dc5b9b62b7430f19419412.tar.gz
nextcloud-server-3c37cbdfe7eb29db30dc5b9b62b7430f19419412.zip
Correctly select file cache values also when checking group shares
Diffstat (limited to 'lib/private/share/share.php')
-rw-r--r--lib/private/share/share.php14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/private/share/share.php b/lib/private/share/share.php
index 617eeeb9d90..d1facc961a5 100644
--- a/lib/private/share/share.php
+++ b/lib/private/share/share.php
@@ -333,15 +333,15 @@ class Share extends Constants {
$shares = array();
$fileDependent = false;
+ $where = 'WHERE';
+ $fileDependentWhere = '';
if ($itemType === 'file' || $itemType === 'folder') {
$fileDependent = true;
$column = 'file_source';
- $where = 'INNER JOIN `*PREFIX*filecache` ON `file_source` = `*PREFIX*filecache`.`fileid` ';
- $where .= 'INNER JOIN `*PREFIX*storages` ON `numeric_id` = `*PREFIX*filecache`.`storage` ';
- $where .= ' WHERE';
+ $fileDependentWhere = 'INNER JOIN `*PREFIX*filecache` ON `file_source` = `*PREFIX*filecache`.`fileid` ';
+ $fileDependentWhere .= 'INNER JOIN `*PREFIX*storages` ON `numeric_id` = `*PREFIX*filecache`.`storage` ';
} else {
$column = 'item_source';
- $where = 'WHERE';
}
$select = self::createSelectStatement(self::FORMAT_NONE, $fileDependent);
@@ -364,7 +364,7 @@ class Share extends Constants {
$arguments[] = $owner;
}
- $query = \OC_DB::prepare('SELECT ' . $select . ' FROM `*PREFIX*share` '. $where);
+ $query = \OC_DB::prepare('SELECT ' . $select . ' FROM `*PREFIX*share` '. $fileDependentWhere . $where);
$result = \OC_DB::executeAudited($query, $arguments);
@@ -380,7 +380,7 @@ class Share extends Constants {
$groups = \OC_Group::getUserGroups($user);
if (!empty($groups)) {
- $where = 'WHERE `' . $column . '` = ? AND `item_type` = ? AND `share_with` in (?)';
+ $where = $fileDependentWhere . ' WHERE `' . $column . '` = ? AND `item_type` = ? AND `share_with` in (?)';
$arguments = array($itemSource, $itemType, $groups);
$types = array(null, null, \Doctrine\DBAL\Connection::PARAM_STR_ARRAY);
@@ -394,7 +394,7 @@ class Share extends Constants {
// class isn't static anymore...
$conn = \OC_DB::getConnection();
$result = $conn->executeQuery(
- 'SELECT * FROM `*PREFIX*share` ' . $where,
+ 'SELECT ' . $select . ' FROM `*PREFIX*share` ' . $where,
$arguments,
$types
);