version.php 598 B

1234567891011121314151617181920212223
  1. <?php
  2. define('VERSION_STATIC', '16.1');
  3. function get_version() {
  4. date_default_timezone_set('UTC');
  5. $root_dir = dirname(dirname(__FILE__));
  6. if (is_dir("$root_dir/.git") && file_exists("$root_dir/.git/refs/heads/master")) {
  7. $suffix = substr(trim(file_get_contents("$root_dir/.git/refs/heads/master")), 0, 7);
  8. $timestamp = filemtime("$root_dir/.git/refs/heads/master");
  9. define("GIT_VERSION_HEAD", $suffix);
  10. define("GIT_VERSION_TIMESTAMP", $timestamp);
  11. return VERSION_STATIC . " ($suffix)";
  12. } else {
  13. return VERSION_STATIC;
  14. }
  15. }
  16. define('VERSION', get_version());
  17. ?>