Skip to content

Add hook to expose changed files for OPCache invalidation - #501

Open
swissspidy with Copilot wants to merge 13 commits into
mainfrom
copilot/fix-opcache-invalidation
Open

Add hook to expose changed files for OPCache invalidation#501
swissspidy with Copilot wants to merge 13 commits into
mainfrom
copilot/fix-opcache-invalidation

Conversation

CopilotAI commented Feb 14, 2026

Copy link
Copy Markdown
Contributor

WP-CLI runs in CLI SAPI context, so WordPress core's wp_opcache_invalidate_directory() calls during plugin/theme updates don't affect PHP-FPM opcache. Users need the list of changed files to invalidate opcache using external tools like cachetool.

The custom plugin and theme upgraders are updated to hook into wp_opcache_invalidate_file to get that list. Then, it is exposed via a custom WP-CLI hook (WP_CLI::do_hook()) so that other packages such as https://github.com/wearerequired/wp-cli-clear-opcache could be notified of updates and invalidate all the files in PHP-FPM.

@github-actionsgithub-actionsBot added command:plugin-update Related to 'plugin update' command scope:testing Related to testing labels Feb 14, 2026
CopilotAIand others added 5 commits February 14, 2026 22:43
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
…logic
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
CopilotAI changed the title [WIP] Fix opcache invalidation on plugin updateAdd --show-changed-files flag for opcache invalidationFeb 14, 2026
CopilotAI requested a review from swissspidyFebruary 14, 2026 22:51
@swissspidyswissspidy mentioned this pull request Feb 15, 2026
2 tasks
@swissspidyswissspidy changed the title Add --show-changed-files flag for opcache invalidationAdd hook to expose changed files for OPCache invalidationMar 10, 2026
@codecov

codecovBot commented Mar 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.87500% with 1 line in your changes missing coverage. Please review.

Files with missing linesPatch %Lines
src/WP_CLI/CommandWithUpgrade.php75.00%1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@swissspidy
swissspidy marked this pull request as ready for review March 11, 2026 07:55
@swissspidy
swissspidy requested a review from a team as a code ownerMarch 11, 2026 07:55
CopilotAI review requested due to automatic review settings March 11, 2026 07:55

This comment was marked as resolved.

@swissspidyswissspidy linked an issue Mar 12, 2026 that may be closed by this pull request
2 tasks
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

command:plugin-updateRelated to 'plugin update' commandscope:testingRelated to testingstate:unconfirmed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

opcache invalidation

3 participants

@swissspidy