Skip to content

fix(checker): clean up runtime on failure - #1416

Open
faisalahammad wants to merge 1 commit into
WordPress:trunkfrom
faisalahammad:fix/183-runtime-tables-cleanup-on-uninstall
Open

fix(checker): clean up runtime on failure#1416
faisalahammad wants to merge 1 commit into
WordPress:trunkfrom
faisalahammad:fix/183-runtime-tables-cleanup-on-uninstall

Conversation

@faisalahammad

@faisalahammad faisalahammad commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

What?

Closes #183

Why?

Runtime checks install a parallel WordPress database (pc_-prefixed tables) and an object-cache.php drop-in. Cleanup only ran on the happy path, so any check that threw or any request that orphaned state left those tables behind.

How?

  • Wrap the cleanup cascade in Abstract_Check_Runner::run() with try/finally so it runs even when a check throws.
  • Add Runtime_Environment_Setup::cleanup_if_set_up() helper.
  • Add register_deactivation_hook in plugin.php to clean up leftover runtime state on deactivation.
  • Add uninstall.php at plugin root to clean up leftover runtime state on deletion.

Testing Instructions

See TESTING_INSTRUCTIONS.md in the PR diff for manual scenarios (happy path, interrupted AJAX, uninstall, CLI exception). Automated tests in tests/phpunit/tests/Checker/ and tests/phpunit/tests/Installer/.

Screenshots or screencast

Before After
Runtime tables orphaned after a failed check Tables removed on failure, deactivation, and uninstall
Open WordPress Playground Preview

- Run the cleanup cascade in Abstract_Check_Runner::run() from a
  finally block so runtime tables and the object-cache drop-in are
  removed even when a check throws.
- Add Runtime_Environment_Setup::cleanup_if_set_up() helper.
- Clean up leftover runtime state on plugin deactivation.
- Add uninstall.php to clean up runtime state on plugin deletion.

Fixes WordPress#183
@github-actions

Copy link
Copy Markdown

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: faisalahammad <faisalahammad@git.wordpress.org>
Co-authored-by: swissspidy <swissspidy@git.wordpress.org>
Co-authored-by: felixarntz <flixos90@git.wordpress.org>
Co-authored-by: mukeshpanchal27 <mukesh27@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

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.

Cleanup runtime testing database tables during uninstallation

1 participant