version.php 446 B

12345678910111213141516171819
  1. <?php
  2. define('VERSION_STATIC', '1.15.3');
  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. return VERSION_STATIC . ".$suffix";
  9. } else {
  10. return VERSION_STATIC;
  11. }
  12. }
  13. define('VERSION', get_version());
  14. ?>