]> git.wh0rd.org - tt-rss.git/blame - include/version.php
bump VERSION_STATIC due to Dojo changes
[tt-rss.git] / include / version.php
CommitLineData
1d3a17c7 1<?php
a8625557 2 define('VERSION_STATIC', '17.1');
6316898f
AD
3
4 function get_version() {
50d4b30b 5 date_default_timezone_set('UTC');
6316898f
AD
6 $root_dir = dirname(dirname(__FILE__));
7
7843453c
AD
8 if (is_dir("$root_dir/.git") && file_exists("$root_dir/.git/HEAD")) {
9 $head = trim(file_get_contents("$root_dir/.git/HEAD"));
6316898f 10
7843453c
AD
11 if ($head) {
12 $matches = array();
efcc5d36 13
7843453c
AD
14 if (preg_match("/^ref: (.*)/", $head, $matches)) {
15 $ref = $matches[1];
6316898f 16
7843453c
AD
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 {
583d5b9a 26 $suffix = substr(trim($head), 0, 7);
7843453c
AD
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 }
6316898f 35 }
7843453c
AD
36
37 return VERSION_STATIC;
38
6316898f
AD
39 }
40
41 define('VERSION', get_version());
da61567a 42?>