mirror of
https://github.com/nextcloud/server.git
synced 2024-07-30 20:16:04 +02:00
Do not query when the list is empty
This commit is contained in:
parent
015b9b1dac
commit
d418e176ce
@ -210,21 +210,23 @@ class Share extends \OC\Share\Constants {
|
|||||||
$fileTargetIDs = array_keys($fileTargets);
|
$fileTargetIDs = array_keys($fileTargets);
|
||||||
$fileTargetIDs = array_unique($fileTargetIDs);
|
$fileTargetIDs = array_unique($fileTargetIDs);
|
||||||
|
|
||||||
$query = \OC_DB::prepare(
|
if (!empty($fileTargetIDs)) {
|
||||||
'SELECT `fileid`, `path`
|
$query = \OC_DB::prepare(
|
||||||
FROM `*PREFIX*filecache`
|
'SELECT `fileid`, `path`
|
||||||
WHERE `fileid` IN (' . implode(',', $fileTargetIDs) . ')'
|
FROM `*PREFIX*filecache`
|
||||||
);
|
WHERE `fileid` IN (' . implode(',', $fileTargetIDs) . ')'
|
||||||
$result = $query->execute();
|
);
|
||||||
|
$result = $query->execute();
|
||||||
|
|
||||||
if (\OCP\DB::isError($result)) {
|
if (\OCP\DB::isError($result)) {
|
||||||
\OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage($result), \OC_Log::ERROR);
|
\OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage($result), \OC_Log::ERROR);
|
||||||
} else {
|
} else {
|
||||||
while ($row = $result->fetchRow()) {
|
while ($row = $result->fetchRow()) {
|
||||||
foreach ($fileTargets[$row['fileid']] as $uid => $shareData) {
|
foreach ($fileTargets[$row['fileid']] as $uid => $shareData) {
|
||||||
$sharedPath = '/Shared' . $shareData['file_target'];
|
$sharedPath = '/Shared' . $shareData['file_target'];
|
||||||
$sharedPath .= substr($path, strlen($row['path']) -5);
|
$sharedPath .= substr($path, strlen($row['path']) -5);
|
||||||
$sharePaths[$uid] = $sharedPath;
|
$sharePaths[$uid] = $sharedPath;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user