summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJörn Friedrich Dreyer <jfd@butonic.de>2014-08-25 11:26:39 +0200
committerJörn Friedrich Dreyer <jfd@butonic.de>2014-08-25 11:26:39 +0200
commitebf7758d1027709e29038540d6dc267015f45296 (patch)
treeeeb308cc01962ac2c5e1ce7fd99652b841060199 /lib
parentadca48aa93c6137d85d7ed0888dcdec2273faa48 (diff)
parent191a82e768157b5a95269dc80283b59e03212c56 (diff)
downloadnextcloud-server-ebf7758d1027709e29038540d6dc267015f45296.tar.gz
nextcloud-server-ebf7758d1027709e29038540d6dc267015f45296.zip
Merge pull request #10595 from owncloud/swift-stream
Stream downloads from Swift object stores without downloading it first
Diffstat (limited to 'lib')
-rw-r--r--lib/private/files/objectstore/swift.php9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/private/files/objectstore/swift.php b/lib/private/files/objectstore/swift.php
index 3378fd7b86f..1e8dd6a7401 100644
--- a/lib/private/files/objectstore/swift.php
+++ b/lib/private/files/objectstore/swift.php
@@ -120,12 +120,11 @@ class Swift implements IObjectStore {
$objectContent = $object->getContent();
$objectContent->rewind();
- // directly returning the object stream does not work because the GC seems to collect it, so we need a copy
- $tmpStream = fopen('php://temp', 'r+');
- stream_copy_to_stream($objectContent->getStream(), $tmpStream);
- rewind($tmpStream);
+ $stream = $objectContent->getStream();
+ // save the object content in the context of the stream to prevent it being gc'd until the stream is closed
+ stream_context_set_option($stream, 'swift','content', $objectContent);
- return $tmpStream;
+ return $stream;
}
/**