-
Notifications
You must be signed in to change notification settings - Fork 17
IBX-1439: Upgraded codebase to rely on Flysystem v2 #171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
eaed080 to
8660cf2
Compare
src/lib/IO/Flysystem/PathPrefixer/BaseSiteAccessAwarePathPrefixer.php
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yet I think, that at least a question (as contribution probably would require too much work) to Flysystem should be sent anyway (if not the case already) to avoid maintaining overridden code.
src/lib/IO/Flysystem/Adapter/LocalSiteAccessAwareFilesystemAdapter.php
Outdated
Show resolved
Hide resolved
src/lib/IO/Flysystem/PathPrefixer/BaseSiteAccessAwarePathPrefixer.php
Outdated
Show resolved
Hide resolved
src/lib/IO/Flysystem/PathPrefixer/LocalSiteAccessAwarePathPrefixer.php
Outdated
Show resolved
Hide resolved
d96b6f3 to
751ed4f
Compare
|
Update: b280ad8 fixed outstanding legacy test parameter values for storage root dir. |
|
Moving this to draft state as part of the solution needs to be changed according to the feedback in thephpleague/flysystem#1614 |
oneup/flysystem-bundle ^4.4.2 requires league/flysystem ^2.0 || ^3.0
Co-authored-by: Konrad Oboza <[email protected]>
Co-Authored-By: Mikolaj Adamczyk <[email protected]>
Co-Authored-By: Mikolaj Adamczyk <[email protected]>
Co-Authored-By: Paweł Niedzielski <[email protected]>
Co-Authored-By: Adam Wójs <[email protected]>
Co-Authored-By: Adam Wójs <[email protected]> Co-Authored-By: Paweł Niedzielski <[email protected]>
Co-Authored-By: Paweł Niedzielski <[email protected]>
d4b79ea to
e1258d6
Compare
|
I rebased it against |
tomaszszopinski
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QA approved on IbexaDXP commerce 4.4.x.
For more details see https://issues.ibexa.co/browse/IBX-1439 and ibexa/core#171 The dependency is taken from ibexa/core which contains code requiring it.
For more details see https://issues.ibexa.co/browse/IBX-1439 and ibexa/core#171 The dependency is taken from ibexa/core which contains code requiring it.
v4.4This PR upgrades codebase to rely on Flysystem v2. We can't upgrade to the newest Flysystem v3 because of the hard requirement on PHP 8.
One of the most significant changes is the fact that Adapters were completely rewritten, requiring us to make significant changes to the code.
Our Flysystem Adapter implementation must support dynamic paths described by complex settings resolvable for the SiteAccess context. By default Local
io.root_diris defined as%webroot_dir%/$var_dir$/$storage_dir$wherevar_dirandstorage_dirare SiteAccess configuration parameters. Next to it there's the DFS (NFS) implementation which has one minor difference - web root is custom and static, defined viaDFS_NFS_PATHenvironment variable. It could either be local path or a NFS mount which is transparently seen also as a local filesystem on all *nixes.Per suggestion of Flysystem's Maintainer, Introducing
DynamicPathFilesystemAdapterDecorator, proxying all calls to inner native Flysystem Local Adapter, after applying our dynamic path prefix using custom SiteAccess-awarePathPrefixer.Additionaly to
PathPrefixer, implementations ofVisibilityConverterare provided, following Flysystem v2\League\Flysystem\UnixVisibility\VisibilityConvertercontracts. These resolve created file and directory permissions.PathPrefixerhas 2 implementations:LocalSiteAccessAwarePathPrefixerandDFSSiteAccessAwarePathPrefixer.VisibilityConverterhas 2 implementations:DFSVisibilityConverterandSiteAccessAwareVisibilityConverter. Please note that DFS doesn't include SiteAccessAware part in its name on purpose - DFS file/directory permissions are taken fromibexa.io.nfs.adapter.configContainer parameters and are not dynamic.The structure of the implementation could be presented on the following diagram:
Features no longer supported
\Ibexa\Core\IO\IOBinarydataHandler\Flysystem::create+ test) as now native Flysystem Local Adapter does this OOTB.UnableToRetrieveMetadataexception in such case.Documentation
Upgrade instruction
Local adapters' (by default defined in
config/packages/oneup_flysystem.yaml)directorykey becomeslocationE.g.:
Before
After
If you haven't touched these files, you can simply reset 3rd party
oneup/flysystem-bundlerecipe by executing:Backward compatibility breaks
Requiring higher major version in a minor release is a necessary BC break. We are forced to do that because it seems 1.x is no longer maintained and moreover 3rd party adapters rely higher Flysystem version.
If a custom project relies directly on Flysystem features instead of using our IO abstraction, it will require an upgrade as well, using the following instructions: https://flysystem.thephpleague.com/docs/upgrade-from-1.x/
Other docs
Page https://doc.ibexa.co/en/latest/infrastructure_and_maintenance/clustering/clustering_with_aws_s3/#set-up-aws-s3-account
needs to be updated:
QA
Affected scopes / features:
DFS_NFS_PATHconfiguration\Ibexa\Core\MVC\Symfony\Event\ScopeChangeEventaffecting path prefixes as well--siteaccessoption.ibexa:images:normalize-pathsTasks
Checklist:
$ composer fix-cs).