forked from grommunio/grommunio-dav
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathversion.php
More file actions
21 lines (19 loc) · 715 Bytes
/
Copy pathversion.php
File metadata and controls
21 lines (19 loc) · 715 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
/*
* SPDX-License-Identifier: AGPL-3.0-only
* SPDX-FileCopyrightText: Copyright 2016 - 2018 Kopano b.v.
* SPDX-FileCopyrightText: Copyright 2020 grommunio GmbH
*
* Version file for GrommunioDAV.
*/
if (!defined("GDAV_VERSION")) {
$path = escapeshellarg(dirname(realpath($_SERVER['SCRIPT_FILENAME'])));
$branch = trim(exec("hash git 2>/dev/null && cd {$path} >/dev/null 2>&1 && git branch --no-color 2>/dev/null | sed -e '/^[^*]/d' -e \"s/* \\(.*\\)/\\1/\""));
$version = exec("hash git 2>/dev/null && cd {$path} >/dev/null 2>&1 && git describe --always 2>/dev/null");
if ($branch && $version) {
define("GDAV_VERSION", $branch . '-' . $version);
}
else {
define("GDAV_VERSION", "GIT");
}
}