[+FEATURE] Extbase (Utility): Added a check for the new TYPO3 backend module "Reports...
authorSebastian Kurfürst <sebastian@typo3.org>
Fri, 18 Sep 2009 10:29:25 +0000 (10:29 +0000)
committerSebastian Kurfürst <sebastian@typo3.org>
Fri, 18 Sep 2009 10:29:25 +0000 (10:29 +0000)
typo3/sysext/extbase/Classes/Utility/ExtbaseRequirementsCheck.php [new file with mode: 0644]
typo3/sysext/extbase/ext_autoload.php
typo3/sysext/extbase/ext_tables.php

diff --git a/typo3/sysext/extbase/Classes/Utility/ExtbaseRequirementsCheck.php b/typo3/sysext/extbase/Classes/Utility/ExtbaseRequirementsCheck.php
new file mode 100644 (file)
index 0000000..6071385
--- /dev/null
@@ -0,0 +1,77 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2009 Sebastian Kurfürst <sebastian@typo3.org>
+*  All rights reserved
+*
+*  This class is a backport of the corresponding class of FLOW3.
+*  All credits go to the v5 team.
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * A checker which hooks into the backend module "Reports" checking whether there
+ * is a PHP accelerator in place which strips off Doc Comments.
+ *
+ * @package Extbase
+ * @subpackage Utility
+ * @version $Id: $
+ */
+class Tx_Extbase_Utility_ExtbaseRequirementsCheck implements tx_reports_StatusProvider {
+
+       /**
+        * Compiles a collection of system status checks as a status report.
+        *
+        * @see typo3/sysext/reports/interfaces/tx_reports_StatusProvider::getStatus()
+        */
+       public function getStatus() {
+               $reports = array(
+                       'docCommentsShouldBePreserved' => $this->checkIfDocCommentsArePreserved()
+               );
+               
+               return $reports;
+       }
+
+       /**
+        * Check whether doc comments are preserved or stipped off PHP by PHP accelerators.
+        *
+        * @return      tx_reports_reports_status_Status
+        */
+       protected function checkIfDocCommentsArePreserved() {
+
+               $method = new ReflectionMethod('Tx_Extbase_Dispatcher', 'dispatch');
+
+               if(strlen($method->getDocComment()) > 0) {
+                       $value = 'Preserved';
+                       $message = '';
+                       $status = tx_reports_reports_status_Status::OK;
+               } else {
+                       $value = 'Stripped';
+                       $message = 'The PHP Doc comments are stripped from the PHP files. All extensions based on Extbase will not work correctly.<br />Are you using a PHP Accelerator like eAccelerator? If you use eAccelerator, please recompile it with the compile flag <b>--with-eaccelerator-doc-comment-inclusion</b>. See <a href="http://eaccelerator.net/ticket/229">the eAccelerator bugtracker</a> for more details.';
+                       $status = tx_reports_reports_status_Status::ERROR;
+               }
+               return t3lib_div::makeInstance('tx_reports_reports_status_Status',
+                       'PHP Doc Comments',
+                       $value,
+                       $message,
+                       $status
+               );
+       }
+}
+?>
\ No newline at end of file
index 897c9d4..9ac6201 100644 (file)
@@ -209,6 +209,7 @@ return array(
        'tx_extbase_reflection_propertyreflection' => $extensionClassesPath . 'Reflection/PropertyReflection.php',
        'tx_extbase_reflection_service' => $extensionClassesPath . 'Reflection/Service.php',
        'tx_extbase_utility_arrays' => $extensionClassesPath . 'Utility/Arrays.php',
+       'tx_extbase_utility_extbaserequirementscheck' => $extensionClassesPath . 'Utility/ExtbaseRequirementsCheck.php',
        'tx_extbase_utility_extension' => $extensionClassesPath . 'Utility/Extension.php',
        'tx_extbase_utility_typoscript' => $extensionClassesPath . 'Utility/TypoScript.php',
        'tx_extbase_validation_error' => $extensionClassesPath . 'Validation/Error.php',
index 32c708e..e261d64 100644 (file)
@@ -16,6 +16,10 @@ if (TYPO3_MODE == 'BE') {
        }
        
        $TBE_MODULES['_dispatcher'][] = t3lib_div::makeInstance('Tx_Extbase_Dispatcher');
+
+
+
+       $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['reports']['tx_reports']['status']['extbase'] = 'tx_extbase_utility_extbaserequirementscheck';
 }
 
 ?>
\ No newline at end of file