diff options
Diffstat (limited to 'misc/get_version.php')
| -rw-r--r-- | misc/get_version.php | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/misc/get_version.php b/misc/get_version.php index 8d48b4a..e9c255a 100644 --- a/misc/get_version.php +++ b/misc/get_version.php @@ -1,21 +1,13 @@ <?php -// because of the values in .gitattributes, these should get modified according -// to the current commit (on any checkout) and/or ref (in archive exports) -// don't touch these yourself even if they look wrong! -const __GIT_ID_INFO__ = '$Id$'; -const __GIT_REF_INFO__ = '$Format:%D$'; +const __VERSION_FILE = __DIR__ . '/../VERSION'; /** * Gets a version identifier for the currently checked out version of the software * @return string */ function get_version(): string { - if (str_contains(__GIT_REF_INFO__, 'tag: ')) { - return explode(',', explode('tag: ', __GIT_REF_INFO__, 2)[1], 2)[0]; - } - // have to do this janky string thing to stop git replacing this one as well :3 - if (__GIT_ID_INFO__ != '$' . 'Id$') { - return 'git ' . substr(__GIT_ID_INFO__, 5, 10); + if (is_readable(__VERSION_FILE)) { + return trim(file_get_contents(__VERSION_FILE)); } return 'unknown'; }
\ No newline at end of file |
