Skip to content
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

Reset contexts before evaluation. #932

Merged
merged 2 commits into from
Mar 13, 2023

Conversation

jordandukart
Copy link
Member

GitHub Issue: Islandora/documentation#2213

What does this Pull Request do?

Resets contexts before they are evaluated so actions don't get executed that shouldn't be.

What's new?

Forcing contexts and conditions to be re-evaluated given how Islandora uses Context in a non-standard way.

  • Could this change impact execution of existing code?
    Possibly, if actions that had bad conditions set were being executed before and not breaking things.

How should this be tested?

Testing steps are within Islandora/documentation#2213.

Interested parties

@Islandora/committers

Comment on lines 33 to 35
// XXX: Ensure that no earlier executed contexts in the request are still
// present.
$this->resetContextEvaluation();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just figured I'd get this written down, but... having thoughts that this might have something of a performance impact on typical site execution stuff, where contexts might be used for it's typical use case of block placements and influencing viewing and the like, wondering if it might make sense to only reset if $provided is not empty, which I believe should only be when we are responding to something from IslandoraUtils (or some other mechanism that has provided the contexts that we are to use).

Alternatively, might it make sense to roll our own particular islandora.context.manager service or something of the like instead of replacing the context.manager as we do presently, to avoid impacts on the more expected uses of the context.manager service?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Met with @adam-vessey internally, going to attempt to implement his above suggestion.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On second thought there is potentially some concern about BC breaking here if we were going to alter the islandora.context.manager in this way. Going to insulate the above resets for the time being in this commit and bring up the discussion at the next tech call.

@seth-shaw-asu seth-shaw-asu self-requested a review March 8, 2023 18:25
@seth-shaw-asu
Copy link
Member

@jordandukart , should I test this with or without #2213 also applied?

@jordandukart
Copy link
Member Author

You can test without 2213 applied. The changes there are upstream Context fixes but they don't impact this bug.

@seth-shaw-asu seth-shaw-asu merged commit c721f9b into Islandora:2.x Mar 13, 2023
rosiel pushed a commit that referenced this pull request Jul 6, 2023
* Reset contexts before evaluation.
* Only reset when Islandora's ContextProviders are being used.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants