28 lines
837 B
PHP
28 lines
837 B
PHP
<?php
|
|
header("Content-Type: application/json");
|
|
$path = "/var/www/html/oss-catalog.html";
|
|
$c = @file_get_contents($path);
|
|
$orig = strlen($c);
|
|
|
|
if (strpos($c, "dashboards-hub-unified") !== false) {
|
|
echo json_encode(["already"=>true]);
|
|
exit;
|
|
}
|
|
|
|
// Inject in footer
|
|
$old = '<a href="/dashboards-index.html">Dashboards</a>';
|
|
$new = '<a href="/dashboards-hub-unified.html">📊 Hub Dashboards</a> · <a href="/dashboards-index.html">Index</a>';
|
|
|
|
if (strpos($c, $old) !== false) {
|
|
$c = str_replace($old, $new, $c);
|
|
$backup = "/opt/wevads/vault/oss-catalog.GOLD-" . date("Ymd-His") . "-wave246";
|
|
@copy($path, $backup);
|
|
$wrote = @file_put_contents($path, $c);
|
|
echo json_encode([
|
|
"wrote" => $wrote,
|
|
"delta" => strlen($c) - $orig,
|
|
]);
|
|
} else {
|
|
echo json_encode(["error"=>"anchor not found"]);
|
|
}
|