Skip to content

Commit

Permalink
Extension: Curren version can be undetectable.
Browse files Browse the repository at this point in the history
  • Loading branch information
janbarasek authored Jan 14, 2022
1 parent 326cdd9 commit 83b2bda
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/CmsExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,17 @@ public function beforeCompile(): void
->setFactory(TranslatorFilter::class);

// settings
$currentVersion = null;
if (PHP_SAPI !== 'cli') {
try {
$currentVersion = PrettyVersions::getVersion('baraja-core/cms')->getPrettyVersion();
} catch (\Throwable $e) {
trigger_error(sprintf('Can not get CMS version: %s', $e->getMessage()));
}
}
$builder->addDefinition($this->prefix('settings'))
->setFactory(Settings::class)
->setArgument('currentVersion', PrettyVersions::getVersion('baraja-core/cms')->getPrettyVersion());
->setArgument('currentVersion', $currentVersion ?? '?');

$builder->addDefinition($this->prefix('tokenStorage'))
->setFactory(CmsConstantTokenStorage::class);
Expand Down

0 comments on commit 83b2bda

Please sign in to comment.