Skip to content

[6.x] Fix global variables being lost when migrated alongside addon update scripts#14963

Merged
jasonvarga merged 2 commits into
6.xfrom
globals-variables-migration
Jul 10, 2026
Merged

[6.x] Fix global variables being lost when migrated alongside addon update scripts#14963
jasonvarga merged 2 commits into
6.xfrom
globals-variables-migration

Conversation

@duncanmcclean

@duncanmcclean duncanmcclean commented Jul 9, 2026

Copy link
Copy Markdown
Member

This pull request fixes an issue where global variables could be lost when updating to v6 and an addon in one go, when the addon's own update script saves global variables (eg. Peak SEO's AddRobots script).

This was happening because the UpdateGlobalVariables update script wrote the migrated variables directly to disk using File::put, after $globalSet->save() had already created an empty variables localization through the repository. This left the Stache holding empty variables, so when an addon's update script saved global variables later in the same process, it would overwrite the migrated data on disk with only its own changes.

This PR fixes it by saving the migrated data through the GlobalVariables repository instead, keeping the Stache in sync with what's on disk.

Caused by #11585

duncanmcclean and others added 2 commits July 9, 2026 09:03
Writing the variables file directly with File::put left the Stache
holding the empty variables created by the global set's save, so
anything saving those variables later in the same process (like an
addon update script) would clobber the migrated data.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@jasonvarga jasonvarga merged commit b443c78 into 6.x Jul 10, 2026
22 checks passed
@jasonvarga jasonvarga deleted the globals-variables-migration branch July 10, 2026 21:09
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.

2 participants