Skip to content

Add hook to expose changed files for OPCache invalidation#501

Open
Copilot wants to merge 13 commits intomainfrom
copilot/fix-opcache-invalidation
Open

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

Conversation

Copy link
Contributor

Copilot AI commented Feb 14, 2026

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-actions github-actions bot added command:plugin-update Related to 'plugin update' command scope:testing Related to testing labels Feb 14, 2026
Copilot AI and 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>
Copilot AI changed the title [WIP] Fix opcache invalidation on plugin update Add --show-changed-files flag for opcache invalidation Feb 14, 2026
Copilot AI requested a review from swissspidy February 14, 2026 22:51
@swissspidy swissspidy mentioned this pull request Feb 15, 2026
2 tasks
@swissspidy swissspidy changed the title Add --show-changed-files flag for opcache invalidation Add hook to expose changed files for OPCache invalidation Mar 10, 2026
@codecov
Copy link

codecov bot commented Mar 10, 2026

Codecov Report

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

Files with missing lines Patch % Lines
src/WP_CLI/CommandWithUpgrade.php 75.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 owner March 11, 2026 07:55
Copilot AI review requested due to automatic review settings March 11, 2026 07:55

This comment was marked as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

command:plugin-update Related to 'plugin update' command scope:testing Related to testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants