]> git.wh0rd.org - tt-rss.git/commitdiff
special version reporting for git
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Tue, 23 Apr 2013 16:22:55 +0000 (20:22 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Tue, 23 Apr 2013 16:22:55 +0000 (20:22 +0400)
include/version.php

index 61851dffb80a6163004f9a68882a95b40ecb8d19..07b6c4a00ebfb14862d5a8192c2786600c11d446 100644 (file)
@@ -1,3 +1,18 @@
 <?php
-       define('VERSION', "1.7.8");
+       define('VERSION_STATIC', '1.7.8');
+
+       function get_version() {
+               $root_dir = dirname(dirname(__FILE__));
+
+               if (is_dir("$root_dir/.git") && file_exists("$root_dir/.git/ORIG_HEAD")) {
+
+                       $suffix = date("Ymd", filemtime("$root_dir/.git/ORIG_HEAD"));
+
+                       return VERSION_STATIC . ".$suffix";
+               } else {
+                       return VERSION_STATIC;
+               }
+       }
+
+       define('VERSION', get_version());
 ?>