203a75eeddac8fdabd73bc0c4590e246c17fb789
[Packages/TYPO3.CMS.git] / typo3 / sysext / reports / Classes / Report / Status / WarningMessagePostProcessor.php
1 <?php
2 namespace TYPO3\CMS\Reports\Report\Status;
3
4 /***************************************************************
5 * Copyright notice
6 *
7 * (c) 2010-2011 Ingo Renner <ingo@typo3.org>
8 * All rights reserved
9 *
10 * This script is part of the TYPO3 project. The TYPO3 project is
11 * free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * The GNU General Public License can be found at
17 * http://www.gnu.org/copyleft/gpl.html.
18 *
19 * This script is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * This copyright notice MUST APPEAR in all copies of the script!
25 ***************************************************************/
26 /**
27 * Post processes the warning messages found in about modules.
28 *
29 * @author Ingo Renner <ingo@typo3.org>
30 */
31 class WarningMessagePostProcessor {
32
33 /**
34 * Tries to get the highest severity of the system's status first, if
35 * something is found it is asumed that the status update task is set up
36 * properly or the status report has been checked manually and we take over
37 * control over the system warning messages.
38 *
39 * @param array $warningMessages An array of messages related to already found issues.
40 */
41 public function displayWarningMessages_postProcess(array &$warningMessages) {
42 // Get highest severity
43 $registry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Registry');
44 $highestSeverity = $registry->get('tx_reports', 'status.highestSeverity', NULL);
45 if (!is_null($highestSeverity)) {
46 // Status update has run, so taking over control over the core messages
47 unset($warningMessages['install_password'], $warningMessages['backend_admin'], $warningMessages['install_enabled'], $warningMessages['install_encryption'], $warningMessages['file_deny_pattern'], $warningMessages['file_deny_htaccess'], $warningMessages['install_update'], $warningMessages['backend_reference'], $warningMessages['memcached']);
48 if ($highestSeverity > \TYPO3\CMS\Reports\Status::OK) {
49 // Display a message that there's something wrong and that
50 // the admin should take a look at the detailed status report
51 $GLOBALS['LANG']->includeLLFile('EXT:reports/reports/locallang.xml');
52 $warningMessages['tx_reports_status_notification'] = sprintf($GLOBALS['LANG']->getLL('status_problemNotification'), '<a href="javascript:top.goToModule(\'tools_txreportsM1\', 1, \'&SET[function]=tx_reports.status\');">', '</a>');
53 }
54 }
55 }
56
57 }
58
59
60 ?>