Changed how version information is stored and displayed

This commit is contained in:
Bernd Bestel 2018-05-12 15:49:21 +02:00
parent 5b5c272909
commit 89bae8d25e
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
6 changed files with 15 additions and 13 deletions

View File

@ -13,7 +13,9 @@ class BaseController
$this->Database = $databaseService->GetDbConnection(); $this->Database = $databaseService->GetDbConnection();
$applicationService = new ApplicationService(); $applicationService = new ApplicationService();
$container->view->set('version', $applicationService->GetInstalledVersion()); $versionInfo = $applicationService->GetInstalledVersion();
$container->view->set('version', $versionInfo->Version);
$container->view->set('releaseDate', $versionInfo->ReleaseDate);
$localizationService = new LocalizationService(CULTURE); $localizationService = new LocalizationService(CULTURE);
$container->view->set('localizationStrings', $localizationService->GetCurrentCultureLocalizations()); $container->view->set('localizationStrings', $localizationService->GetCurrentCultureLocalizations());

View File

@ -161,5 +161,6 @@ return array(
'#1 batteries are due to be charged within the next #2 days' => '#1 Batterien müssen in den nächsten #2 Tagen geladen werden', '#1 batteries are due to be charged within the next #2 days' => '#1 Batterien müssen in den nächsten #2 Tagen geladen werden',
'#1 batteries are overdue to be charged' => '#1 Batterien sind überfällig', '#1 batteries are overdue to be charged' => '#1 Batterien sind überfällig',
'#1 habits are due to be done within the next #2 days' => '#1 Gewohnheiten stehen in den nächsten #2 Tagen an', '#1 habits are due to be done within the next #2 days' => '#1 Gewohnheiten stehen in den nächsten #2 Tagen an',
'#1 habits are overdue to be done' => '#1 Gewohnheiten sind überfällig' '#1 habits are overdue to be done' => '#1 Gewohnheiten sind überfällig',
'Released on' => 'Veröffentlicht am'
); );

View File

@ -13,14 +13,11 @@ class ApplicationService extends BaseService
} }
private $InstalledVersion; private $InstalledVersion;
/**
* @return string
*/
public function GetInstalledVersion() public function GetInstalledVersion()
{ {
if ($this->InstalledVersion == null) if ($this->InstalledVersion == null)
{ {
$this->InstalledVersion = preg_replace("/\r|\n/", '', file_get_contents(__DIR__ . '/../version.txt')); $this->InstalledVersion = json_decode(file_get_contents(__DIR__ . '/../version.json'));
} }
return $this->InstalledVersion; return $this->InstalledVersion;

4
version.json Normal file
View File

@ -0,0 +1,4 @@
{
"Version": "1.10.0",
"ReleaseDate": "2018-05-12"
}

View File

@ -1 +0,0 @@
1.9.2

View File

@ -86,14 +86,13 @@
</div> </div>
<div class="modal-body"> <div class="modal-body">
grocy is a project by grocy is a project by
<a href="https://berrnd.de" target="_blank">Bernd Bestel</a> <a href="https://berrnd.de" target="_blank">Bernd Bestel</a><br>
Created with passion since 2017<br>
<br> <br>
Created with passion since 2017 Version {{ $version }}<br>
<br> {{ $L('Released on') }} {{ $releaseDate }} <time class="timeago timeago-contextual" datetime="{{ $releaseDate }}"></time><br>
Version {{ $version }}
<br>
Life runs on code
<br> <br>
Life runs on code<br>
<a href="https://github.com/berrnd/grocy" target="_blank"> <a href="https://github.com/berrnd/grocy" target="_blank">
<i class="fa fa-github"></i> <i class="fa fa-github"></i>
</a> </a>