|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Jason\Flysystem\Oss; |
|
4
|
|
|
|
|
5
|
|
|
use Jason\Flysystem\Oss\Plugins\FileUrl; |
|
6
|
|
|
use Jason\Flysystem\Oss\Plugins\Kernel; |
|
7
|
|
|
use Jason\Flysystem\Oss\Plugins\SetBucket; |
|
8
|
|
|
use Jason\Flysystem\Oss\Plugins\SignatureConfig; |
|
9
|
|
|
use Jason\Flysystem\Oss\Plugins\SignUrl; |
|
10
|
|
|
use Jason\Flysystem\Oss\Plugins\TemporaryUrl; |
|
11
|
|
|
use Jason\Flysystem\Oss\Plugins\Verify; |
|
12
|
|
|
use Illuminate\Support\ServiceProvider; |
|
|
|
|
|
|
13
|
|
|
use League\Flysystem\Filesystem; |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* Class OssStorageServiceProvider |
|
17
|
|
|
* @author iidestiny <[email protected]> |
|
18
|
|
|
*/ |
|
19
|
|
|
class OssStorageServiceProvider extends ServiceProvider |
|
20
|
|
|
{ |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* Bootstrap the application services. |
|
24
|
|
|
* @return void |
|
25
|
|
|
*/ |
|
26
|
|
|
public function boot() |
|
27
|
|
|
{ |
|
28
|
|
|
app('filesystem')->extend('oss', function ($app, $config) { |
|
|
|
|
|
|
29
|
|
|
$root = $config['root'] ?? null; |
|
30
|
|
|
$buckets = isset($config['buckets']) ? $config['buckets'] : []; |
|
31
|
|
|
$cdnHost = isset($config['cdnHost']) ? $config['cdnHost'] : ''; |
|
32
|
|
|
$adapter = new OssAdapter( |
|
33
|
|
|
$config['access_key'], |
|
34
|
|
|
$config['secret_key'], |
|
35
|
|
|
$config['endpoint'], |
|
36
|
|
|
$config['bucket'], |
|
37
|
|
|
$config['isCName'], |
|
38
|
|
|
$root, |
|
|
|
|
|
|
39
|
|
|
$buckets, |
|
40
|
|
|
$cdnHost |
|
41
|
|
|
); |
|
42
|
|
|
|
|
43
|
|
|
$filesystem = new Filesystem($adapter); |
|
44
|
|
|
|
|
45
|
|
|
$filesystem->addPlugin(new FileUrl()); |
|
46
|
|
|
$filesystem->addPlugin(new SignUrl()); |
|
47
|
|
|
$filesystem->addPlugin(new TemporaryUrl()); |
|
48
|
|
|
$filesystem->addPlugin(new SignatureConfig()); |
|
49
|
|
|
$filesystem->addPlugin(new SetBucket()); |
|
50
|
|
|
$filesystem->addPlugin(new Verify()); |
|
51
|
|
|
$filesystem->addPlugin(new Kernel()); |
|
52
|
|
|
|
|
53
|
|
|
return $filesystem; |
|
54
|
|
|
}); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* Register the application services. |
|
59
|
|
|
* @return void |
|
60
|
|
|
*/ |
|
61
|
|
|
public function register() |
|
62
|
|
|
{ |
|
63
|
|
|
// |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
} |
|
67
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths