summaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
authorBjörn Schießle <schiessle@owncloud.com>2013-05-29 14:40:47 +0200
committerBjörn Schießle <schiessle@owncloud.com>2013-05-29 14:40:47 +0200
commit63a2bec6e53e0a7db70599334914625a72015f08 (patch)
treee175cf97022dd71f7289bc6d3ae04c27e0a0d2db /lib/public
parent893a1ed6f57966dcf5270837f121118c5e13c457 (diff)
downloadnextcloud-server-63a2bec6e53e0a7db70599334914625a72015f08.tar.gz
nextcloud-server-63a2bec6e53e0a7db70599334914625a72015f08.zip
use public API for error handling; improved while condition
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/share.php43
1 files changed, 20 insertions, 23 deletions
diff --git a/lib/public/share.php b/lib/public/share.php
index 19f7b2a20a9..2b7bf59219f 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -143,7 +143,7 @@ class Share {
$parent = $meta['parent'];
$cache = new \OC\Files\Cache\Cache($meta['storage']);
- while ($path !== 'files' && $parent !== '-1') {
+ while ($parent !== '-1') {
// Fetch all shares of this file path from DB
$query = \OC_DB::prepare(
@@ -156,14 +156,13 @@ class Share {
$result = $query->execute(array($source, self::SHARE_TYPE_USER));
- if (\OC_DB::isError($result)) {
- \OC_Log::write('OCP\Share', \OC_DB::getErrorMessage($result), \OC_Log::ERROR);
- }
-
- while ($row = $result->fetchRow()) {
- $shares[] = $row['share_with'];
+ if (\OCP\DB::isError($result)) {
+ \OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage($result), \OC_Log::ERROR);
+ } else {
+ while ($row = $result->fetchRow()) {
+ $shares[] = $row['share_with'];
+ }
}
-
// We also need to take group shares into account
$query = \OC_DB::prepare(
@@ -176,13 +175,13 @@ class Share {
$result = $query->execute(array($source, self::SHARE_TYPE_GROUP));
- if (\OC_DB::isError($result)) {
- \OC_Log::write('OCP\Share', \OC_DB::getErrorMessage($result), \OC_Log::ERROR);
- }
-
- while ($row = $result->fetchRow()) {
- $usersInGroup = \OC_Group::usersInGroup($row['share_with']);
- $shares = array_merge($shares, $usersInGroup);
+ if (\OCP\DB::isError($result)) {
+ \OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage($result), \OC_Log::ERROR);
+ } else {
+ while ($row = $result->fetchRow()) {
+ $usersInGroup = \OC_Group::usersInGroup($row['share_with']);
+ $shares = array_merge($shares, $usersInGroup);
+ }
}
//check for public link shares
@@ -197,20 +196,18 @@ class Share {
$result = $query->execute(array($source, self::SHARE_TYPE_LINK));
- if (\OC_DB::isError($result)) {
- \OC_Log::write('OCP\Share', \OC_DB::getErrorMessage($result), \OC_Log::ERROR);
- }
-
- if ($result->fetchRow()) {
- $publicShare = true;
+ if (\OCP\DB::isError($result)) {
+ \OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage($result), \OC_Log::ERROR);
+ } else {
+ if ($result->fetchRow()) {
+ $publicShare = true;
+ }
}
}
// let's get the parent for the next round
$meta = $cache->get((int)$source);
$parent = $meta['parent'];
- $parentMeta = $cache->get((int)$parent);
- $path = $parentMeta['path'];
$source = $parent;
}
// Include owner in list of users, if requested