Implement 3.0.x version based on Flysystem v3 API changes

Created on 1 February 2021, almost 4 years ago
Updated 30 June 2024, 5 months ago

Problem/Motivation

Flysystem 3.x is now stable (current stable release version is 3.19), and is receiving all feature enhancements and support. The new version has a much simpler and straightforward API that is more closely aligned with the StreamWrapper interface that is part of Drupal Core.

Proposed resolution

Let's refactor the Flysystem main and supporting module ecosystem to update the modules to be based on Flysystem 3.x.

Remaining tasks

*
* Assess Flysystem 3.0+ to determine the best path forward to integrate with Drupal 10:
* Develop a Roadmap for implementation, and break down tasks into an orderly implementation.

Initial assessment of the Flysystem 3.x library indicates that a roadmap that includes the following is probably the most straightforward implementation with the current Flysystem library:
- Leverage the existing Flysystem Filesystem Class to create an integration point that implements Drupal's StreamWrapper interface (Flysystem's Filesystem class has a 90% compliant implementation with StreamWrapper interface currently)
- Create an Adapter interface within the Drupal Flysystem module that adopts the Flysystem Adapter Interface, and implements any additional Drupal intergration points needed for implementation
- Write an Adapter for a Local filesystem stream wrapper, which is part of the base Flysystem 3.x library
- Develop an Adapter implementation plan for supplemental Drupal Flysystem modules, such as Flysystem S3, Flysystem FTP, etc.

User interface changes

* It appears that these would be minimal; however implementation of an admin UI to allow for configuration options to be managed through the UI would be a nice feature enhancement. Currently, most configuration for Flysystem stream wrappers takes place in the settings.php file directly.

API changes

* Since the API for Flysystem 3.x has significant changes from the 1.x version, documentation of API changes (which would be significant breaking changes) would be in order.
* It's worth noting that, while there are significant breaking changes it is likely that a "migration" would not be in order for content (file assets), but a minimal migration of configuration may be needed.

Data model changes

* Data model changes are not in order here; storage of data related to assets managed with the stream wrappers would leverage existing Drupal data structures, as does the current module versions.

League\Flysystem 3.x Overview

External Dependencies

league/mime-type-detection
Used to detect nimetypes:
* based on file names and file contents (MimetypeDetection\MimeTypeDetector)
* based on file extension (MimetypeDetection\ExtensionLookup)

Interfaces in League/Flysystem v3

The two key interfaces here are FilesystemOperator and FilesystemAdapter.

FilesystemWriter

Contract interface for CUD (Create / Update / Delete) methods

FilesystemReader

Contract interface for R (Read) methods

FilesystemOperator extends FilesystemReader, FilesystemWriter

Main interface for the library. Implemented by Filesystem, which is the primary class through which interaction happens, including managing the adapters for different supported file systems.

FilesystemException extends Throwable

Main interface for the libraries Exception identification.

FilesystemOperationFailed extends FilesystemException

FilesystemAdapter

Contract interface for supported adapters. Class instances are injected into Filesystem instances to register various file systems interaction support.

PathNormalizer

Contract for path normalization methods. Class instances implementing this interface are injected into Filesystem instances.

ChecksumProvider

Contract for methods to provide ad-hoc chucksum calculations (defined as using MD5 hash for checksums)

StorageAttributes extends JsonSerializable, ArrayAccess

Contract for methods performing operations on File, Directory, and Mount Attributes

UnixVisibility/VisibilityConverter

Contract for methods managing permissions for Files and Directories.

UrlGeneration/TemporaryUrlGenerator

Contract for methods related to temporary file URLs

UrlGeneration/PublicUrlGenerator

Contract for methods related to public file URLs

Feature request
Status

Needs work

Version

3.0

Component

Code

Created by

🇺🇸United States lhridley

Live updates comments and jobs are added and updated live.
  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

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