aboutsummaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
authorGravatar GreyChame1eon <102537218+GreyChame1eon@users.noreply.github.com> 2025-10-25 12:59:09 +0300
committerGravatar GitHub <noreply@github.com> 2025-10-25 11:59:09 +0200
commit715a027abdebab724031070e0a251a6587768527 (patch)
tree16073f20d33ab14ad98ae409524cf4fb30b8022a /cli
parent1abb261ceaaa30ca2ad8ed14b0162ed81bb4724a (diff)
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 <alexx_b@mir-lin1.mir.int> Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
Diffstat (limited to 'cli')
-rwxr-xr-xcli/health.php13
1 files changed, 9 insertions, 4 deletions
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, '</html>')) {
+if ($httpCode !== 200 || !is_string($content)) {
die(1);
}
+
+$content = rtrim($content, "\n\r");
+if (!str_starts_with($content, '<!DOCTYPE html>') || !str_ends_with($content, '</html>') || !str_contains($content, '/scripts/api.js')) {
+ die(2);
+}