33namespace AlphaSnow \AliyunOss ;
44
55use AlphaSnow \Flysystem \AliyunOss \AliyunOssAdapter as BaseAdapter ;
6- use League \Flysystem \Adapter \CanOverwriteFiles ;
7- use League \Flysystem \AdapterInterface ;
86use League \Flysystem \Config as FlysystemConfig ;
97use OSS \OssClient ;
108
11- class Adapter extends BaseAdapter implements CanOverwriteFiles
9+ class Adapter extends BaseAdapter
1210{
1311 /**
1412 * @var Config
@@ -25,21 +23,6 @@ public function __construct(OssClient $ossClient, Config $ossConfig)
2523 parent ::__construct ($ ossClient , $ ossConfig ->get ('bucket ' ), ltrim ($ ossConfig ->get ('prefix ' , null ), '/ ' ), $ ossConfig ->get ('options ' , []));
2624 }
2725
28- /**
29- * {@inheritdoc}
30- */
31- public function getOptionsFromConfig (FlysystemConfig $ config )
32- {
33- $ options = parent ::getOptionsFromConfig ($ config );
34-
35- if ($ visibility = $ config ->get ('visibility ' )) {
36- // Object ACL > Bucket ACL
37- $ options [OssClient::OSS_HEADERS ][OssClient::OSS_OBJECT_ACL ] = $ visibility === AdapterInterface::VISIBILITY_PUBLIC ? OssClient::OSS_ACL_TYPE_PUBLIC_READ : OssClient::OSS_ACL_TYPE_PRIVATE ;
38- }
39-
40- return $ options ;
41- }
42-
4326 /**
4427 * Used by \Illuminate\Filesystem\FilesystemAdapter::url
4528 * Get the URL for the file at the given path.
@@ -68,13 +51,13 @@ public function getTemporaryUrl($path, $expiration = null, array $options = [])
6851 {
6952 $ object = $ this ->applyPathPrefix ($ path );
7053 $ clientOptions = $ this ->getOptionsFromConfig (new FlysystemConfig ($ options ));
54+
7155 if (is_null ($ expiration )) {
7256 $ expiration = new \DateTime ($ this ->ossConfig ->get ('signature_expires ' ));
7357 }
7458 $ timeout = $ expiration ->getTimestamp () - (new \DateTime ('now ' ))->getTimestamp ();
7559
7660 $ url = $ this ->client ->signUrl ($ this ->bucket , $ object , $ timeout , OssClient::OSS_HTTP_GET , $ clientOptions );
77-
7861 return $ this ->ossConfig ->correctUrl ($ url );
7962 }
8063}
0 commit comments