40 lines
1.6 KiB
PHP
40 lines
1.6 KiB
PHP
<?php
|
|
header("Content-Type: application/json");
|
|
$out = [];
|
|
|
|
// Sitemap-api JSON
|
|
$sm = @file_get_contents("https://weval-consulting.com/api/sitemap-api.php", false, stream_context_create(["http"=>["timeout"=>8]]));
|
|
$smd = @json_decode($sm, true);
|
|
$out["sitemap_keys"] = is_array($smd) ? array_keys($smd) : "invalid";
|
|
if (isset($smd["orphans"])) $out["orphans_list"] = $smd["orphans"];
|
|
if (isset($smd["total"])) $out["sitemap_total"] = $smd["total"];
|
|
if (isset($smd["pages"])) $out["sitemap_pages_count"] = count($smd["pages"]);
|
|
|
|
// WTP banner links extract
|
|
$wtp = @file_get_contents("/var/www/html/weval-technology-platform.html");
|
|
preg_match_all("/href=[\"']([^\"']+\.html[^\"']*)[\"']/", $wtp, $m);
|
|
$links = array_unique($m[1] ?? []);
|
|
$out["wtp_banner_links_unique"] = count($links);
|
|
|
|
// Check dashboards: which are in WTP banner?
|
|
$dashboards = array_map("basename", glob("/var/www/html/*dashboard*.html") ?: []);
|
|
$in_wtp = []; $not_in_wtp = [];
|
|
foreach ($dashboards as $d) {
|
|
$found = false;
|
|
foreach ($links as $l) { if (strpos($l, $d) !== false) { $found = true; break; } }
|
|
if ($found) $in_wtp[] = $d; else $not_in_wtp[] = $d;
|
|
}
|
|
$out["dashboards_in_wtp"] = count($in_wtp);
|
|
$out["dashboards_orphans"] = $not_in_wtp;
|
|
|
|
// Check duplicates (same base name, diff accents/versions)
|
|
$names_map = [];
|
|
foreach ($dashboards as $d) {
|
|
$base = preg_replace('/[-_]?(v\d+|live|new|old)\.html$/i', '', $d);
|
|
$names_map[$base] = ($names_map[$base] ?? 0) + 1;
|
|
}
|
|
$dup_dashboards = array_filter($names_map, function($v){return $v>1;});
|
|
$out["potential_duplicates"] = $dup_dashboards;
|
|
|
|
echo json_encode($out, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);
|