aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Files/ObjectStore/S3ObjectTrait.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Files/ObjectStore/S3ObjectTrait.php')
-rw-r--r--lib/private/Files/ObjectStore/S3ObjectTrait.php27
1 files changed, 8 insertions, 19 deletions
diff --git a/lib/private/Files/ObjectStore/S3ObjectTrait.php b/lib/private/Files/ObjectStore/S3ObjectTrait.php
index 6188357521b..1e9d095b9eb 100644
--- a/lib/private/Files/ObjectStore/S3ObjectTrait.php
+++ b/lib/private/Files/ObjectStore/S3ObjectTrait.php
@@ -49,27 +49,16 @@ trait S3ObjectTrait {
* @since 7.0.0
*/
function readObject($urn) {
- $client = $this->getConnection();
- $command = $client->getCommand('GetObject', [
- 'Bucket' => $this->bucket,
- 'Key' => $urn
+ $context = stream_context_create([
+ 's3seek' => [
+ 'client' => $this->getConnection(),
+ 'bucket' => $this->bucket,
+ 'urn' => $urn,
+ ],
]);
- $request = \Aws\serialize($command);
- $headers = [];
- foreach ($request->getHeaders() as $key => $values) {
- foreach ($values as $value) {
- $headers[] = "$key: $value";
- }
- }
- $opts = [
- 'http' => [
- 'protocol_version' => 1.1,
- 'header' => $headers
- ]
- ];
- $context = stream_context_create($opts);
- return fopen($request->getUri(), 'r', false, $context);
+ S3SeekableReadStream::registerIfNeeded();
+ return fopen('s3seek://', 'r', false, $context);
}
/**