diff options
author | Robin Appelman <icewind@owncloud.com> | 2014-01-17 14:47:29 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2014-01-17 14:47:29 +0100 |
commit | 5cb08bb9cb6cf603d47a124ffa0ea60881f7de51 (patch) | |
tree | 89ac0ff4115dc175cb79b35b4df837dab3f7df45 /lib | |
parent | 299bb4d99db935bb529a30fe6ae0c9bc72344d69 (diff) | |
parent | db353e14cce316b271d3bfcfdbc6989e146d4517 (diff) | |
download | nextcloud-server-5cb08bb9cb6cf603d47a124ffa0ea60881f7de51.tar.gz nextcloud-server-5cb08bb9cb6cf603d47a124ffa0ea60881f7de51.zip |
Merge branch 'master' into fileinfo
Conflicts:
tests/lib/files/cache/cache.php
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/api.php | 42 | ||||
-rw-r--r-- | lib/private/files/cache/scanner.php | 2 | ||||
-rw-r--r-- | lib/public/share.php | 10 |
3 files changed, 32 insertions, 22 deletions
diff --git a/lib/private/api.php b/lib/private/api.php index 03d7b7382a5..c713368125c 100644 --- a/lib/private/api.php +++ b/lib/private/api.php @@ -33,7 +33,7 @@ class OC_API { const USER_AUTH = 1; const SUBADMIN_AUTH = 2; const ADMIN_AUTH = 3; - + /** * API Response Codes */ @@ -41,13 +41,13 @@ class OC_API { const RESPOND_SERVER_ERROR = 996; const RESPOND_NOT_FOUND = 998; const RESPOND_UNKNOWN_ERROR = 999; - + /** * api actions */ protected static $actions = array(); private static $logoutRequired = false; - + /** * registers an api call * @param string $method the http method @@ -58,7 +58,7 @@ class OC_API { * @param array $defaults * @param array $requirements */ - public static function register($method, $url, $action, $app, + public static function register($method, $url, $action, $app, $authLevel = OC_API::USER_AUTH, $defaults = array(), $requirements = array()) { @@ -75,7 +75,7 @@ class OC_API { } self::$actions[$name][] = array('app' => $app, 'action' => $action, 'authlevel' => $authLevel); } - + /** * handles an api call * @param array $parameters @@ -125,7 +125,7 @@ class OC_API { self::respond($response, $format); } - + /** * merge the returned result objects into one response * @param array $responses @@ -166,32 +166,31 @@ class OC_API { // Maybe any that are not OC_API::RESPOND_SERVER_ERROR // Merge failed responses if more than one $data = array(); - $meta = array(); foreach($shipped['failed'] as $failure) { $data = array_merge_recursive($data, $failure['response']->getData()); } $picked = reset($shipped['failed']); $code = $picked['response']->getStatusCode(); - $response = new OC_OCS_Result($data, $code); + $meta = $picked['response']->getMeta(); + $response = new OC_OCS_Result($data, $code, $meta['message']); return $response; } elseif(!empty($shipped['succeeded'])) { $responses = array_merge($shipped['succeeded'], $thirdparty['succeeded']); } elseif(!empty($thirdparty['failed'])) { // Merge failed responses if more than one $data = array(); - $meta = array(); foreach($thirdparty['failed'] as $failure) { $data = array_merge_recursive($data, $failure['response']->getData()); } $picked = reset($thirdparty['failed']); $code = $picked['response']->getStatusCode(); - $response = new OC_OCS_Result($data, $code); + $meta = $picked['response']->getMeta(); + $response = new OC_OCS_Result($data, $code, $meta['message']); return $response; } else { $responses = $thirdparty['succeeded']; } // Merge the successful responses - $meta = array(); $data = array(); foreach($responses as $app => $response) { @@ -200,22 +199,25 @@ class OC_API { } else { $data = array_merge_recursive($data, $response['response']->getData()); } - $codes[] = $response['response']->getStatusCode(); + $codes[] = array('code' => $response['response']->getStatusCode(), + 'meta' => $response['response']->getMeta()); } // Use any non 100 status codes $statusCode = 100; + $statusMessage = null; foreach($codes as $code) { - if($code != 100) { - $statusCode = $code; + if($code['code'] != 100) { + $statusCode = $code['code']; + $statusMessage = $code['meta']['message']; break; } } - $result = new OC_OCS_Result($data, $statusCode); + $result = new OC_OCS_Result($data, $statusCode, $statusMessage); return $result; } - + /** * authenticate the api call * @param array $action the action details as supplied to OC_API::register() @@ -261,8 +263,8 @@ class OC_API { return false; break; } - } - + } + /** * http basic auth * @return string|false (username, or false on failure) @@ -294,7 +296,7 @@ class OC_API { return false; } - + /** * respond to a call * @param OC_OCS_Result $result @@ -343,5 +345,5 @@ class OC_API { } } } - + } diff --git a/lib/private/files/cache/scanner.php b/lib/private/files/cache/scanner.php index a8c069ee99f..92a4c01841b 100644 --- a/lib/private/files/cache/scanner.php +++ b/lib/private/files/cache/scanner.php @@ -122,7 +122,7 @@ class Scanner extends BasicEmitter { $propagateETagChange = true; } // only reuse data if the file hasn't explicitly changed - if (isset($data['mtime']) && isset($cacheData['mtime']) && $data['mtime'] === $cacheData['mtime']) { + if (isset($data['storage_mtime']) && isset($cacheData['storage_mtime']) && $data['storage_mtime'] === $cacheData['storage_mtime']) { if (($reuseExisting & self::REUSE_SIZE) && ($data['size'] === -1)) { $data['size'] = $cacheData['size']; } diff --git a/lib/public/share.php b/lib/public/share.php index f0fd8e1ab1b..eb1dd8d1c95 100644 --- a/lib/public/share.php +++ b/lib/public/share.php @@ -655,7 +655,15 @@ class Share { * @return Returns true on success or false on failure */ public static function unshareAll($itemType, $itemSource) { - if ($shares = self::getItemShared($itemType, $itemSource)) { + // Get all of the owners of shares of this item. + $query = \OC_DB::prepare( 'SELECT `uid_owner` from `*PREFIX*share` WHERE `item_type`=? AND `item_source`=?' ); + $result = $query->execute(array($itemType, $itemSource)); + $shares = array(); + // Add each owner's shares to the array of all shares for this item. + while ($row = $result->fetchRow()) { + $shares = array_merge($shares, self::getItems($itemType, $itemSource, null, null, $row['uid_owner'])); + } + if (!empty($shares)) { // Pass all the vars we have for now, they may be useful $hookParams = array( 'itemType' => $itemType, |