Take shared-menu.php 1.1.0 and keep its hash in one place

The family froze a new copy of includes/shared-menu.php: 184cebdc, contract
1.1.0. Two changes in it for this plugin, which was still on f4862d5c (1.0.0).

The menu icon is now an infinity sign, painted from admin_head behind a
wpmgr_menu_glyph filter that defaults to it — Kristian asked for it because the
family is called Nolimit. And the file's own header said 1.0.0 while its
constant said 1.1.0, and it counted five plugins where there are six; Nolimit
SEO found both.

Taken today rather than when convenient, and the reason is measured rather than
tidiness: two plugins were on 1.1.0 and three on 1.0.0 at the same time, so a
shop got the glyph or the cog depending on activation order — while every
repository's own hash check was green on its own side. A frozen file is a
family-wide fact, and a green local check says nothing about the shop.

The API change is additive — a new filter and a new function, nothing removed —
so this plugin's use of wpmgr_ensure_menu() and wpmgr_menu_title is unaffected,
and the default glyph means there is nothing to opt into.

The hash now lives once, as WPMGR_MENU_SHA in ci/plugin.conf, checked by
ci/static.sh and required by ci_load_conf so an unset value cannot turn the
comparison into a no-op. It was previously a literal inside tests/smoke.php as
well; two copies of one constant drift, and the copy that drifts is the one
nobody remembers. The runtime assertion that remains proves a different fact —
that the file is loaded at all — because wpmgr_ensure_menu() only exists if it
was.

Proven red by appending one line to the shared file: the check names both
hashes and says not to edit it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
kristianwind
2026-09-20 09:31:37 +02:00
co-authored by Claude Opus 5
parent c40817f932
commit 3020338378
5 changed files with 117 additions and 23 deletions
+7 -11
View File
@@ -314,17 +314,13 @@ wc_edm_is(
isset( $wc_edm_mine[0]['colour'] ) ? $wc_edm_mine[0]['colour'] : null
);
// includes/shared-menu.php is byte-identical in all five plugins, and which
// copy a site loads is decided by activation order. Editing it here would make
// a site with three of five updated show one label or another depending on who
// booted first — and PHP cannot un-declare a function, so the first copy wins
// for the whole request. The hash is the guard: change the file and this goes
// red rather than the behaviour going strange on somebody's shop.
wc_edm_is(
'and the shared menu file is the family copy, unedited',
'f4862d5c3a2d24dadddaaec90c9221d61f2923964e164fd525a800ddcec63185',
hash_file( 'sha256', WC_EDM_PLUGIN_DIR . 'includes/shared-menu.php' )
);
// The frozen hash of includes/shared-menu.php is asserted in ci/static.sh
// against WPMGR_MENU_SHA in ci/plugin.conf, and deliberately NOT repeated
// here: two copies of the same constant drift, and the one that drifts is the
// one nobody remembers to update. What is worth asserting at runtime is a
// different fact — that the file is actually loaded in a real install, which
// the parent-menu assertion above already proves, since wpmgr_ensure_menu()
// only exists if it was.
/* ------------------------------------------------------------ woocommerce -- */