Conversation
DEV-978 Volume FS subpaths
Volumes should be able to choose a subpath within their selected filesystem, so filesystems can be reused across multiple volumes. This would also mean that multiple volumes should be able to select the same filesystem. |
brandonkelly
left a comment
There was a problem hiding this comment.
@i-just The current implementation is dropping any inner slashes in the Filesystem Subpath. For example if you set it to foo/bar, it will end up getting normalized to foobar/.
I don’t think that the subpath should be stored within the volumefolders table; instead we should add a new fsSubpath column to the volumes table and store it there. (This will require adjusting the Install migration, as well as creating a new migration for existing installs + increasing the schemaVersion to 4.4.0.2 in config/app.php.)
Folder paths stored in volumefolders should not be affected by the selected subpath. They should continue to be relative to the volume root, not the filesystem root. So if a volume’s Filesystem Subpath is set to foo/bar, any folders (and assets) within the volume should have paths relative to foo/bar/.
|
Also, it would be good if volume validation made sure you don’t have a subpath that will conflict with another volume. For example, if Volume A uses |
|
Thanks @brandonkelly!
Another thing to point out is that the transform location doesn’t take the |
….com:craftcms/cms into feature/dev-239-fill-image-transform-setting
…ftcms/cms into feature/volume-folder-nav-v4 # Conflicts: # src/web/assets/cp/dist/cp.js # src/web/assets/cp/dist/cp.js.map # src/web/assets/cp/dist/css/cp.css # src/web/assets/cp/dist/css/cp.css.map
…ftcms/cms into feature/volume-folder-nav-v4 # Conflicts: # src/web/assets/cp/dist/cp.js # src/web/assets/cp/dist/cp.js.map
# Conflicts: # src/web/assets/admintable/dist/css/app.css.map # src/web/assets/admintable/dist/js/app.js # src/web/assets/admintable/dist/js/app.js.map # src/web/assets/cp/dist/cp.js # src/web/assets/cp/dist/cp.js.map # src/web/assets/garnish/dist/garnish.js.map # src/web/assets/graphiql/dist/css/graphiql.css.map # src/web/assets/installer/dist/css/install.css.map # src/web/assets/login/dist/css/login.css.map # src/web/assets/login/dist/login.js.map # src/web/assets/pluginstore/dist/css/app.css.map # src/web/assets/pluginstore/dist/js/app.js # src/web/assets/pluginstore/dist/js/app.js.map # src/web/assets/routes/dist/css/routes.css.map # src/web/assets/systemmessages/dist/css/system_messages.css.map # src/web/assets/updates/dist/UpdatesUtility.js.map # src/web/assets/upgrade/dist/css/UpgradeUtility.css.map
…itch-columns # Conflicts: # src/web/assets/cp/dist/css/cp.css # src/web/assets/cp/dist/css/cp.css.map # src/web/assets/craftsupport/dist/css/CraftSupportWidget.css.map # src/web/assets/dashboard/dist/css/Dashboard.css.map # src/web/assets/edittransform/dist/css/transforms.css.map # src/web/assets/edituser/dist/css/AccountSettingsForm.css.map # src/web/assets/edituser/dist/css/profile.css.map # src/web/assets/generalsettings/dist/css/rebrand.css.map # src/web/assets/graphiql/dist/css/graphiql.css.map # src/web/assets/installer/dist/css/install.css.map # src/web/assets/login/dist/css/login.css.map # src/web/assets/money/dist/css/Money.css.map # src/web/assets/plugins/dist/css/PluginManager.css.map # src/web/assets/pluginstore/dist/css/app.css.map # src/web/assets/pluginstore/dist/js/app.js # src/web/assets/pluginstore/dist/js/app.js.map # src/web/assets/pluginstoreoauth/dist/css/PluginStoreOauthCallback.css.map # src/web/assets/routes/dist/css/routes.css.map # src/web/assets/systemmessages/dist/css/system_messages.css.map # src/web/assets/updater/dist/css/Updater.css.map # src/web/assets/updates/dist/css/UpdatesUtility.css.map # src/web/assets/upgrade/dist/css/UpgradeUtility.css.map # src/web/assets/userpermissions/dist/css/UserPermissions.css.map # src/web/assets/utilities/dist/css/utilities.css.map
…lected # Conflicts: # src/web/assets/cp/dist/cp.js # src/web/assets/cp/dist/cp.js.map # src/web/assets/pluginstore/dist/js/app.js # src/web/assets/pluginstore/dist/js/app.js.map
…ns-button-for-selected Convert element index actions menu into disclosure menu
# Conflicts: # src/web/assets/cp/dist/cp.js # src/web/assets/cp/dist/cp.js.map # src/web/assets/cp/src/js/BaseElementIndex.js
…by-size Add `width` and `height` to default asset sort
# Conflicts: # composer.lock # src/config/app.php # src/web/assets/cp/dist/cp.js # src/web/assets/cp/dist/cp.js.map
# Conflicts: # CHANGELOG-WIP.md # src/translations/ar/app.php # src/translations/cs/app.php # src/translations/da/app.php # src/translations/de-CH/app.php # src/translations/de/app.php # src/translations/en-GB/app.php # src/translations/es/app.php # src/translations/fa/app.php # src/translations/fr-CA/app.php # src/translations/fr/app.php # src/translations/he/app.php # src/translations/hu/app.php # src/translations/it/app.php # src/translations/ja/app.php # src/translations/ko/app.php # src/translations/nb/app.php # src/translations/nl/app.php # src/translations/pl/app.php # src/translations/pt/app.php # src/translations/ru/app.php # src/translations/sk/app.php # src/translations/sv/app.php # src/translations/th/app.php # src/translations/tr/app.php # src/translations/uk/app.php # src/translations/zh/app.php # src/web/assets/cp/dist/cp.js # src/web/assets/cp/dist/cp.js.map
[ci skip]
[ci skip]
PHPstan improvements
[ci skip]
…sion-notes-graphql Surface `revisionNotes` to graphql
[ci skip]
# Conflicts: # CHANGELOG-WIP.md # src/gql/types/elements/Element.php
# Conflicts: # src/config/app.php # src/models/VolumeFolder.php # src/services/AssetIndexer.php
src/elements/Asset.php
Outdated
| // make sure asset folderPath accounts for volume's fsSubpath | ||
| if (isset($config['volumeId'])) { | ||
| $volume = Craft::$app->getVolumes()->getVolumeById($config['volumeId']); | ||
| $fsSubpath = $volume?->getFsSubpath(); | ||
| if (!empty($fsSubpath) && !str_starts_with($config['folderPath'], $fsSubpath)) { | ||
| $config['folderPath'] = $fsSubpath . $config['folderPath']; | ||
| } | ||
| } |
There was a problem hiding this comment.
Similar to my previous comment – asset paths should be relative to the root of the volume (like folder paths), not to the root of the filesystem.
There was a problem hiding this comment.
Basically, nothing about working with assets should reveal anything about the fact that a filesystem subpath was specified on the volume settings. All of the filesystem subpath logic should be completely contained to the volume itself.
|
Closing this PR as I’ll be opening 2 new ones for this work. One for C4 ( |
Description
Additional info:
Related issues
DEV-978
#11044