From 715a027abdebab724031070e0a251a6587768527 Mon Sep 17 00:00:00 2001 From: GreyChame1eon <102537218+GreyChame1eon@users.noreply.github.com> Date: Sat, 25 Oct 2025 12:59:09 +0300 Subject: fix: repair cli/health.php for OIDC installations (#8040) * fix: repair cli/health.php for OIDC installations Connected with #8039 This changes will restore healthcheck process both for classic and OIDC logins * Finalise fixes --------- Co-authored-by: alexx_b Co-authored-by: Alexandre Alapetite --- cli/health.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'cli') diff --git a/cli/health.php b/cli/health.php index a001f43aa..c6a9c38b7 100755 --- a/cli/health.php +++ b/cli/health.php @@ -4,15 +4,15 @@ declare(strict_types=1); if (php_sapi_name() !== 'cli') { echo 'Error: This script may only be invoked from command line!', PHP_EOL; - die(2); + die(3); } $options = getopt('', ['url::', 'connect_timeout::', 'timeout::']); -$address = is_string($options['url'] ?? null) ? $options['url'] : 'http://localhost/i/'; +$address = is_string($options['url'] ?? null) ? $options['url'] : 'http://localhost/api/'; $ch = curl_init($address); if ($ch === false) { fwrite(STDERR, 'Error: Failed to initialize cURL!' . PHP_EOL); - die(3); + die(4); } curl_setopt_array($ch, [ CURLOPT_CONNECTTIMEOUT => is_numeric($options['connect_timeout'] ?? null) ? (int)$options['connect_timeout'] : 3, @@ -26,6 +26,11 @@ curl_setopt_array($ch, [ $content = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); -if ($httpCode !== 200 || !is_string($content) || !str_contains($content, 'jsonVars') || !str_contains($content, '')) { +if ($httpCode !== 200 || !is_string($content)) { die(1); } + +$content = rtrim($content, "\n\r"); +if (!str_starts_with($content, '') || !str_ends_with($content, '') || !str_contains($content, '/scripts/api.js')) { + die(2); +} -- cgit v1.2.3