46 lines
1.8 KiB
PHP
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);
|