From 01659d4cfdc1b83e49747f6a65543406521ea074 Mon Sep 17 00:00:00 2001 From: Markus Birth Date: Sat, 17 Feb 2018 01:25:07 +0100 Subject: [PATCH] Added version timeline. --- assets/style.css | 41 ++++++++++++++++- lib/TclUpdates/SQLiteReader.php | 38 +++++++++++++++ timeline.php | 82 +++++++++++++++++++++++++++++++++ 3 files changed, 160 insertions(+), 1 deletion(-) create mode 100755 timeline.php diff --git a/assets/style.css b/assets/style.css index b4794bd..3b02893 100644 --- a/assets/style.css +++ b/assets/style.css @@ -11,8 +11,12 @@ body { font-family: sans-serif; } +body.timeline { + background-color: #eee; +} + main { - overflow: scroll; + overflow: auto; } .panel { @@ -60,3 +64,38 @@ tr:hover { td.fullonly { color: #88f; } + +.release-card { + background-color: white; + border-radius: 12px 4px; + width: 80%; + margin: 20px auto; + padding: 12px; +} + +.release-card .version { + font-weight: bold; + font-size: 1.5em; + display: table-cell; +} + +.release-card .date { + display: table-cell; + padding-left: 2em; +} + +.release-card .date span { + font-weight: bold; +} + +.release-card .devices { + display: table-cell; + padding-left: 2em; +} + +.release-card .devices span { + font-weight: bold; +} + +.release-card .lastreleased { +} diff --git a/lib/TclUpdates/SQLiteReader.php b/lib/TclUpdates/SQLiteReader.php index 2791c64..dec3f86 100644 --- a/lib/TclUpdates/SQLiteReader.php +++ b/lib/TclUpdates/SQLiteReader.php @@ -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=?'; diff --git a/timeline.php b/timeline.php new file mode 100755 index 0000000..86b3717 --- /dev/null +++ b/timeline.php @@ -0,0 +1,82 @@ + + + + + BlackBerry/TCL Firmware Timeline + + + + + + + + +getAllVariantsByRef(); +$unknowns = $db->getUnknownRefs(); +if (count($unknowns) > 0) { + foreach ($unknowns as $uref) { + $allVars[$uref] = array( + 'family' => 'Unknown', + 'model' => 'Model', + 'variant' => '', + ); + } +} + +?> +
+
+
+ BlackBerry/TCL Firmware Timeline +
+
+
+
+
+getAllFiles($db::FULL_ONLY); +foreach ($allfiles as $file) { + $updates = $db->getAllUpdatesForFile($file['sha1']); + $validRefs = array(); + $validDevs = array(); + foreach ($updates as $u) { + $dev = $allVars[$u['curef']]; + $validRefs[] = $u['curef']; + $validDevs[] = $dev['family'] . ' ' . $dev['model']; + } + $validDevs = array_unique($validDevs); + sort($validDevs); + $device = $allVars[$updates[0]['curef']]; + $date = new DateTime($file['published_first']); + $date->setTimezone(new DateTimeZone('CET')); + $dateLast = new DateTime($file['published_last']); + $dateLast->setTimezone(new DateTimeZone('CET')); + echo '
'; + echo '
'; + echo '
' . $file['tv']; + if ($file['fv']) { + echo '(OTA from ' . $file['fv'] . ')'; + } + echo '
'; + echo '
' . $date->format('Y-m-d') . ' ' . $date->format('H:i.s') . ' CET
'; + echo '
' . implode(' / ', $validDevs) . '
'; + echo '
Last released: ' . $dateLast->format('Y-m-d H:i.s') . '
'; + echo '
Valid for (order of release): ' . implode(', ', $validRefs) . '
'; + #print_r($file); + #print_r($updates); + echo '
'; +} + +?> +
+ +