- Status changed to Closed: duplicate
almost 2 years ago 12:45pm 8 August 2023 - πΊπΈUnited States lhridley
Duplicates https://www.drupal.org/project/flysystem/issues/3056455 π serve_js and serve_css have undocumented assumption Fixed
The serve_js and serve_css options appear to be in the incorrect location in the README. They are nested underneath the 'config' key when Drupal\flysystem\Asset\SchemeExtensionTrait::getSchemeForExtension() checks for them adjacent to the 'config' key.
I notice that ftpexample seems to be nested under local-example as well which doesn't seem correct.
Having run into this I'm wondering if all the properties under "Optional settings that apply to all adapters" should actually be adjacent to config instead of nested under the config key. It seems like the config key may be specifically for config options that are passed to the driver. I'm holding off on generating a patch pending clarification on that.
Read the README and attempt to create a filesystem with serve_js and serve_css configured as documented.
Update the README. Change:
$schemes = [
'local-example' => [ // The name of the stream wrapper.
'driver' => 'local', // The plugin key.
'config' => [
'root' => '/path/to/dir/outsite/drupal', // This will be treated similarly
// Drupal's private file system.
// Or.
'root' => 'sites/default/files/flysystem',
'public' => TRUE, // In order for the public setting to work,
// the path must be relative to the root
// of the Drupal install.
// Optional settings that apply to all adapters.
'name' => 'Custom stream wrapper name', // Defaults to Flysystem: scheme.
'description' => 'Custom description', // Defaults to Flysystem: scheme.
'cache' => TRUE, // Cache filesystem metadata. Not necessary for
// the local driver.
'replicate' => 'ftpexample', // 'replicate' writes to both filesystems, but
// reads from this one. Functions as a backup.
'serve_js' => TRUE, // Serve Javascript or CSS via this stream wrapper.
'serve_css' => TRUE, // This is useful for adapters that function as
// CDNs like the S3 adapter.
],
'ftpexample' => [
'driver' => 'ftp',
'config' => [
'host' => 'ftp.example.com',
'username' => 'username',
'password' => 'password',
// Optional config settings.
'port' => 21,
'root' => '/path/to/root',
'passive' => true,
'ssl' => false,
'timeout' => 90,
'permPrivate' => 0700,
'permPublic' => 0700,
'transferMode' => FTP_BINARY,
],
],
],
];
to:
$schemes = [
'local-example' => [ // The name of the stream wrapper.
'driver' => 'local', // The plugin key.
'config' => [
'root' => '/path/to/dir/outsite/drupal', // This will be treated similarly
// Drupal's private file system.
// Or.
'root' => 'sites/default/files/flysystem',
'public' => TRUE, // In order for the public setting to work,
// the path must be relative to the root
// of the Drupal install.
// Optional settings that apply to all adapters.
'name' => 'Custom stream wrapper name', // Defaults to Flysystem: scheme.
'description' => 'Custom description', // Defaults to Flysystem: scheme.
'cache' => TRUE, // Cache filesystem metadata. Not necessary for
// the local driver.
'replicate' => 'ftpexample', // 'replicate' writes to both filesystems, but
// reads from this one. Functions as a backup.
],
'serve_js' => TRUE, // Serve Javascript or CSS via this stream wrapper.
'serve_css' => TRUE, // This is useful for adapters that function as
// CDNs like the S3 adapter.
],
'ftpexample' => [
'driver' => 'ftp',
'config' => [
'host' => 'ftp.example.com',
'username' => 'username',
'password' => 'password',
// Optional config settings.
'port' => 21,
'root' => '/path/to/root',
'passive' => true,
'ssl' => false,
'timeout' => 90,
'permPrivate' => 0700,
'permPublic' => 0700,
'transferMode' => FTP_BINARY,
],
],
];
Confirm syntax and generate a patch.
Closed: duplicate
2.1
Documentation
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Duplicates https://www.drupal.org/project/flysystem/issues/3056455 π serve_js and serve_css have undocumented assumption Fixed