]>
git.wh0rd.org - tt-rss.git/blob - include/version.php
2 define('VERSION_STATIC', '18.8');
4 function get_version() {
5 date_default_timezone_set('UTC');
6 $root_dir = dirname(dirname(__FILE__
));
8 if (is_dir("$root_dir/.git") && file_exists("$root_dir/.git/HEAD")) {
9 $head = trim(file_get_contents("$root_dir/.git/HEAD"));
14 if (preg_match("/^ref: (.*)/", $head, $matches)) {
17 if (!file_exists("$root_dir/.git/$ref"))
18 return VERSION_STATIC
;
19 $suffix = substr(trim(file_get_contents("$root_dir/.git/$ref")), 0, 7);
20 $timestamp = filemtime("$root_dir/.git/$ref");
22 define("GIT_VERSION_HEAD", $suffix);
23 define("GIT_VERSION_TIMESTAMP", $timestamp);
25 return VERSION_STATIC
. " ($suffix)";
28 $suffix = substr(trim($head), 0, 7);
29 $timestamp = filemtime("$root_dir/.git/HEAD");
31 define("GIT_VERSION_HEAD", $suffix);
32 define("GIT_VERSION_TIMESTAMP", $timestamp);
34 return VERSION_STATIC
. " ($suffix)";
39 return VERSION_STATIC
;
43 define('VERSION', get_version());