Created
January 28, 2022 09:45
-
-
Save kublermdk/8c2afd7e3ad88cfacdf80e435b44c3a8 to your computer and use it in GitHub Desktop.
Update creocoder\flysystem\GoogleCloudFilesystem to support the GoogleStorageAdapter which allows VISIBILITY_NOT_SET
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @link https://github.com/creocoder/yii2-flysystem | |
* @copyright Copyright (c) 2015 Alexander Kochetov | |
* @license http://opensource.org/licenses/BSD-3-Clause | |
* | |
* Updated by Michael Kubler @kublermdk to support VISIBILITY_NOT_SET by using the different Google Storage Adapter | |
*/ | |
namespace app\adaptors; | |
use Google\Cloud\Storage\StorageClient; | |
use \app\adaptors\GoogleStorageAdapter as GoogleStorageAdapter; // Point this to where-ever you place these | |
/** | |
* GoogleCloudFilesystem | |
* @package app\adaptors\GoogleCloudFilesystem | |
* | |
* To enable the use of the \Superbalist\Flysystem\GoogleStorage\GoogleStorageAdapter | |
*/ | |
class GoogleCloudFilesystem extends \creocoder\flysystem\GoogleCloudFilesystem | |
{ | |
/** | |
* @return GoogleStorageAdapter | |
*/ | |
protected function prepareAdapter() | |
{ | |
$config = [ | |
'projectId' => $this->projectId, | |
'keyFilePath' => \Yii::getAlias($this->keyFilePath), | |
]; | |
$client = new StorageClient($config); | |
$bucket = $client->bucket($this->bucket); | |
return new GoogleStorageAdapter($client, $bucket); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment