<?php
// The zoo's exhibit 30 (pushed by its robot): which branch this preview runs, and what its data
// holds. A POST writes this branch's word into the data, so the next branch asked for can find it.
const BRANCH = "e30-staging-a";
const WORD = "lynx-9000cb";
header("Content-Type: application/json");
header("Cache-Control: no-store");
$d = getenv("RC_DATA");
if (($_SERVER["REQUEST_METHOD"] ?? "GET") === "POST") file_put_contents("$d/e30-note.txt", BRANCH . " " . WORD);
$note = @file_get_contents("$d/e30-note.txt");
echo json_encode(["branch" => BRANCH, "word" => WORD, "env" => getenv("RC_ENV"), "note" => $note === false ? null : $note,
                  "files" => array_values(array_diff(scandir($d) ?: [], [".", ".."]))]), "\n";
