php - Migrating to LeaqueFlysystem SFTP from v1 to v3, how I can configure the V3 permissions to match the V1 directoryPerm?
one text
In my composer I have the following dependency:
"league/flysystem-sftp": "^1.0",
And I upgraded into:
"league/flysystem-sftp-v3": "^3.0",
The existing code is:
$adapter = new SftpAdapter([
'host' => $host,
'port' => $port,
'username' => $username,
'privateKey' => 'id-rsa',
'root' => '/',
'timeout' => 20,
'directoryPerm' => 0755,
]);
$sftp = new Filesystem($adapter);
According to the documetation I need to change the code ingo this:
$connectionProvider = new SftpConnectionProvider(
$host,
$username,
null,
'id-rsa.ppk',
null,
(int)$port,
false,
20
);
$visibility = PortableVisibilityConverter::fromArray([
// IDK what to place here
]);
$adapter = new SftpAdapter($connectionProvider,"/",$visibility);
$sftp = new Filesystem($adapter);
But I have trouble to understand the following piece of documentation: https://flysystem.thephpleague.com/docs/adapter/sftp-v3/
I mean in my case I only have the setting:
'directoryPerm' => 0755,
Whereas at documentation have:
PortableVisibilityConverter::fromArray([
'file' => [
'public' => 0640,
'private' => 0604,
],
'dir' => [
'public' => 0740,
'private' => 7604,
],
])
And I have trouble to understand what I am supposed to place in here. The previous version of flysystem-sftp
has a simpler approach whilst new one has to configure both private
and public
configuration of files.
Thereafter should I just configure it as?
$visibility = PortableVisibilityConverter::fromArray([
'dir'=>[
'private'=>0755,
'public' => 0755
],
]);
Source