[TASK] EXT:reports Improve xclass reporting
[Packages/TYPO3.CMS.git] / typo3 / sysext / reports / Classes / Report / Status / Typo3Status.php
index 92a16eb..27258bf 100644 (file)
@@ -39,7 +39,8 @@ class Typo3Status implements \TYPO3\CMS\Reports\StatusProviderInterface {
        public function getStatus() {
                $statuses = array(
                        'Typo3Version' => $this->getTypo3VersionStatus(),
-                       'oldXclassStatus' => $this->getOldXclassUsageStatus()
+                       'oldXclassStatus' => $this->getOldXclassUsageStatus(),
+                       'registeredXclass' => $this->getRegisteredXclassStatus(),
                );
                return $statuses;
        }
@@ -62,14 +63,70 @@ class Typo3Status implements \TYPO3\CMS\Reports\StatusProviderInterface {
                $message = '';
                $value = $GLOBALS['LANG']->getLL('status_none');
                $severity = \TYPO3\CMS\Reports\Status::OK;
-               $xclasses = array_merge((array) $GLOBALS['TYPO3_CONF_VARS']['BE']['XCLASS'], (array) $GLOBALS['TYPO3_CONF_VARS']['FE']['XCLASS']);
+
+               $xclasses = array_merge(
+                       (array) $GLOBALS['TYPO3_CONF_VARS']['BE']['XCLASS'],
+                       (array) $GLOBALS['TYPO3_CONF_VARS']['FE']['XCLASS']
+               );
+
                $numberOfXclasses = count($xclasses);
                if ($numberOfXclasses > 0) {
                        $value = sprintf($GLOBALS['LANG']->getLL('status_oldXclassUsageFound'), $numberOfXclasses);
-                       $message = '<ol><li>' . implode('</li><li>', $xclasses) . '</li></ol>';
-                       $severity = \TYPO3\CMS\Reports\Status::WARNING;
+                       $message = $GLOBALS['LANG']->getLL('status_oldXclassUsageFound_message') . '<br />';
+                       $message .= '<ol><li>' . implode('</li><li>', $xclasses) . '</li></ol>';
+                       $severity = \TYPO3\CMS\Reports\Status::NOTICE;
                }
-               return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Reports\\Status', $GLOBALS['LANG']->getLL('status_oldXclassUsage'), $value, $message, $severity);
+
+               return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
+                       'TYPO3\\CMS\\Reports\\Status',
+                       $GLOBALS['LANG']->getLL('status_oldXclassUsage'),
+                       $value,
+                       $message,
+                       $severity
+               );
+       }
+
+       /**
+        * List any Xclasses registered in the stystem
+        *
+        * @return \TYPO3\CMS\Reports\Status
+        */
+       protected function getRegisteredXclassStatus() {
+               $message = '';
+               $value = $GLOBALS['LANG']->getLL('status_none');
+               $severity = \TYPO3\CMS\Reports\Status::OK;
+
+               $xclassFoundArray = array();
+               if (array_key_exists('Objects', $GLOBALS['TYPO3_CONF_VARS']['SYS'])) {
+                       foreach ($GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'] as $originalClass => $override) {
+                               if (array_key_exists('className', $override)) {
+                                       $xclassFoundArray[$originalClass] = $override['className'];
+                               }
+                       }
+               }
+               if (count($xclassFoundArray) > 0) {
+                       $value = $GLOBALS['LANG']->getLL('status_xclassUsageFound');
+                       $message = $GLOBALS['LANG']->getLL('status_xclassUsageFound_message') . '<br />';
+                       $message .= '<ol>';
+                       foreach ($xclassFoundArray as $originalClass => $xClassName) {
+                               $messageDetail = sprintf(
+                                       $GLOBALS['LANG']->getLL('status_xclassUsageFound_message_detail'),
+                                       $originalClass,
+                                       $xClassName
+                               );
+                               $message .= '<li>' . $messageDetail . '</li>';
+                       }
+                       $message .= '</ol';
+                       $severity = \TYPO3\CMS\Reports\Status::NOTICE;
+               }
+
+               return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
+                       'TYPO3\\CMS\\Reports\\Status',
+                       $GLOBALS['LANG']->getLL('status_xclassUsage'),
+                       $value,
+                       $message,
+                       $severity
+               );
        }
 
 }