-
Notifications
You must be signed in to change notification settings - Fork 162
Open
Description
第一处
Storage::extend('oss', function($app, $config)
{
$accessId = $config['access_id'];
$accessKey = $config['access_key'];
$cdnDomain = empty($config['cdnDomain']) ? '' : $config['cdnDomain'];
$bucket = $config['bucket'];
$ssl = empty($config['ssl']) ? false : $config['ssl'];
$isCname = empty($config['isCName']) ? false : $config['isCName'];
$debug = empty($config['debug']) ? false : $config['debug'];
$endPoint = $config['endpoint']; // 默认作为外部节点
// TODO: 这里和文档描述不一致
$epInternal= $isCname?$cdnDomain:(empty($config['endpoint_internal']) ? $endPoint : $config['endpoint_internal']); // 内部节点
if($debug) Log::debug('OSS config:', $config);
$client = new OssClient($accessId, $accessKey, $epInternal, $isCname);
$adapter = new AliOssAdapter($client, $bucket, $endPoint, $ssl, $isCname, $debug, $cdnDomain);
//Log::debug($client);
$filesystem = new Filesystem($adapter);
$filesystem->addPlugin(new PutFile());
$filesystem->addPlugin(new PutRemoteFile());
//$filesystem->addPlugin(new CallBack());
return $filesystem;
});
第二处
public function getUrl( $path )
{
// TODO: 这里判断文件是否存在,批量获取的时候回比较影响性能,考虑是否要加个配置项
if (!$this->has($path)) throw new FileNotFoundException($filePath.' not found');
return ( $this->ssl ? 'https://' : 'http://' ) . ( $this->isCname ? ( $this->cdnDomain == '' ? $this->endPoint : $this->cdnDomain ) : $this->bucket . '.' . $this->endPoint ) . '/' . ltrim($path, '/');
}
Metadata
Metadata
Assignees
Labels
No labels