Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Schießle <schiessle@owncloud.com>2013-05-29 16:40:47 +0400
committerFlorin Peter <github@florin-peter.de>2013-05-31 14:24:26 +0400
commit8e512bdfdf7cc135ffe7fefaf8f420d7d681fd94 (patch)
tree597d22b2c041a6cd32e3b66c8798fefbb0dd2f50 /lib/public
parenta5b75d348f207d798667628722ee1575cc636d1d (diff)
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 0d4dc0f3fb7..b9af2bc4086 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -144,7 +144,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(
@@ -157,14 +157,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(
@@ -177,13 +176,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
@@ -198,20 +197,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