Regenerate native PHP mu-plugins when an existing file has stale content - #4196
Merged
Conversation
Collaborator
📊 Performance Test ResultsComparing e55c2a3 vs trunk app-size
site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff) |
…-native-php-mu-plugins # Conflicts: # packages/common/lib/tests/mu-plugins.test.ts
bcotrim
approved these changes
Jul 15, 2026
bcotrim
left a comment
Contributor
There was a problem hiding this comment.
Nice catch 🙌
Tested and confirmed the behavior and the fix, LGTM 👍
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related issues
How AI was used in this PR
AI assisted with the implementation, tests, and verification; all changes were reviewed and validated manually against a live native PHP site.
Proposed Changes
Sites running on the native PHP runtime never picked up updated Studio mu-plugin content. Studio writes its mu-plugins to a temp directory and reuses that directory on subsequent site starts when it looks valid — but the validity check only compared plugin filenames. When a Studio update changed a plugin's content without renaming the file (e.g. the upcoming STU-1945 change that also disables Jetpack Stats in
0-deactivate-jetpack-modules.php), existing sites kept loading the stale version forever; only newly created sites got the updated behavior.The reuse check now also compares each plugin file's content against what the current Studio version generates, and regenerates the whole directory on any mismatch. As a bonus, partially written or corrupted plugin files now self-heal on the next site start instead of being silently reused.
No user-visible behavior change for up-to-date sites: the directory is still reused when contents match, so there is no extra churn on every start or wp-cli invocation.
Testing Instructions
npm run startand start a native PHP site.Pre-merge Checklist