[Pkg-owncloud-commits] [owncloud] 33/111: Merge multiple failed third party responses when returning the result

David Prévot taffit at moszumanska.debian.org
Wed Nov 20 21:38:38 UTC 2013


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit 1449437c9ec2e1ad9a58ba12abd9a3b27d8e39f1
Author: tomneedham <tom at owncloud.com>
Date:   Thu Nov 14 01:21:54 2013 +0000

    Merge multiple failed third party responses when returning the result
---
 lib/private/api.php |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/lib/private/api.php b/lib/private/api.php
index 3df2095..03d7b73 100644
--- a/lib/private/api.php
+++ b/lib/private/api.php
@@ -177,9 +177,16 @@ class OC_API {
 		} elseif(!empty($shipped['succeeded'])) {
 			$responses = array_merge($shipped['succeeded'], $thirdparty['succeeded']);
 		} elseif(!empty($thirdparty['failed'])) {
-			// Return the third party failure result
-			$response = reset($thirdparty['failed']);
-			return $response['response'];
+			// 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);
+			return $response;
 		} else {
 			$responses = $thirdparty['succeeded'];
 		}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list