summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-03-23 14:55:03 +0100
committerVincent Petry <pvince81@owncloud.com>2016-03-30 18:39:41 +0200
commit7be541bda18bd60b15f19154fdfd3a0624992462 (patch)
treee415d377f50a09edaf097541bf7058b96693a70d
parent510e8db1ba4dfe3b6454d7a8d6dea3168a8b93c5 (diff)
downloadnextcloud-server-7be541bda18bd60b15f19154fdfd3a0624992462.tar.gz
nextcloud-server-7be541bda18bd60b15f19154fdfd3a0624992462.zip
GDrive stream download with RetryWrapper
-rw-r--r--apps/files_external/lib/google.php9
1 files changed, 5 insertions, 4 deletions
diff --git a/apps/files_external/lib/google.php b/apps/files_external/lib/google.php
index 91e7dfee08d..62d264dfeef 100644
--- a/apps/files_external/lib/google.php
+++ b/apps/files_external/lib/google.php
@@ -35,6 +35,7 @@ namespace OC\Files\Storage;
use GuzzleHttp\Exception\RequestException;
use Icewind\Streams\IteratorDirectory;
+use Icewind\Streams\RetryWrapper;
set_include_path(get_include_path().PATH_SEPARATOR.
\OC_App::getAppPath('files_external').'/3rdparty/google-api-php-client/src');
@@ -441,10 +442,9 @@ class Google extends \OC\Files\Storage\Common {
// the library's service doesn't support streaming, so we use Guzzle instead
$client = \OC::$server->getHTTPClientService()->newClient();
try {
- $tmpFile = \OC::$server->getTempManager()->getTemporaryFile($ext);
- $client->get($downloadUrl, [
+ $response = $client->get($downloadUrl, [
'headers' => $httpRequest->getRequestHeaders(),
- 'save_to' => $tmpFile,
+ 'stream' => true,
'verify' => __DIR__ . '/../3rdparty/google-api-php-client/src/Google/IO/cacerts.pem',
]);
} catch (RequestException $e) {
@@ -459,7 +459,8 @@ class Google extends \OC\Files\Storage\Common {
}
}
- return fopen($tmpFile, 'r');
+ $handle = $response->getBody();
+ return RetryWrapper::wrap($handle);
}
}
return false;