Skip to content

[6.x] Use Laravel disks for asset I/O#19240

Merged
brandonkelly merged 5 commits into
6.xfrom
feature/laravel-asset-disks
Jul 13, 2026
Merged

[6.x] Use Laravel disks for asset I/O#19240
brandonkelly merged 5 commits into
6.xfrom
feature/laravel-asset-disks

Conversation

@riasvdv

@riasvdv riasvdv commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

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 FilesystemAdapter directly. Existing handles, disk: references, environment values, and subpaths remain compatible.

Legacy Yii filesystems continue working through the yii2-adapter Flysystem 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.

BEFORE

Asset operation
  ├──> FsInterface
  └──> FilesystemAdapter


AFTER

Asset operation
  └──> FilesystemAdapter

@github-actions

github-actions Bot commented Jul 12, 2026

Copy link
Copy Markdown

📚 Storybook previews

@craftcms/cpopen Storybook

No changed components detected in this Storybook.

resources/jsopen Storybook

No changed components detected in this Storybook.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@riasvdv riasvdv requested a review from brandonkelly July 12, 2026 16:23
@riasvdv riasvdv marked this pull request as ready for review July 12, 2026 16:23
@brandonkelly brandonkelly merged commit 3cc6e95 into 6.x Jul 13, 2026
@brandonkelly brandonkelly deleted the feature/laravel-asset-disks branch July 13, 2026 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants