1
0

Added JSON list of all CURefs and their latest versions.

This commit is contained in:
2017-12-17 02:15:59 +01:00
parent b598ed8d0c
commit c8dd58aab1
2 changed files with 44 additions and 0 deletions

27
json_lastupdates.php Executable file
View File

@ -0,0 +1,27 @@
<?php
require_once __DIR__ . '/lib/autoloader.php';
use \TclUpdates\SQLiteReader;
$db = new SQLiteReader();
$refs = $db->getAllRefs();
$vars = $db->getAllVariantsFlat();
$output = array();
foreach ($refs as $ref) {
$lastOta = $db->getLatestUpdate($ref, $db::OTA_ONLY);
$lastFull = $db->getLatestUpdate($ref, $db::FULL_ONLY);
$output[$ref] = array(
'curef' => $ref,
'variant' => $vars[$ref],
'last_ota' => $lastOta['tv'],
'last_full' => $lastFull['tv'],
);
}
header('Content-Type: text/json');
echo json_encode($output);