]> git.wh0rd.org - tt-rss.git/blob - include/version.php
bump VERSION_STATIC due to Dojo changes
[tt-rss.git] / include / version.php
1 <?php
2 define('VERSION_STATIC', '17.1');
3
4 function get_version() {
5 date_default_timezone_set('UTC');
6 $root_dir = dirname(dirname(__FILE__));
7
8 if (is_dir("$root_dir/.git") && file_exists("$root_dir/.git/HEAD")) {
9 $head = trim(file_get_contents("$root_dir/.git/HEAD"));
10
11 if ($head) {
12 $matches = array();
13
14 if (preg_match("/^ref: (.*)/", $head, $matches)) {
15 $ref = $matches[1];
16
17 $suffix = substr(trim(file_get_contents("$root_dir/.git/$ref")), 0, 7);
18 $timestamp = filemtime("$root_dir/.git/$ref");
19
20 define("GIT_VERSION_HEAD", $suffix);
21 define("GIT_VERSION_TIMESTAMP", $timestamp);
22
23 return VERSION_STATIC . " ($suffix)";
24
25 } else {
26 $suffix = substr(trim($head), 0, 7);
27 $timestamp = filemtime("$root_dir/.git/HEAD");
28
29 define("GIT_VERSION_HEAD", $suffix);
30 define("GIT_VERSION_TIMESTAMP", $timestamp);
31
32 return VERSION_STATIC . " ($suffix)";
33 }
34 }
35 }
36
37 return VERSION_STATIC;
38
39 }
40
41 define('VERSION', get_version());
42 ?>