Added version timeline.

This commit is contained in:
2018-02-17 01:25:07 +01:00
parent 3d02aaea3a
commit 01659d4cfd
3 changed files with 160 additions and 1 deletions
+38
View File
@@ -85,6 +85,21 @@ class SQLiteReader
return $result;
}
public function getAllVariantsByRef()
{
$sql = 'SELECT f.name AS family, m.name AS model, d.curef, d.name AS variant FROM families f LEFT JOIN models m ON f.familyId=m.familyId LEFT JOIN devices d ON m.modelId=d.modelId;';
$sqlresult = $this->pdo->query($sql);
$result = array();
foreach ($sqlresult->fetchAll(\PDO::FETCH_ASSOC) as $row) {
$result[$row['curef']] = array(
'family' => $row['family'],
'model' => $row['model'],
'variant' => $row['variant'],
);
}
return $result;
}
public function getAllUpdates($curef, $which = self::BOTH)
{
$sql = 'SELECT * FROM updates u LEFT JOIN files f ON u.file_sha1=f.sha1 WHERE curef=?';
@@ -99,6 +114,29 @@ class SQLiteReader
return $result;
}
public function getAllUpdatesForFile($sha1)
{
$sql = 'SELECT * FROM updates u WHERE u.file_sha1=? ORDER BY pubDate ASC';
$stmt = $this->pdo->prepare($sql);
$ok = $stmt->execute(array($sha1));
$result = $stmt->fetchAll(\PDO::FETCH_ASSOC);
return $result;
}
public function getAllFiles($which = self::BOTH)
{
$sql = 'SELECT * FROM files f';
if ($which == self::OTA_ONLY) {
$sql .= ' WHERE fv IS NOT null';
} elseif ($which == self::FULL_ONLY) {
$sql .= ' WHERE fv IS null';
}
$sql .= ' ORDER BY published_first DESC';
$stmt = $this->pdo->query($sql);
$result = $stmt->fetchAll(\PDO::FETCH_ASSOC);
return $result;
}
public function getLatestUpdate($curef, $which = self::BOTH)
{
$sql = 'SELECT * FROM updates u LEFT JOIN files f ON u.file_sha1=f.sha1 WHERE curef=?';