add support for custom version_static.txt for package maintainers

This commit is contained in:
Andrew Dolgov 2019-12-08 08:58:23 +03:00
parent 76dd74e0d9
commit 5907409a84
1 changed files with 7 additions and 1 deletions

View File

@ -1,12 +1,18 @@
<?php
/* for package maintainers who don't use git: if version_static.txt exists in tt-rss root
directory, its contents are displayed instead of git commit-based version, this could be generated
based on source git tree commit used when creating the package */
function get_version(&$git_commit = false, &$git_timestamp = false) {
$version = "UNKNOWN (Unsupported)";
date_default_timezone_set('UTC');
$root_dir = dirname(dirname(__FILE__));
if (is_dir("$root_dir/.git")) {
if (file_exists("$root_dir/version_static.txt")) {
$version = file_get_contents("$root_dir/version_static.txt") . " (Unsupported)";
} else if (is_dir("$root_dir/.git")) {
$rc = 0;
$output = [];