aboutsummaryrefslogtreecommitdiffhomepage
path: root/misc/get_version.php
diff options
context:
space:
mode:
authorwinter2025-01-18 22:41:17 +0000
committerwinter2025-01-18 22:49:41 +0000
commitf1a48c521472bde1c8668e29f8c5c792e1dd9f9f (patch)
tree21b89bf89204371de7a94042d8ed3d02c29d8516 /misc/get_version.php
parent5d55ae009cab1fe82f456111585d20795f4e865a (diff)
init script & fix the version info thing
yeah so turns out $Id$ is not what it seems
Diffstat (limited to 'misc/get_version.php')
-rw-r--r--misc/get_version.php14
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