diff --git a/composer.json b/composer.json index 829d5e7db..8fc4c300e 100644 --- a/composer.json +++ b/composer.json @@ -21,6 +21,7 @@ "ext-openssl": "*", "ext-redis": "*", "ext-zlib": "*", + "composer-runtime-api": "*", "champs-libres/wopi-bundle": "dev-symfony-v5@dev", "champs-libres/wopi-lib": "dev-master@dev", "doctrine/data-fixtures": "^1.8", diff --git a/src/Bundle/ChillMainBundle/Resources/views/Layout/_footer.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Layout/_footer.html.twig index df6ba912b..18e8d2a67 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Layout/_footer.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Layout/_footer.html.twig @@ -2,6 +2,8 @@
{{ 'This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License'|trans|raw }}
+ {{ 'Running chill version %version%'|trans({ '%version%': chillBundlesVersion }) }}
+
{{ 'User manual'|trans }}
diff --git a/src/Bundle/ChillMainBundle/Service/VersionProvider.php b/src/Bundle/ChillMainBundle/Service/VersionProvider.php
new file mode 100644
index 000000000..c35f22933
--- /dev/null
+++ b/src/Bundle/ChillMainBundle/Service/VersionProvider.php
@@ -0,0 +1,50 @@
+packageName = $packageName;
+ }
+
+ public function getVersion(): string
+ {
+ try {
+ $version = InstalledVersions::getPrettyVersion($this->packageName);
+
+ if (null === $version) {
+ return 'unknown';
+ }
+
+ return $version;
+ } catch (\OutOfBoundsException $e) {
+ return 'unknown';
+ }
+ }
+
+ public function getFormattedVersion(): string
+ {
+ $version = $this->getVersion();
+
+ if ('unknown' === $version) {
+ return 'Version unavailable';
+ }
+
+ return 'v'.$version;
+ }
+}
diff --git a/src/Bundle/ChillMainBundle/config/services.yaml b/src/Bundle/ChillMainBundle/config/services.yaml
index d8d4a475d..0a2154bcb 100644
--- a/src/Bundle/ChillMainBundle/config/services.yaml
+++ b/src/Bundle/ChillMainBundle/config/services.yaml
@@ -115,3 +115,7 @@ services:
$vienEntityInfoProviders: !tagged_iterator chill_main.entity_info_provider
Chill\MainBundle\Action\User\UpdateProfile\UpdateProfileCommandHandler: ~
+
+ Chill\MainBundle\Service\VersionProvider:
+ arguments:
+ $packageName: ''