-
Notifications
You must be signed in to change notification settings - Fork 203
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-85: Fixed Content cache containing invalid "uri" for file field types #3096
Merged
Conversation
This file contains 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
Steveb-p
force-pushed
the
ibx-85-fix-content-field-cache
branch
2 times, most recently
from
April 8, 2021 09:25
2ecd194
to
da9fd3d
Compare
Steveb-p
force-pushed
the
ibx-85-fix-content-field-cache
branch
from
April 8, 2021 09:42
da9fd3d
to
0a40640
Compare
Nattfarinn
approved these changes
Apr 26, 2021
ViniTou
approved these changes
Apr 26, 2021
tomaszszopinski
approved these changes
Apr 27, 2021
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 eZSystems on 2.5.18 with patch.
Could you merge it up? |
This was referenced Apr 27, 2021
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.
7.5
This fixes the issue of Content sharing field with Site-Access aware/reliant external data.
The root of the issue is that "uri" for
BinaryFileField
is calculated right after it is acquired from the database, in SPI persistence layer. This causes cache to contain this calculated "uri" value in all SiteAccess' that share the same cache key.Solution involves:
eZ\Publish\Core\MVC\Symfony\FieldType\BinaryBase\ContentDownloadUrlGenerator
with additional methods that would allow recovering of the route and parameters used for the "uri" calculation. A neweZ\Publish\SPI\FieldType\BinaryBase\RouteAwarePathGenerator
is introduced to mark their presence.eZ\Publish\Core\FieldType\BinaryBase\BinaryBaseStorage::getFieldData
, which is called internally byeZ\Publish\Core\Persistence\Legacy\Content\Handler::load
, add "route" and "route_parameters" to external data (ifRouteAwarePathGenerator
is used). They are stored into cache alongside the calculated "uri" for BC compatibility.eZ\Publish\Core\FieldType\BinaryBase\Type
use newly introducedregenerateUri
method that recalculates the "uri" from cached "route" and "route_parameters", if they are present.How to reproduce the issue
Add a new Media File
Either manually clear cache and visit admin file content page, or trigger any admin edit actions that result in cache being regenerated.
Observe the URI generated for
content.fields
in template.(
vendor/ezsystems/ezplatform-admin-ui/src/bundle/Resources/views/themes/admin/content/location_view.html.twig
)Visit the content location. Observe that the URL in template for
content.fields
is the same as the one visible in admin. That's the bug. (eZ/Bundle/EzPublishCoreBundle/Resources/views/default/content/full.html.twig
)Note
Our content field templates do regenerate the URI during rendering (
eZ/Bundle/EzPublishCoreBundle/Resources/views/content_fields.html.twig
).TODO:
$ composer fix-cs
).