diff options
author | Andrew Dolgov <[email protected]> | 2019-12-20 21:24:53 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2019-12-20 21:24:53 +0300 |
commit | bb7099ffb04f3d663f84d52bc5cc265db236c11e (patch) | |
tree | eae4df408eb7acd864a08de5c24d1305e0298a8c /include/functions.php | |
parent | 4b44103b849912714e2f044b62d158c8188f3a81 (diff) | |
parent | 021757ad5cccffb2030539a871e8117648eb5eae (diff) |
Merge branch 'master' of git.tt-rss.org:fox/tt-rss into weblate-integration
Diffstat (limited to 'include/functions.php')
-rw-r--r-- | include/functions.php | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/include/functions.php b/include/functions.php index f244b47b8..537139d18 100644 --- a/include/functions.php +++ b/include/functions.php @@ -1892,20 +1892,26 @@ function get_version(&$git_commit = false, &$git_timestamp = false) { global $ttrss_version; - if (isset($ttrss_version)) - return $ttrss_version; + if (is_array($ttrss_version) && isset($ttrss_version['version'])) { + $git_commit = $ttrss_version['commit']; + $git_timestamp = $ttrss_version['timestamp']; - $ttrss_version = "UNKNOWN (Unsupported)"; + return $ttrss_version['version']; + } else { + $ttrss_version = []; + } + + $ttrss_version['version'] = "UNKNOWN (Unsupported)"; date_default_timezone_set('UTC'); $root_dir = dirname(dirname(__FILE__)); if ('\\' === DIRECTORY_SEPARATOR) { - $ttrss_version = "UNKNOWN (Unsupported, Windows)"; + $ttrss_version['version'] = "UNKNOWN (Unsupported, Windows)"; } else if (PHP_OS === "Darwin") { - $ttrss_version = "UNKNOWN (Unsupported, Darwin)"; + $ttrss_version['version'] = "UNKNOWN (Unsupported, Darwin)"; } else if (file_exists("$root_dir/version_static.txt")) { - $ttrss_version = trim(file_get_contents("$root_dir/version_static.txt")) . " (Unsupported)"; + $ttrss_version['version'] = trim(file_get_contents("$root_dir/version_static.txt")) . " (Unsupported)"; } else if (is_dir("$root_dir/.git")) { $rc = 0; $output = []; @@ -1923,12 +1929,14 @@ $git_commit = $commit; $git_timestamp = $timestamp; - $ttrss_version = strftime("%y.%m", $timestamp) . "-$commit"; + $ttrss_version['version'] = strftime("%y.%m", $timestamp) . "-$commit"; + $ttrss_version['commit'] = $commit; + $ttrss_version['timestamp'] = $timestamp; } } else { user_error("Unable to determine version (using $root_dir): " . implode("\n", $output), E_USER_WARNING); } } - return $ttrss_version; + return $ttrss_version['version']; } |