README appears to document use of serve_Js and serve_css incorrectly

Created on 16 September 2020, over 4 years ago
Updated 8 August 2023, almost 2 years ago

Problem/Motivation

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.

Steps to reproduce

Read the README and attempt to create a filesystem with serve_js and serve_css configured as documented.

Proposed resolution

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,
    ],
  ],
];

Remaining tasks

Confirm syntax and generate a patch.

πŸ› Bug report
Status

Closed: duplicate

Version

2.1

Component

Documentation

Created by

πŸ‡¨πŸ‡¦Canada dylan donkersgoed London, Ontario

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024