(dev/core#5606) user_dashboard - Fix upgrade error #31581
Merged
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.
Overview
This fixes an upgrade error reported in https://lab.civicrm.org/dev/core/-/issues/5606.
The general issue is that the upgrader checks Afform metadata. But this particular metadata file (
afsearchUserDashboard.aff.php
) has an unusual sort of dynamism that doesn't work in upgrade context. So we move it somewhere that does work.(ping @colemanw)
Before
Whenever you try to read any metadata bout
afsearchUserDashboard
, it tries to immediately render a dynamic layout.After
It only renders the dynamic layout when it needs to (which is not during the upgrade).
Technical Details
To ensure that the code works the same as I before, I dumped some example output before+after. Compare:
For me, this gives the same output.
Comments
With this procedure to reproduce, I see the upgrade working.
One thing that I'm not sure about is the story of a site-builder who edits
afsearchUserDashboard
:hook_alterAngular
listener is written to replace the fulllayout
.)I think dynamism in
*.aff.php
is like dynamism in other metadata files (*.ang.php
,*.setting.php
). It can be done. It's a valid quick-hack to prove a concept. But for long-term maintainability, one looks for something else.