TYPO3  7.6
Typo3Status.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Reports\Report\Status;
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  */
17 use TYPO3\CMS\Reports\Status as ReportStatus;
18 
23 {
29  public function getStatus()
30  {
31  $statuses = array(
32  'oldXclassStatus' => $this->getOldXclassUsageStatus(),
33  'registeredXclass' => $this->getRegisteredXclassStatus(),
34  'compatibility6' => $this->getCompatibility6Status(),
35  );
36  return $statuses;
37  }
38 
44  protected function getOldXclassUsageStatus()
45  {
46  $message = '';
47  $value = $GLOBALS['LANG']->getLL('status_none');
48  $severity = ReportStatus::OK;
49 
50  $xclasses = array_merge(
51  (array)$GLOBALS['TYPO3_CONF_VARS']['BE']['XCLASS'],
52  (array)$GLOBALS['TYPO3_CONF_VARS']['FE']['XCLASS']
53  );
54 
55  $numberOfXclasses = count($xclasses);
56  if ($numberOfXclasses > 0) {
57  $value = sprintf($GLOBALS['LANG']->getLL('status_oldXclassUsageFound'), $numberOfXclasses);
58  $message = $GLOBALS['LANG']->getLL('status_oldXclassUsageFound_message') . '<br />';
59  $message .= '<ol><li>' . implode('</li><li>', $xclasses) . '</li></ol>';
60  $severity = ReportStatus::NOTICE;
61  }
62 
64  ReportStatus::class,
65  $GLOBALS['LANG']->getLL('status_oldXclassUsage'),
66  $value,
67  $message,
68  $severity
69  );
70  }
71 
77  protected function getRegisteredXclassStatus()
78  {
79  $message = '';
80  $value = $GLOBALS['LANG']->getLL('status_none');
81  $severity = ReportStatus::OK;
82 
83  $xclassFoundArray = array();
84  if (array_key_exists('Objects', $GLOBALS['TYPO3_CONF_VARS']['SYS'])) {
85  foreach ($GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'] as $originalClass => $override) {
86  if (array_key_exists('className', $override)) {
87  $xclassFoundArray[$originalClass] = $override['className'];
88  }
89  }
90  }
91  if (!empty($xclassFoundArray)) {
92  $value = $GLOBALS['LANG']->getLL('status_xclassUsageFound');
93  $message = $GLOBALS['LANG']->getLL('status_xclassUsageFound_message') . '<br />';
94  $message .= '<ol>';
95  foreach ($xclassFoundArray as $originalClass => $xClassName) {
96  $messageDetail = sprintf(
97  $GLOBALS['LANG']->getLL('status_xclassUsageFound_message_detail'),
98  $originalClass,
99  $xClassName
100  );
101  $message .= '<li>' . $messageDetail . '</li>';
102  }
103  $message .= '</ol>';
104  $severity = ReportStatus::NOTICE;
105  }
106 
108  ReportStatus::class,
109  $GLOBALS['LANG']->getLL('status_xclassUsage'),
110  $value,
111  $message,
112  $severity
113  );
114  }
115 
121  protected function getCompatibility6Status()
122  {
123  $message = '';
124  $value = $GLOBALS['LANG']->getLL('status_disabled');
125  $severity = ReportStatus::OK;
126 
127  if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('compatibility6')) {
128  $value = $GLOBALS['LANG']->getLL('status_enabled');
129  $message = $GLOBALS['LANG']->getLL('status_compatibility6Usage_message');
130  $severity = ReportStatus::WARNING;
131  }
132 
134  ReportStatus::class,
135  $GLOBALS['LANG']->getLL('status_compatibility6Usage'),
136  $value,
137  $message,
138  $severity
139  );
140  }
141 }