]> git.wh0rd.org - tt-rss.git/blame - include/version.php
bump version_static
[tt-rss.git] / include / version.php
CommitLineData
1d3a17c7 1<?php
75e765aa 2 define('VERSION_STATIC', '18.8');
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
af3663ed
TB
17 if (!file_exists("$root_dir/.git/$ref"))
18 return VERSION_STATIC;
7843453c
AD
19 $suffix = substr(trim(file_get_contents("$root_dir/.git/$ref")), 0, 7);
20 $timestamp = filemtime("$root_dir/.git/$ref");
21
22 define("GIT_VERSION_HEAD", $suffix);
23 define("GIT_VERSION_TIMESTAMP", $timestamp);
24
25 return VERSION_STATIC . " ($suffix)";
26
27 } else {
583d5b9a 28 $suffix = substr(trim($head), 0, 7);
7843453c
AD
29 $timestamp = filemtime("$root_dir/.git/HEAD");
30
31 define("GIT_VERSION_HEAD", $suffix);
32 define("GIT_VERSION_TIMESTAMP", $timestamp);
33
34 return VERSION_STATIC . " ($suffix)";
35 }
36 }
6316898f 37 }
7843453c
AD
38
39 return VERSION_STATIC;
40
6316898f
AD
41 }
42
43 define('VERSION', get_version());