Skip to content

Commit

Permalink
Merge pull request #1 from cwenzelg/master
Browse files Browse the repository at this point in the history
FEATURE: Use Flow folder for Google Storage temp files

The GoogleCloudStorage tries to save some temporary files in the server
temporary directory. Working with docker might generate some permission
errors. This feature fixes this issue and lets the Google API use the Flow
folder structure.
  • Loading branch information
robertlemke committed May 26, 2016
2 parents 6b5ad06 + 6905013 commit 8a53c06
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Classes/StorageFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ class StorageFactory
*/
protected $credentialProfiles;

/**
* @Flow\Inject
* @var \TYPO3\Flow\Utility\Environment
*/
protected $environment;

/**
* Creates a new Storage instance and authenticates agains the Google API
*
Expand Down Expand Up @@ -57,7 +63,10 @@ public function create($credentialsProfileName = 'default')
$privateKey
);

$temporaryTargetPathAndFilename = $this->environment->getPathToTemporaryDirectory() . 'Flownative_Google_CloudStorage_Temp';

$googleClient = new \Google_Client();
$googleClient->setClassConfig('Google_Cache_File', 'directory',$temporaryTargetPathAndFilename);
$googleClient->setAssertionCredentials($credentials);
if ($googleClient->isAccessTokenExpired()) {
$googleClient->getRefreshToken();
Expand Down

0 comments on commit 8a53c06

Please sign in to comment.