add support for non seekable streams in Tinebase_FileSystem::copyStream
authorPaul Mehrer <p.mehrer@metaways.de>
Tue, 29 Jul 2014 13:28:18 +0000 (15:28 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Thu, 4 Sep 2014 09:26:37 +0000 (11:26 +0200)
check for seekability before doing rewind

Change-Id: I3ca603620886596df8d54364e85f5def8841be55
Reviewed-on: http://gerrit.tine20.com/customers/908
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Tinebase/FileSystem.php

index 1f7a274..5102837 100644 (file)
@@ -1265,7 +1265,10 @@ class Tinebase_FileSystem implements Tinebase_Controller_Interface
         }
         
         if (is_resource($in) !== NULL) {
-            rewind($in);
+            $metaData = stream_get_meta_data($in);
+            if (true === $metaData['seekable']) {
+                rewind($in);
+            }
             stream_copy_to_stream($in, $handle);
             
             $this->clearStatCache($path);