From 84a178dd788c5fc129932fb84b23b0718ac667fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20E=C3=9Fl?= <indy.essl@gmail.com> Date: Sat, 15 Feb 2020 17:51:52 +0100 Subject: [PATCH] [FEATURE] Show application context in the Environment module The "Environment Overview" card in the admin tool will now show the application context the TYPO3 instance is running with. Resolves: #90136 Releases: master Change-Id: Ia9583ac093cdeba341e8cd079bbac341098a3b76 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/63259 Tested-by: TYPO3com <noreply@typo3.com> Tested-by: Nikita Hovratov <nikita.h@live.de> Tested-by: Georg Ringer <georg.ringer@gmail.com> Tested-by: Daniel Goerz <daniel.goerz@posteo.de> Reviewed-by: Nikita Hovratov <nikita.h@live.de> Reviewed-by: Georg Ringer <georg.ringer@gmail.com> Reviewed-by: Daniel Goerz <daniel.goerz@posteo.de> --- ...plicationContextInTheEnvironmentModule.rst | 22 +++++++++++++++++++ .../Controller/EnvironmentController.php | 18 +++++++++++++++ .../Private/Templates/Environment/Cards.html | 2 +- .../Environment/SystemInformation.html | 4 ++++ 4 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 typo3/sysext/core/Documentation/Changelog/master/Feature-90136-ShowApplicationContextInTheEnvironmentModule.rst diff --git a/typo3/sysext/core/Documentation/Changelog/master/Feature-90136-ShowApplicationContextInTheEnvironmentModule.rst b/typo3/sysext/core/Documentation/Changelog/master/Feature-90136-ShowApplicationContextInTheEnvironmentModule.rst new file mode 100644 index 000000000000..6c8847faa88e --- /dev/null +++ b/typo3/sysext/core/Documentation/Changelog/master/Feature-90136-ShowApplicationContextInTheEnvironmentModule.rst @@ -0,0 +1,22 @@ +.. include:: ../../Includes.txt + +==================================================================== +Feature: #90136 - Show application context in the Environment module +==================================================================== + +See :issue:`90136` + +Description +=========== + +The "Environment Overview" card in the admin tool will now show the +application context the TYPO3 instance is running with. + + +Impact +====== + +You can now look up the application context from inside the admin tool without +having to log into the TYPO3 backend. + +.. index:: ext:install diff --git a/typo3/sysext/install/Classes/Controller/EnvironmentController.php b/typo3/sysext/install/Classes/Controller/EnvironmentController.php index e90801cd7a01..65e09dff4968 100644 --- a/typo3/sysext/install/Classes/Controller/EnvironmentController.php +++ b/typo3/sysext/install/Classes/Controller/EnvironmentController.php @@ -18,6 +18,7 @@ namespace TYPO3\CMS\Install\Controller; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Symfony\Component\Mime\Address; +use TYPO3\CMS\Backend\Toolbar\Enumeration\InformationStatus; use TYPO3\CMS\Core\Core\Environment; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\FormProtection\FormProtectionFactory; @@ -73,6 +74,7 @@ class EnvironmentController extends AbstractController 'systemInformationCgiDetected' => GeneralUtility::isRunningOnCgiServerApi(), 'systemInformationDatabaseConnections' => $this->getDatabaseConnectionInformation(), 'systemInformationOperatingSystem' => Environment::isWindows() ? 'Windows' : 'Unix', + 'systemInformationApplicationContext' => $this->getApplicationContextInformation(), 'phpVersion' => PHP_VERSION, ]); return new JsonResponse([ @@ -990,6 +992,22 @@ class EnvironmentController extends AbstractController return $connectionInfos; } + /** + * Get details about the application context + * + * @return array + */ + protected function getApplicationContextInformation(): array + { + $applicationContext = Environment::getContext(); + $status = $applicationContext->isProduction() ? InformationStatus::STATUS_OK : InformationStatus::STATUS_WARNING; + + return [ + 'context' => (string)$applicationContext, + 'status' => $status, + ]; + } + /** * Get sender address from configuration * ['TYPO3_CONF_VARS']['MAIL']['defaultMailFromAddress'] diff --git a/typo3/sysext/install/Resources/Private/Templates/Environment/Cards.html b/typo3/sysext/install/Resources/Private/Templates/Environment/Cards.html index d0bae2147900..46018d334623 100644 --- a/typo3/sysext/install/Resources/Private/Templates/Environment/Cards.html +++ b/typo3/sysext/install/Resources/Private/Templates/Environment/Cards.html @@ -6,7 +6,7 @@ <div class="card card-size-fixed-small"> <f:render partial="Card/Header" arguments="{ title: 'Environment Overview', subtitle: 'Environment', icon: 'Icons/modules/install-show-environment.svg'}" /> <div class="card-content"> - <p class="card-text">Gives an overview of your host environment including its web server, PHP version and selected database.</p> + <p class="card-text">Gives an overview of your host environment including its web server, PHP version, selected database and the application context.</p> </div> <div class="card-footer"> <a href="#" class="btn btn-default" data-modal-size="small" data-require="TYPO3/CMS/Install/Module/Environment/SystemInformation">Show System Information</a> diff --git a/typo3/sysext/install/Resources/Private/Templates/Environment/SystemInformation.html b/typo3/sysext/install/Resources/Private/Templates/Environment/SystemInformation.html index a8242bcef39f..8a558ed6b898 100644 --- a/typo3/sysext/install/Resources/Private/Templates/Environment/SystemInformation.html +++ b/typo3/sysext/install/Resources/Private/Templates/Environment/SystemInformation.html @@ -53,6 +53,10 @@ </td> </tr> </f:for> + <tr> + <td>Application Context:</td> + <td><strong class="text-{systemInformationApplicationContext.status}">{systemInformationApplicationContext.context}</strong></td> + </tr> </table> </html> -- GitLab