[6.x] Fix global set sites array being ordered by file modification time - #15298
Open
duncanmcclean wants to merge 1 commit into
Open
[6.x] Fix global set sites array being ordered by file modification time#15298duncanmcclean wants to merge 1 commit into
duncanmcclean wants to merge 1 commit into
Conversation
`Stache\Traverser::traverse()` sorts paths by modification time, so `UpdateGlobalVariables` built the `sites` array in whatever order the variable files happened to be written in. When the writes tie on mtime the name order survives, which is why this only showed up on the slower Windows CI runners. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Mj2inC2cHsqnqD47JhiYbf
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.
This pull request fixes an issue where the
UpdateGlobalVariablesupdate script built the global set'ssitesarray in a non-deterministic order.This was happening because
Stache\Traverser::traverse()sorts paths by their file modification time, not by name, so the update script wrote the sites out in whatever order the variable files happened to have been written in. When the mtimes tie, the traverser's name ordering survives, which is why it looked stable locally and only showed up on the slower Windows CI runners, where the writes straddle a second boundary.This PR fixes it by ordering the sites by their position in the sites config, which is the same order the Control Panel writes when a global set is saved. Variables for sites that aren't in the config are kept and sorted last, so they don't get deleted by
saveOrDeleteLocalizations()during an upgrade.The test now writes its fixture files in a different order than it expects them back, so it catches the ordering on every platform rather than passing by accident on Linux and macOS.
Related: #15297