aboutsummaryrefslogtreecommitdiffhomepage
path: root/misc
diff options
context:
space:
mode:
Diffstat (limited to 'misc')
-rw-r--r--misc/.gitattributes1
-rw-r--r--misc/get_version.php14
2 files changed, 3 insertions, 12 deletions
diff --git a/misc/.gitattributes b/misc/.gitattributes
deleted file mode 100644
index e383d5c..0000000
--- a/misc/.gitattributes
+++ /dev/null
@@ -1 +0,0 @@
-get_version.php ident export-subst \ No newline at end of file
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