Files
html/api/ambre-libs-check.php
opus 511b5dcb6f
Some checks failed
WEVAL NonReg / nonreg (push) Has been cancelled
auto-sync via WEVIA git_sync_all intent 2026-04-21T15:24:47+02:00
2026-04-21 15:24:48 +02:00

46 lines
1.8 KiB
PHP

<?php
/**
* ambre-libs-check.php · REAL shell check des libs disponibles pour file generation
*/
header("Content-Type: application/json");
$out = ["ok"=>true, "ts"=>date("c"), "s204"=>[]];
// Shell binary checks
foreach (["pandoc","wkhtmltopdf","libreoffice","soffice","unoconv","markdown","gs"] as $cmd) {
$p = @trim(shell_exec("which $cmd 2>/dev/null"));
$out["s204"]["bin_$cmd"] = $p ?: "NOT FOUND";
}
// Composer autoload paths (commonly in /var/www/html/vendor or /opt/wevia-brain/vendor)
foreach (["/var/www/html/vendor/autoload.php","/opt/wevia-brain/vendor/autoload.php","/var/www/weval/vendor/autoload.php","/opt/weval-l99/vendor/autoload.php"] as $autoload) {
if (file_exists($autoload)) {
$out["s204"]["composer_$autoload"] = "EXISTS";
}
}
// Scan vendor folder for specific packages
foreach (["/var/www/html/vendor","/opt/wevia-brain/vendor","/var/www/weval/vendor"] as $vendor_dir) {
if (is_dir($vendor_dir)) {
foreach (["dompdf","phpoffice","mpdf","tcpdf","phpspreadsheet","phppresentation","phpword"] as $pkg) {
$found = @shell_exec("find $vendor_dir -maxdepth 3 -type d -iname "*$pkg*" 2>/dev/null | head -3");
if (trim($found)) $out["s204"]["pkg_$pkg"] = trim($found);
}
}
}
// PHP extensions
$ext_list = get_loaded_extensions();
foreach (["gd","imagick","zip","mbstring","xml","curl","openssl"] as $ext) {
$out["s204"]["ext_$ext"] = in_array($ext, $ext_list) ? "YES" : "NO";
}
// Check /var/www/html/generated directory
$out["s204"]["generated_dir"] = is_dir("/var/www/html/generated") ? "EXISTS" : "MISSING";
if (is_dir("/var/www/html/generated")) {
$files = glob("/var/www/html/generated/*");
$out["s204"]["generated_count"] = count($files);
$out["s204"]["generated_sample"] = array_slice(array_map("basename", $files), 0, 5);
}
echo json_encode($out, JSON_PRETTY_PRINT);