[6.x] Use Laravel disks for asset I/O#19240
Merged
Merged
Conversation
📚 Storybook previews@craftcms/cp — open Storybook No changed components detected in this Storybook. resources/js — open Storybook No changed components detected in this Storybook. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors core asset/file I/O so that volume operations consistently execute through Laravel filesystem disks (Illuminate\Filesystem\FilesystemAdapter) rather than routing through Craft’s FsInterface, while keeping Craft filesystem definitions for configuration/validation and providing a Yii2-adapter bridge (with deprecations) for legacy filesystem APIs.
Changes:
- Updated volume source/transform disk resolution and related asset workflows (URLs, transforms, indexing, uploads) to operate via resolved Laravel disks (including scoped prefixes).
- Simplified and hardened the Yii2-adapter legacy filesystem disk bridge, adding deprecation logging and fixing scoped-path URL handling.
- Fixed CP filesystem/volume settings UI expectations (Inertia payload shape + selectize dropdown styling) and expanded test coverage for the new disk-first behavior.
Reviewed changes
Copilot reviewed 37 out of 37 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| yii2-adapter/tests-laravel/Filesystem/FilesystemCompatibilityTest.php | Adds coverage for legacy bridge disk resolution, scoped URL prefixing, invalid listings, and deprecation deduping. |
| yii2-adapter/src/Filesystem/FilesystemCompatibility.php | Routes all legacy bridge disks through the legacy adapter, adds deprecation logging, and fixes prefix handling for legacy adapters. |
| yii2-adapter/legacy/fs/bridge/LegacyFsPathPrefixedAdapter.php | Adds a prefixed adapter helper that exposes URL generation for prefixed legacy adapters. |
| yii2-adapter/legacy/fs/bridge/LegacyFsFlysystemAdapter.php | Tightens listContents behavior, and adds Flysystem v3 public URL generation support. |
| yii2-adapter/legacy/debug/Module.php | Aligns debug module disk resolution with updated Filesystems::disk() return type. |
| yii2-adapter/legacy/base/LocalFsInterface.php | Marks legacy interface as deprecated and cleans up header formatting. |
| yii2-adapter/legacy/base/FsTrait.php | Marks legacy trait as deprecated and adjusts docblock formatting. |
| yii2-adapter/legacy/base/Fs.php | Marks legacy base filesystem class as deprecated and adjusts docblock formatting. |
| yii2-adapter/legacy/base/BaseFsInterface.php | Marks legacy filesystem interface as deprecated and updates docblock formatting. |
| tests/Feature/Image/ImageTransformerTest.php | Adds tests for transform URL policy and scoped transform deletion event path behavior. |
| tests/Feature/Http/Controllers/Settings/FilesystemsControllerTest.php | Updates expectations for paginated Inertia filesystem payloads and local filesystem settings handling. |
| tests/Feature/Http/Controllers/Assets/TransformControllerTest.php | Adds coverage ensuring “original” files are served correctly from within a scoped volume subpath. |
| tests/Feature/Filesystem/FilesystemsTest.php | Adds tests for env-backed scoped prefixes and reserved disk-prefix collision/invalid config failures. |
| tests/Feature/Asset/VolumeFilesystemResolutionTest.php | Updates expected resolved filesystem target output to reflect disk-name resolution changes. |
| tests/Feature/Asset/Policies/AssetPolicyTest.php | Ensures temporary volumes are flagged as temporary for policy decisions. |
| tests/Feature/Asset/AssetIndexerTest.php | Adds coverage for scoped disk listings being stored as volume-relative URIs; expands helper to accept attributes. |
| src/Support/Facades/Filesystems.php | Updates facade PHPDoc to reflect disk(reference, prefix) signature and return type. |
| src/Providers/FilesystemServiceProvider.php | Registers a dedicated internal temp-asset disk root via Path::tempAssetUploads(). |
| src/Image/ImageTransformer.php | Switches transform URL capability checks to transform FS, and adjusts deletion to use disk-relative paths while preserving event paths. |
| src/Http/Controllers/Settings/VolumesController.php | Uses Filesystems::resolveDiskName() to determine option targets when disabling conflicting storage targets. |
| src/Http/Controllers/Assets/UploadController.php | Uses volume source URL capability helper for conflict URL emission. |
| src/Http/Controllers/Assets/TransformController.php | Simplifies local “original” file serving via disk path() (scoped-safe). |
| src/Filesystem/Filesystems/Local.php | Removes legacy/local-only settings attributes that no longer apply under disk-first behavior. |
| src/Filesystem/Filesystems.php | Introduces disk-first disk(reference, prefix) API, disk config validation, generated-disk tracking, and reserved-prefix collision protection. |
| src/Field/LinkTypes/Asset.php | Filters volumes for link sources via source URL capability helper. |
| src/Field/Assets.php | Switches temp volume detection to Volume::isTemporary() and uses source filesystem type helper for template vars. |
| src/Asset/Volumes.php | Marks the temp upload volume as temporary. |
| src/Asset/Policies/AssetPolicy.php | Switches temp upload checks to Volume::isTemporary(). |
| src/Asset/Elements/Asset.php | Replaces temp-upload and URL checks with volume helpers; gates “Filesystem settings” menu entry to Craft filesystem handles only. |
| src/Asset/Data/Volume.php | Refactors storage target resolution to disk names, adds temporary-volume marker/state, and routes disk operations through Filesystems::disk(). |
| src/Asset/Commands/Concerns/IndexesAssets.php | Prints indexed URIs directly (now volume-relative under scoped disks). |
| src/Asset/AssetsHelper.php | Uses volume URL-capability helpers when building rev’d URLs. |
| src/Asset/Assets.php | Uses disk-first temp upload disk resolution and ensures default temp upload target maps to the internal temp disk. |
| src/Asset/AssetIndexer.php | Stores/list/indexes URIs as disk listing URIs (scoped/volume-relative). |
| resources/js/pages/settings/filesystems/Index.vue | Updates Inertia prop typing/usage for paginated filesystems.data. |
| resources/css/cp.css | Adjusts selectize dropdown form-control styling to fix visibility/overflow behavior. |
| CHANGELOG.md | Notes the disk-first asset I/O refactor in Unreleased entries. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Any file / asset operations now directly go through the Laravel disk instead of being passed through the FsInterface.
Makes Laravel disks the single execution path for core asset I/O, while retaining Craft filesystem definitions for settings, validation, Project Config, URLs, renames, and plugin integration.
Volumes now resolve their configured filesystem to a Laravel disk and use
FilesystemAdapterdirectly. Existing handles,disk:references, environment values, and subpaths remain compatible.Legacy Yii filesystems continue working through the
yii2-adapterFlysystem bridge with deprecation notices. This also fixes scoped-path handling and related filesystem settings UI issues.Also fixes filesystem and volume settings UI regressions uncovered by the change.