-
Notifications
You must be signed in to change notification settings - Fork 13
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
IBX-1439: Upgraded codebase to rely on Flysystem v2 #171
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 <konrad.oboza@ibexa.co>
Co-Authored-By: Mikolaj Adamczyk <mikadamczyk@users.noreply.github.com>
Co-Authored-By: Mikolaj Adamczyk <mikadamczyk@users.noreply.github.com>
Co-Authored-By: Paweł Niedzielski <Steveb-p@users.noreply.github.com>
Co-Authored-By: Adam Wójs <adamwojs@users.noreply.github.com>
Co-Authored-By: Adam Wójs <adamwojs@users.noreply.github.com> Co-Authored-By: Paweł Niedzielski <Steveb-p@users.noreply.github.com>
Co-Authored-By: Paweł Niedzielski <Steveb-p@users.noreply.github.com>
d4b79ea
to
e1258d6
Compare
I rebased it against |
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.4
This 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_dir
is defined as%webroot_dir%/$var_dir$/$storage_dir$
wherevar_dir
andstorage_dir
are 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_PATH
environment 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 ofVisibilityConverter
are provided, following Flysystem v2\League\Flysystem\UnixVisibility\VisibilityConverter
contracts. These resolve created file and directory permissions.PathPrefixer
has 2 implementations:LocalSiteAccessAwarePathPrefixer
andDFSSiteAccessAwarePathPrefixer
.VisibilityConverter
has 2 implementations:DFSVisibilityConverter
andSiteAccessAwareVisibilityConverter
. Please note that DFS doesn't include SiteAccessAware part in its name on purpose - DFS file/directory permissions are taken fromibexa.io.nfs.adapter.config
Container 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.UnableToRetrieveMetadata
exception in such case.Documentation
Upgrade instruction
Local adapters' (by default defined in
config/packages/oneup_flysystem.yaml
)directory
key becomeslocation
E.g.:
Before
After
If you haven't touched these files, you can simply reset 3rd party
oneup/flysystem-bundle
recipe 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_PATH
configuration\Ibexa\Core\MVC\Symfony\Event\ScopeChangeEvent
affecting path prefixes as well--siteaccess
option.ibexa:images:normalize-paths
Tasks
Checklist:
$ composer fix-cs
).