<?php
require_once __DIR__."/havenstone_flow_verifier.php";
header('Content-Type: application/json');
$root=rtrim($_SERVER['DOCUMENT_ROOT'],'/');
$urls=["https://heavenstoneholdings.com/","https://heavenstoneholdings.com/rooms/central_control/"];
$x='<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
foreach($urls as $u){$x.="<url><loc>$u</loc><lastmod>".gmdate('Y-m-d')."</lastmod></url>";}
$x.="</urlset>";
file_put_contents("$root/sitemap.xml",$x);
$log="$root/COMMAND_CENTER/LOGS/nova_sitemap_".gmdate('Ymd_His').".json";
file_put_contents($log,json_encode(['ts'=>gmdate('c'),'urls'=>count($urls)],JSON_PRETTY_PRINT));
echo json_encode(['ok'=>true,'urls'=>count($urls)]);
?>