1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 |
5
|
|
|
* @copyright Aimeos (aimeos.org), 2015-2024 |
6
|
|
|
* @package Base |
7
|
|
|
* @subpackage Filesystem |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
|
11
|
|
|
namespace Aimeos\Base\Filesystem; |
12
|
|
|
|
13
|
|
|
use League\Flysystem\Filesystem; |
14
|
|
|
use League\Flysystem\PhpseclibV2\SftpAdapter; |
|
|
|
|
15
|
|
|
use League\Flysystem\PhpseclibV2\SftpConnectionProvider; |
|
|
|
|
16
|
|
|
use League\Flysystem\UnixVisibility\PortableVisibilityConverter; |
17
|
|
|
|
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Implementation of Flysystem SFTP file system adapter |
21
|
|
|
* |
22
|
|
|
* @package Base |
23
|
|
|
* @subpackage Filesystem |
24
|
|
|
*/ |
25
|
|
|
class FlySftp extends FlyBase implements Iface, DirIface, MetaIface |
26
|
|
|
{ |
27
|
|
|
private ?Filesystem $fs = null; |
28
|
|
|
|
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Returns the file system provider |
32
|
|
|
* |
33
|
|
|
* @return \League\Flysystem\Filesystem File system provider |
34
|
|
|
*/ |
35
|
|
|
protected function getProvider() |
36
|
|
|
{ |
37
|
|
|
if( !isset( $this->fs ) ) |
38
|
|
|
{ |
39
|
|
|
$config = $this->getConfig(); |
40
|
|
|
|
41
|
|
|
if( !isset( $config['host'] ) ) { |
42
|
|
|
throw new Exception( sprintf( 'Configuration option "%1$s" missing', 'host' ) ); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
if( !isset( $config['username'] ) ) { |
46
|
|
|
throw new Exception( sprintf( 'Configuration option "%1$s" missing', 'username' ) ); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
if( !isset( $config['root'] ) ) { |
50
|
|
|
throw new Exception( sprintf( 'Configuration option "%1$s" missing', 'root' ) ); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
$provider = new SftpConnectionProvider( |
54
|
|
|
$config['host'], |
55
|
|
|
$config['username'], |
56
|
|
|
$config['password'] ?? null, |
57
|
|
|
$config['privateKey'] ?? null, |
58
|
|
|
$config['passphrase'] ?? null, |
59
|
|
|
$config['port'] ?? 22, |
60
|
|
|
$config['agent'] ?? false, |
61
|
|
|
$config['timeout'] ?? 10, |
62
|
|
|
$config['retry'] ?? 4, |
63
|
|
|
$config['fingerprint'] ?? null |
64
|
|
|
); |
65
|
|
|
|
66
|
|
|
$converter = PortableVisibilityConverter::fromArray( [ |
67
|
|
|
'file' => [ |
68
|
|
|
'public' => 0640, |
69
|
|
|
'private' => 0604, |
70
|
|
|
], |
71
|
|
|
'dir' => [ |
72
|
|
|
'public' => 0740, |
73
|
|
|
'private' => 7604, |
74
|
|
|
], |
75
|
|
|
] ); |
76
|
|
|
|
77
|
|
|
|
78
|
|
|
$this->fs = new Filesystem( new SftpAdapter( $provider, $config['root'], $converter ) ); |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
return $this->fs; |
82
|
|
|
} |
83
|
|
|
} |
84
|
|
|
|
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