[TASK] Namespace classes
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Classes / Utility / ExtbaseRequirementsCheckUtility.php
1 <?php
2 namespace TYPO3\CMS\Extbase\Utility;
3
4 /***************************************************************
5 * Copyright notice
6 *
7 * (c) 2009 Sebastian Kurf├╝rst <sebastian@typo3.org>
8 * All rights reserved
9 *
10 * This class is a backport of the corresponding class of FLOW3.
11 * All credits go to the v5 team.
12 *
13 * This script is part of the TYPO3 project. The TYPO3 project is
14 * free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * The GNU General Public License can be found at
20 * http://www.gnu.org/copyleft/gpl.html.
21 *
22 * This script is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 *
27 * This copyright notice MUST APPEAR in all copies of the script!
28 ***************************************************************/
29 /**
30 * A checker which hooks into the backend module "Reports" checking whether there
31 * is a PHP accelerator in place which strips off Doc Comments.
32 *
33 * @package Extbase
34 * @subpackage Utility
35 * @version $Id$
36 */
37 class ExtbaseRequirementsCheckUtility implements \TYPO3\CMS\Reports\StatusProviderInterface {
38
39 /**
40 * Compiles a collection of system status checks as a status report.
41 *
42 * @see typo3/sysext/reports/interfaces/tx_reports_StatusProvider::getStatus()
43 * @return array
44 */
45 public function getStatus() {
46 $reports = array(
47 'docCommentsShouldBePreserved' => $this->checkIfDocCommentsArePreserved(),
48 'dbalExtensionIsInstalled' => $this->checkIfDbalExtensionIsInstalled()
49 );
50 return $reports;
51 }
52
53 /**
54 * Check whether doc comments are preserved or stipped off PHP by PHP accelerators.
55 *
56 * @return \TYPO3\CMS\Reports\Status
57 */
58 protected function checkIfDocCommentsArePreserved() {
59 $method = new \ReflectionMethod('TYPO3\\CMS\\Extbase\\Core\\Bootstrap', 'run');
60 if (strlen($method->getDocComment()) > 0) {
61 $value = 'Preserved';
62 $message = '';
63 $status = \TYPO3\CMS\Reports\Status::OK;
64 } else {
65 $value = 'Stripped';
66 $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.';
67 $status = \TYPO3\CMS\Reports\Status::ERROR;
68 }
69 return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Reports\\Status', 'PHP Doc Comments', $value, $message, $status);
70 }
71
72 /**
73 * Check whether dbal extension is installed
74 *
75 * @return \TYPO3\CMS\Reports\Status
76 */
77 protected function checkIfDbalExtensionIsInstalled() {
78 if (\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('dbal')) {
79 $value = 'DBAL is loaded';
80 $message = 'The Database Abstraction Layer Extension (dbal) is loaded. Extbase does not fully support dbal at the moment. If you are aware of this fact or don\'t make use of the incompatible parts on this installation, you can ignore this notice.';
81 $status = \TYPO3\CMS\Reports\Status::INFO;
82 } else {
83 $value = 'DBAL is not loaded';
84 $message = '';
85 $status = \TYPO3\CMS\Reports\Status::OK;
86 }
87 return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Reports\\Status', 'DBAL Extension', $value, $message, $status);
88 }
89
90 }
91
92
93 ?>