Make the setup-state push report whether it worked

It was documented 'Always returns 0', so the offboard's new 'Phase flags pushed' check was testing a constant and ticking regardless.
This commit is contained in:
Gmer4Lfe
2026-08-17 10:57:56 -04:00
parent 42711ff9ac
commit ff94ccb343
3 changed files with 36 additions and 10 deletions
+7 -3
View File
@@ -429,10 +429,14 @@ exit(\$failed > 0 ? 1 : 0);
# ──────────────────────────────────────────────────────────────────────────────────────────────
# platform_push_setup_state
# Pushes the Varaverk wizard setup state to all partners via the WebGUI PHP API.
# No-op if php is unavailable. Always returns 0.
# Returns 1 if any partner did not take it, 0 otherwise. No-op returning 0 if php is absent.
#
# This used to end with a bare `return 0` under the comment "Always returns 0", which meant
# every caller that wrote `platform_push_setup_state || X=false` was testing a constant.
# Wiring a failure branch onto a helper that cannot fail is worse than hardcoding the tick,
# because the code reads as though it checked.
# ──────────────────────────────────────────────────────────────────────────────────────────────
platform_push_setup_state() {
command -v php &>/dev/null || return 0
php -r "require_once '/usr/local/emhttp/plugins/varaverk/include/config.php'; vv_push_setup_state();" 2>/dev/null
return 0
php -r "require_once '/usr/local/emhttp/plugins/varaverk/include/config.php'; exit(vv_push_setup_state() > 0 ? 1 : 0);" 2>/dev/null
}