TYPO3 CMS  TYPO3_7-6
EnvironmentStatusReport.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
19 
24 {
30  public function getStatus()
31  {
32  return $this->getStatusInternal(false);
33  }
34 
40  public function getDetailedStatus()
41  {
42  return $this->getStatusInternal(true);
43  }
44 
50  protected function getStatusInternal($verbose)
51  {
53  $statusCheck = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Install\SystemEnvironment\Check::class);
54  $statusObjects = $statusCheck->getStatus();
55 
57  $databaseStatusCheck = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Install\SystemEnvironment\DatabaseCheck::class);
58  $statusObjects = array_merge($statusObjects, $databaseStatusCheck->getStatus());
59 
60  $reportStatusTypes = [
61  'error' => [],
62  'warning' => [],
63  'ok' => [],
64  'information' => [],
65  'notice' => [],
66  ];
67 
69  foreach ($statusObjects as $statusObject) {
70  $severityIdentifier = $statusObject->getSeverity();
71  if (empty($severityIdentifier) || !is_array($reportStatusTypes[$severityIdentifier])) {
72  throw new \TYPO3\CMS\Install\Exception('Unknown reports severity type', 1362602560);
73  }
74  $reportStatusTypes[$severityIdentifier][] = $statusObject;
75  }
76 
77  $statusArray = [];
78  foreach ($reportStatusTypes as $type => $statusObjects) {
79  $value = count($statusObjects);
80  $message = '';
81  if ($verbose) {
82  foreach ($statusObjects as $statusObject) {
83  $message .= '### ' . $statusObject->getTitle() . ': ' . $statusObject->getSeverity() . CRLF;
84  }
85  }
86 
87  if ($value > 0) {
88  $pathToXliff = 'LLL:EXT:install/Resources/Private/Language/Report/locallang.xlf';
89  // Map information type to abbreviation which is used in \TYPO3\CMS\Reports\Status class
90  if ($type === 'information') {
91  $type = 'info';
92  }
93  if (!$verbose) {
94  $message = $GLOBALS['LANG']->sL($pathToXliff . ':environment.status.message.' . $type);
95  }
96  $severity = constant('\TYPO3\CMS\Reports\Status::' . strtoupper($type));
98  \TYPO3\CMS\Reports\Status::class,
99  $GLOBALS['LANG']->sL($pathToXliff . ':environment.status.title'),
100  sprintf($GLOBALS['LANG']->sL($pathToXliff . ':environment.status.value'), $value),
101  $message,
102  $severity
103  );
104  }
105  }
106 
107  return $statusArray;
108  }
109 }
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']