Skip to content

[6.x] Fix global set sites array being ordered by file modification time - #15298

Merged
jasonvarga merged 1 commit into
6.xfrom
global-set-sites-order
Aug 31, 2026
Merged

[6.x] Fix global set sites array being ordered by file modification time#15298
jasonvarga merged 1 commit into
6.xfrom
global-set-sites-order

Conversation

@duncanmcclean

@duncanmcclean duncanmcclean commented Aug 28, 2026

Copy link
Copy Markdown
Member

This pull request fixes an issue where the UpdateGlobalVariables update script built the global set's sites array 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 already excluded upstream by GlobalVariables::whereSet(), so they never reach this method — the sort's fallback ordering is just a safety net, not what prevents deletion.

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

`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
@jasonvarga
jasonvarga merged commit c13daff into 6.x Aug 31, 2026
66 checks passed
@jasonvarga
jasonvarga deleted the global-set-sites-order branch August 31, 2026 16: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