37 lines
1.6 KiB
PHP
37 lines
1.6 KiB
PHP
<?php
|
|
header("Content-Type: application/json");
|
|
$out = [];
|
|
|
|
// Widget / root index
|
|
$root = @file_get_contents("/var/www/html/index.html");
|
|
$out["root_size"] = strlen($root ?? "");
|
|
$out["widget_has_sessionstorage"] = strpos($root ?? "", "sessionStorage") !== false;
|
|
$out["widget_has_localstorage"] = strpos($root ?? "", "localStorage") !== false;
|
|
$out["widget_has_wevia"] = preg_match_all("/wevia/i", $root ?? "");
|
|
|
|
// Widget bubbler for persistent backend
|
|
$wevia_public = @file_get_contents("/var/www/html/wevia.html");
|
|
$out["wevia_public_size"] = strlen($wevia_public ?? "");
|
|
$out["wevia_has_sessionstorage"] = strpos($wevia_public ?? "", "sessionStorage") !== false;
|
|
$out["wevia_has_session_id"] = strpos($wevia_public ?? "", "_ambre_session_id") !== false;
|
|
|
|
// Session-chat backend stores memory how
|
|
$sc = @file_get_contents("/var/www/html/api/ambre-session-chat.php");
|
|
$out["session_chat_size"] = strlen($sc ?? "");
|
|
$out["session_chat_storage"] = [];
|
|
if ($sc) {
|
|
if (strpos($sc, "file_put_contents") !== false) $out["session_chat_storage"][] = "file";
|
|
if (strpos($sc, "sqlite") !== false) $out["session_chat_storage"][] = "sqlite";
|
|
if (strpos($sc, "redis") !== false) $out["session_chat_storage"][] = "redis";
|
|
// Find TTL
|
|
if (preg_match("/(\d{4,}).*TTL|TTL.*?(\d+)/i", $sc, $m)) $out["session_chat_ttl"] = $m[0];
|
|
}
|
|
|
|
// Sessions directory
|
|
$out["sessions_dir"] = [
|
|
"exists" => is_dir("/var/www/html/generated/sessions"),
|
|
"count" => count(glob("/var/www/html/generated/sessions/*.json") ?: []),
|
|
];
|
|
|
|
echo json_encode($out, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);
|