Fixed version display in prerelease mode

This commit is contained in:
Bernd Bestel 2019-09-18 17:27:47 +02:00
parent 2237e2f8f4
commit ca470ed4ee
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300

View File

@ -9,19 +9,15 @@ class ApplicationService extends BaseService
{
if ($this->InstalledVersion == null)
{
$this->InstalledVersion = json_decode(file_get_contents(__DIR__ . '/../version.json'));
if (GROCY_MODE === 'prerelease')
{
$commitHash = trim(exec('git log --pretty="%h" -n1 HEAD'));
$commitDate = trim(exec('git log --date=iso --pretty="%cd" -n1 HEAD'));
$this->InstalledVersion = array(
'Version' => "pre-release-$commitHash",
'ReleaseDate' => substr($commitDate, 0, 19)
);
}
else
{
$this->InstalledVersion = json_decode(file_get_contents(__DIR__ . '/../version.json'));
$this->InstalledVersion->Version = "pre-release-$commitHash";
$this->InstalledVersion->ReleaseDate = substr($commitDate, 0, 19);
}
}