If this looks okay my GitLab username is "wn_", and I don't currently have developer privileges. Just let me know if anything needs to be tweaked.
Code: Select all
commit 38d3697800967857d3b67562a0d8fe4163ad2747
Author: wn_ <[email protected]>
Date: Sat Feb 4 14:05:22 2017 -0600
Add 'VERSION_WITH_COMPARE_LINK', which includes a link to compare the current commit to master.
Use 'VERSION_WITH_COMPARE_LINK' in the Preferences page footer.
diff --git a/include/version.php b/include/version.php
index bc8e869..a7af431 100644
--- a/include/version.php
+++ b/include/version.php
@@ -1,7 +1,7 @@
<?php
define('VERSION_STATIC', '17.1');
- function get_version() {
+ function get_version($compare_master_link = false) {
date_default_timezone_set('UTC');
$root_dir = dirname(dirname(__FILE__));
@@ -11,26 +11,23 @@
if ($head) {
$matches = array();
- if (preg_match("/^ref: (.*)/", $head, $matches)) {
+ if (preg_match('/^ref: (.*)/', $head, $matches)) {
$ref = $matches[1];
-
- $suffix = substr(trim(file_get_contents("$root_dir/.git/$ref")), 0, 7);
+ $commit_hash = trim(file_get_contents("$root_dir/.git/$ref"));
$timestamp = filemtime("$root_dir/.git/$ref");
-
- define("GIT_VERSION_HEAD", $suffix);
- define("GIT_VERSION_TIMESTAMP", $timestamp);
-
- return VERSION_STATIC . " ($suffix)";
-
} else {
- $suffix = substr(trim($head), 0, 7);
+ $commit_hash = $head;
$timestamp = filemtime("$root_dir/.git/HEAD");
+ }
- define("GIT_VERSION_HEAD", $suffix);
- define("GIT_VERSION_TIMESTAMP", $timestamp);
+ $commit_hash_short = substr($commit_hash, 0, 7);
+ define('GIT_VERSION_HEAD', $commit_hash_short);
+ define('GIT_VERSION_TIMESTAMP', $timestamp);
- return VERSION_STATIC . " ($suffix)";
+ if ($compare_master_link) {
+ return VERSION_STATIC . " (<a href='https://tt-rss.org/gitlab/fox/tt-rss/compare/{$commit_hash}...master'>$commit_hash_short</a>)";
}
+ return VERSION_STATIC . " ($commit_hash_short)";
}
}
@@ -39,4 +36,5 @@
}
define('VERSION', get_version());
+ define('VERSION_WITH_COMPARE_LINK', get_version(true));
?>
diff --git a/prefs.php b/prefs.php
index b1cdb0b..141dca6 100644
--- a/prefs.php
+++ b/prefs.php
@@ -161,7 +161,7 @@
<a class="insensitive" target="_blank" href="http://tt-rss.org/">
Tiny Tiny RSS</a>
<?php if (!defined('HIDE_VERSION')) { ?>
- v<?php echo VERSION ?>
+ v<?php echo VERSION_WITH_COMPARE_LINK ?>
<?php } ?>
© 2005-<?php echo date('Y') ?>
<a class="insensitive" target="_blank"