Merge pull request #7079 from nextcloud/s3-read-object-fopen-stable12

use fopen directly when reading objects from s3
This commit is contained in:
Morris Jobke 2017-11-06 15:26:16 +01:00 committed by GitHub
commit f9e29d09b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 5 deletions

View File

@ -49,12 +49,15 @@ trait S3ObjectTrait {
'Bucket' => $this->bucket,
'Key' => $urn
]);
$command['@http']['stream'] = true;
$result = $client->execute($command);
/** @var StreamInterface $body */
$body = $result['Body'];
$request = \Aws\serialize($command);
$opts = [
'http' => [
'header' => $request->getHeaders()
]
];
return $body->detach();
$context = stream_context_create($opts);
return fopen($request->getUri(), 'r', false, $context);
}
/**