-
Notifications
You must be signed in to change notification settings - Fork 60
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
Always use prefixed tables during runtime check requests #768
Always use prefixed tables during runtime check requests #768
Conversation
…act check it is needed.
…risk of messing with actual database tables.
… a catch-all, which can lead to potential cleanup problems to go unnoticed.
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
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.
Nice.
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.
Awesome!
Related to #597 (see 2nd point in the description, also see this doc comment).
While for the checks itself it's fine to only use the custom database prefix right when the checks are run, this poses some risks because certain parts of the environment (e.g. active plugins, active theme) are already filtered. This could lead to problematic side effects on the actual database tables depending on what plugins do - potentially disastrous, if it was a live site.
Therefore this PR sets the custom database prefix as part of overall runtime preparations (via
Universal_Runtime_Preparation
) so that it remains for the duration of more or less the entire request:Abstract_Check_Runner::run()
method has been removed as it is now unnecessary there.AJAX_Runner_Tests::test_prepare_with_runtime_check()
to fail, which however was exactly because of the problem this PR is fixing: TheUse_Minimal_Theme_Preparation
may modify the database with the custom theme root, and this would so far have updated the actual database. So the test now initially sets up the runtime environment, which is needed to execute runtime checks in any case, and the runtime preparations then operate on the "fake tables".Runtime_Check_UnitTestCase
, which was also missing the runtime environment setup bit.Additionally, it makes a few minor code improvements:
Runtime_Environment_Setup
.