20 lines
850 B
PHP
20 lines
850 B
PHP
<?php
|
|
header("Content-Type: application/json");
|
|
$f = '/opt/wevia-brain/DORMANT-CAPABILITIES-ARCHIVE.json';
|
|
if (!is_readable($f)) { echo json_encode(['error' => 'archive not readable']); exit; }
|
|
$d = json_decode(@file_get_contents($f), true);
|
|
if (!$d) { echo json_encode(['error' => 'json parse failed']); exit; }
|
|
|
|
// Summary
|
|
$summary = ['date' => $d['date'] ?? '?', 'reason' => $d['reason'] ?? '?', 'categories' => []];
|
|
foreach (($d['categories'] ?? []) as $cat => $info) {
|
|
$summary['categories'][$cat] = [
|
|
'count' => $info['count'] ?? 0,
|
|
'location' => $info['location'] ?? '?',
|
|
'status' => $info['status'] ?? '?',
|
|
'sample_files' => array_slice($info['files'] ?? [], 0, 5),
|
|
];
|
|
}
|
|
$summary['total_files'] = array_sum(array_column($summary['categories'], 'count'));
|
|
echo json_encode($summary, JSON_PRETTY_PRINT);
|