Complete port of all 163 API endpoints from Lucee/CFML to PHP 8.3. Shared helpers in api/helpers.php (DB, auth, request/response, security). PDO prepared statements throughout. Same JSON response shapes as CFML.
34 lines
822 B
PHP
34 lines
822 B
PHP
<?php
|
|
require_once __DIR__ . '/../helpers.php';
|
|
runAuth();
|
|
|
|
try {
|
|
$sinceId = (int) ($_GET['since'] ?? 0);
|
|
|
|
$sql = "SELECT ID, UUID FROM BeaconShards WHERE IsActive = 1";
|
|
$params = [];
|
|
if ($sinceId > 0) {
|
|
$sql .= " AND ID > ?";
|
|
$params[] = $sinceId;
|
|
}
|
|
$sql .= " ORDER BY ID ASC";
|
|
|
|
$rows = queryTimed($sql, $params);
|
|
|
|
$shards = [];
|
|
$maxId = 0;
|
|
foreach ($rows as $r) {
|
|
$shards[] = ['ID' => (int) $r['ID'], 'UUID' => $r['UUID']];
|
|
if ((int) $r['ID'] > $maxId) $maxId = (int) $r['ID'];
|
|
}
|
|
|
|
jsonResponse([
|
|
'OK' => true,
|
|
'Version' => $maxId,
|
|
'Count' => count($shards),
|
|
'Shards' => $shards,
|
|
]);
|
|
|
|
} catch (Exception $e) {
|
|
jsonResponse(['OK' => false, 'ERROR' => 'server_error', 'MESSAGE' => $e->getMessage()]);
|
|
}
|