TYPO3 API  SVNRelease
ExtbaseRequirementsCheck.php
Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 2009 Sebastian Kurfürst <sebastian@typo3.org>
00006 *  All rights reserved
00007 *
00008 *  This class is a backport of the corresponding class of FLOW3.
00009 *  All credits go to the v5 team.
00010 *
00011 *  This script is part of the TYPO3 project. The TYPO3 project is
00012 *  free software; you can redistribute it and/or modify
00013 *  it under the terms of the GNU General Public License as published by
00014 *  the Free Software Foundation; either version 2 of the License, or
00015 *  (at your option) any later version.
00016 *
00017 *  The GNU General Public License can be found at
00018 *  http://www.gnu.org/copyleft/gpl.html.
00019 *
00020 *  This script is distributed in the hope that it will be useful,
00021 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 *  GNU General Public License for more details.
00024 *
00025 *  This copyright notice MUST APPEAR in all copies of the script!
00026 ***************************************************************/
00027 
00028 /**
00029  * A checker which hooks into the backend module "Reports" checking whether there
00030  * is a PHP accelerator in place which strips off Doc Comments.
00031  *
00032  * @package Extbase
00033  * @subpackage Utility
00034  * @version $Id: ExtbaseRequirementsCheck.php 1729 2009-11-25 21:37:20Z stucki $
00035  */
00036 class Tx_Extbase_Utility_ExtbaseRequirementsCheck implements tx_reports_StatusProvider {
00037 
00038     /**
00039      * Compiles a collection of system status checks as a status report.
00040      *
00041      * @see typo3/sysext/reports/interfaces/tx_reports_StatusProvider::getStatus()
00042      */
00043     public function getStatus() {
00044         $reports = array(
00045             'docCommentsShouldBePreserved' => $this->checkIfDocCommentsArePreserved()
00046         );
00047 
00048         return $reports;
00049     }
00050 
00051     /**
00052      * Check whether doc comments are preserved or stipped off PHP by PHP accelerators.
00053      *
00054      * @return  tx_reports_reports_status_Status
00055      */
00056     protected function checkIfDocCommentsArePreserved() {
00057 
00058         $method = new ReflectionMethod('Tx_Extbase_MVC_Dispatcher', 'dispatch');
00059 
00060         if(strlen($method->getDocComment()) > 0) {
00061             $value = 'Preserved';
00062             $message = '';
00063             $status = tx_reports_reports_status_Status::OK;
00064         } else {
00065             $value = 'Stripped';
00066             $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.';
00067             $status = tx_reports_reports_status_Status::ERROR;
00068         }
00069         return t3lib_div::makeInstance('tx_reports_reports_status_Status',
00070             'PHP Doc Comments',
00071             $value,
00072             $message,
00073             $status
00074         );
00075     }
00076 }
00077 ?>