[FEATURE] Check in Reports module for old XCLASS methods
authorJigal van Hemert <jigal@xs4all.nl>
Sat, 16 Jun 2012 21:55:12 +0000 (23:55 +0200)
committerJigal van Hemert <jigal@xs4all.nl>
Sun, 17 Jun 2012 09:31:55 +0000 (11:31 +0200)
Reports module shows where old XCLASS methods are still used.

Change-Id: Ic67815b0af87b7fbf6c5a380ae7b2f4ab37d8398
Resolves: #38123
Releases: 6.0
Reviewed-on: http://review.typo3.org/12140
Reviewed-by: Oliver Hader
Tested-by: Oliver Hader
Reviewed-by: Philipp Gampe
Reviewed-by: Felix Kopp
Tested-by: Felix Kopp
Reviewed-by: Jigal van Hemert
Tested-by: Jigal van Hemert
typo3/sysext/reports/reports/locallang.xlf
typo3/sysext/reports/reports/status/class.tx_reports_reports_status_typo3status.php

index d452d7d..201f124 100644 (file)
@@ -33,6 +33,9 @@
                        <trans-unit id="status_empty" xml:space="preserve">
                                <source>Empty</source>
                        </trans-unit>
+                       <trans-unit id="status_none" xml:space="preserve">
+                               <source>None</source>
+                       </trans-unit>
                        <trans-unit id="status_connectionFailed" xml:space="preserve">
                                <source>Connection Failed</source>
                        </trans-unit>
                        <trans-unit id="status_updateTask_email_issues" xml:space="preserve">
                                <source>Issues</source>
                        </trans-unit>
+                       <trans-unit id="status_oldXclassUsage" xml:space="preserve">
+                               <source>Old XCLASS method used</source>
+                       </trans-unit>
+                       <trans-unit id="status_oldXclassUsageFound" xml:space="preserve">
+                               <source>Old XCLASS method is used in %d cases:</source>
+                       </trans-unit>
                </body>
        </file>
 </xliff>
index 27822af..1862ea5 100644 (file)
@@ -41,6 +41,7 @@ class tx_reports_reports_status_Typo3Status implements tx_reports_StatusProvider
        public function getStatus() {
                $statuses = array(
                        'Typo3Version' => $this->getTypo3VersionStatus(),
+                       'oldXclassStatus' => $this->getOldXclassUsageStatus(),
                );
 
                return $statuses;
@@ -52,12 +53,47 @@ class tx_reports_reports_status_Typo3Status implements tx_reports_StatusProvider
         * @return      tx_reports_reports_status_Status
         */
        protected function getTypo3VersionStatus() {
-               return t3lib_div::makeInstance('tx_reports_reports_status_Status',
+               return t3lib_div::makeInstance(
+                       'tx_reports_reports_status_Status',
                        'TYPO3',
                        TYPO3_version,
                        '',
                        tx_reports_reports_status_Status::NOTICE
                );
        }
+
+       /**
+        * Check for usage of old way of implementing XCLASSes
+        *
+        * @return tx_reports_reports_status_Status
+        */
+       protected function getOldXclassUsageStatus() {
+               $message = '';
+               $value = $GLOBALS['LANG']->getLL('status_none');
+               $severity = tx_reports_reports_status_Status::OK;
+
+               $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 = tx_reports_reports_status_Status::WARNING;
+               }
+
+               return t3lib_div::makeInstance(
+                       'tx_reports_reports_status_Status',
+                       $GLOBALS['LANG']->getLL('status_oldXclassUsage'),
+                       $value,
+                       $message,
+                       $severity
+               );
+       }
 }
 ?>
\ No newline at end of file