33include_once __DIR__ . '/releases.inc ' ;
44include_once __DIR__ . '/version.inc ' ;
55
6- $ BRANCHES = require __DIR__ . '/branch-overrides.inc ' ;
7-
86/* Time to keep EOLed branches in the array returned by get_active_branches(),
97 * which is used on the front page download links and the supported versions
108 * page. (Currently 28 days.) */
119$ KEEP_EOL = new DateInterval ('P28D ' );
1210
11+ function get_branch_overrides (): array
12+ {
13+ static $ cache = null ;
14+ return $ cache ??= require __DIR__ . '/branch-overrides.inc ' ;
15+ }
16+
1317function format_interval ($ from , DateTime $ to ) {
1418 try {
1519 $ from_obj = $ from instanceof DateTime ? $ from : new DateTime ($ from );
@@ -225,8 +229,9 @@ function get_initial_release($branch) {
225229 return $ GLOBALS ['OLDRELEASES ' ][$ major ]["$ branch.0 " ];
226230 }
227231
228- if (isset ($ GLOBALS ['BRANCHES ' ][$ branch ])) {
229- return $ GLOBALS ['BRANCHES ' ][$ branch ];
232+ $ overrides = get_branch_overrides ();
233+ if (isset ($ overrides [$ branch ])) {
234+ return $ overrides [$ branch ];
230235 }
231236
232237 /* If there's only been one release on the branch, it won't be in
@@ -276,8 +281,9 @@ function get_final_release($branch) {
276281//#[Deprecated('Use VersionData->bugfixesEOL')]
277282function get_branch_bug_eol_date ($ branch ): ?DateTime
278283{
279- if (isset ($ GLOBALS ['BRANCHES ' ][$ branch ]['stable ' ])) {
280- return new DateTime ($ GLOBALS ['BRANCHES ' ][$ branch ]['stable ' ]);
284+ $ overrides = get_branch_overrides ();
285+ if (isset ($ overrides [$ branch ]['stable ' ])) {
286+ return new DateTime ($ overrides [$ branch ]['stable ' ]);
281287 }
282288
283289 $ date = get_branch_release_date ($ branch );
@@ -296,8 +302,9 @@ function get_branch_bug_eol_date($branch): ?DateTime
296302//#[Deprecated('Use VersionData->securityEOL')]
297303function get_branch_security_eol_date ($ branch ): ?DateTime
298304{
299- if (isset ($ GLOBALS ['BRANCHES ' ][$ branch ]['security ' ])) {
300- return new DateTime ($ GLOBALS ['BRANCHES ' ][$ branch ]['security ' ]);
305+ $ overrides = get_branch_overrides ();
306+ if (isset ($ overrides [$ branch ]['security ' ])) {
307+ return new DateTime ($ overrides [$ branch ]['security ' ]);
301308 }
302309
303310 /* Versions before 5.3 are based solely on the final release date in
0 commit comments