show full commit timestamp with version information in prefs footer

This commit is contained in:
Andrew Dolgov 2022-12-30 09:46:01 +03:00
parent 4c94139113
commit 9c0ead3640
No known key found for this signature in database
GPG Key ID: 1A56B4FA25D4AF2A
2 changed files with 9 additions and 2 deletions

View File

@ -299,6 +299,13 @@ class Config {
return self::get_instance()->_get_version($as_string); return self::get_instance()->_get_version($as_string);
} }
// returns version showing (if possible) full timestamp of commit id
static function get_version_html() : string {
$version = self::get_version(false);
return sprintf("<span title=\"%s\">%s</span>", date("Y-m-d H:i:s", ($version['timestamp'] ?? 0)), $version['version']);
}
/** /**
* @return array<string, mixed>|string * @return array<string, mixed>|string
*/ */
@ -363,7 +370,7 @@ class Config {
if ($check == "version") { if ($check == "version") {
$rv["version"] = date("y.m", (int)$timestamp) . "-$commit"; $rv["version"] = sprintf("%s-%s", date("y.m", (int)$timestamp), $commit);
$rv["commit"] = $commit; $rv["commit"] = $commit;
$rv["timestamp"] = $timestamp; $rv["timestamp"] = $timestamp;

View File

@ -170,7 +170,7 @@
</div> </div>
<div id="footer" dojoType="dijit.layout.ContentPane" region="bottom"> <div id="footer" dojoType="dijit.layout.ContentPane" region="bottom">
<a class="text-muted" target="_blank" href="https://tt-rss.org/">Tiny Tiny RSS</a> <a class="text-muted" target="_blank" href="https://tt-rss.org/">Tiny Tiny RSS</a>
<span>v<?= Config::get_version() ?></span> <span>v<?= Config::get_version_html() ?></span>
&copy; 2005-<?= date('Y') ?> &copy; 2005-<?= date('Y') ?>
<a class="text-muted" target="_blank" href="https://fakecake.org/">Andrew Dolgov</a> <a class="text-muted" target="_blank" href="https://fakecake.org/">Andrew Dolgov</a>
</div> </div>