‪TYPO3CMS  10.4
EnvironmentStatusReport.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
28 
34 {
40  public function ‪getStatus()
41  {
42  return $this->‪getStatusInternal(false);
43  }
44 
50  public function ‪getDetailedStatus()
51  {
52  return $this->‪getStatusInternal(true);
53  }
54 
59  protected function ‪getStatusInternal($verbose)
60  {
61  $statusMessageQueue = new ‪FlashMessageQueue('install');
62  foreach (GeneralUtility::makeInstance(Check::class)->‪getStatus() as $message) {
63  $statusMessageQueue->enqueue($message);
64  }
65  foreach (GeneralUtility::makeInstance(SetupCheck::class)->‪getStatus() as $message) {
66  $statusMessageQueue->enqueue($message);
67  }
68  foreach (GeneralUtility::makeInstance(DatabaseCheck::class)->‪getStatus() as $message) {
69  $statusMessageQueue->enqueue($message);
70  }
71  $reportStatusTypes = [
72  'error' => [],
73  'warning' => [],
74  'ok' => [],
75  'information' => [],
76  'notice' => [],
77  ];
78  foreach ($statusMessageQueue->toArray() as $message) {
79  switch ($message->getSeverity()) {
81  $reportStatusTypes['error'][] = $message;
82  break;
84  $reportStatusTypes['warning'][] = $message;
85  break;
87  $reportStatusTypes['ok'][] = $message;
88  break;
90  $reportStatusTypes['information'][] = $message;
91  break;
93  $reportStatusTypes['notice'][] = $message;
94  break;
95  }
96  }
97 
98  $statusArray = [];
99  foreach ($reportStatusTypes as $type => $statusObjects) {
100  $value = count($statusObjects);
101  $message = '';
102  if ($verbose) {
103  foreach ($statusObjects as $statusObject) {
104  $message .= '### ' . $statusObject->getTitle() . ': ' . $statusObject->getSeverity() . CRLF;
105  }
106  }
107 
108  if ($value > 0) {
109  $pathToXliff = 'LLL:EXT:install/Resources/Private/Language/Report/locallang.xlf';
110  // Map information type to abbreviation which is used in \TYPO3\CMS\Reports\Status class
111  if ($type === 'information') {
112  $type = 'info';
113  }
114  if (!$verbose) {
115  $message = $this->‪getLanguageService()->‪sL($pathToXliff . ':environment.status.message.' . $type);
116  }
117  $severity = constant('\TYPO3\CMS\Reports\Status::' . strtoupper($type));
118  $statusArray[] = GeneralUtility::makeInstance(
119  Status::class,
120  $this->‪getLanguageService()->sL($pathToXliff . ':environment.status.title'),
121  sprintf($this->‪getLanguageService()->sL($pathToXliff . ':environment.status.value'), $value),
122  $message,
123  $severity
124  );
125  }
126  }
127 
128  return $statusArray;
129  }
130 
135  {
136  return ‪$GLOBALS['LANG'] ?? null;
137  }
138 }
‪TYPO3\CMS\Install\Report\EnvironmentStatusReport\getStatusInternal
‪Status[] getStatusInternal($verbose)
Definition: EnvironmentStatusReport.php:59
‪TYPO3\CMS\Reports\StatusProviderInterface
Definition: StatusProviderInterface.php:22
‪TYPO3\CMS\Install\Report\EnvironmentStatusReport\getStatus
‪Status[] getStatus()
Definition: EnvironmentStatusReport.php:40
‪TYPO3\CMS\Install\Report
Definition: EnvironmentStatusReport.php:16
‪TYPO3\CMS\Core\Localization\LanguageService\sL
‪string sL($input)
Definition: LanguageService.php:194
‪TYPO3\CMS\Install\Report\EnvironmentStatusReport
Definition: EnvironmentStatusReport.php:34
‪TYPO3\CMS\Reports\Status
Definition: Status.php:24
‪TYPO3\CMS\Core\Messaging\AbstractMessage\WARNING
‪const WARNING
Definition: AbstractMessage.php:30
‪TYPO3\CMS\Install\Report\EnvironmentStatusReport\getLanguageService
‪LanguageService null getLanguageService()
Definition: EnvironmentStatusReport.php:134
‪TYPO3\CMS\Install\SystemEnvironment\DatabaseCheck
‪TYPO3\CMS\Core\Messaging\AbstractMessage\OK
‪const OK
Definition: AbstractMessage.php:29
‪TYPO3\CMS\Core\Messaging\AbstractMessage\INFO
‪const INFO
Definition: AbstractMessage.php:28
‪TYPO3\CMS\Core\Messaging\FlashMessage
Definition: FlashMessage.php:24
‪TYPO3\CMS\Install\SystemEnvironment\Check
Definition: Check.php:55
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Install\SystemEnvironment\SetupCheck
Definition: SetupCheck.php:36
‪TYPO3\CMS\Core\Messaging\AbstractMessage\NOTICE
‪const NOTICE
Definition: AbstractMessage.php:27
‪TYPO3\CMS\Core\Localization\LanguageService
Definition: LanguageService.php:42
‪TYPO3\CMS\Reports\ExtendedStatusProviderInterface
Definition: ExtendedStatusProviderInterface.php:22
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46
‪TYPO3\CMS\Core\Messaging\FlashMessageQueue
Definition: FlashMessageQueue.php:29
‪TYPO3\CMS\Core\Messaging\AbstractMessage\ERROR
‪const ERROR
Definition: AbstractMessage.php:31
‪TYPO3\CMS\Install\Report\EnvironmentStatusReport\getDetailedStatus
‪Status[] getDetailedStatus()
Definition: EnvironmentStatusReport.php:50