‪TYPO3CMS  11.5
WarningMessagePostProcessor.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
22 use ‪TYPO3\CMS\Reports\Status as ReportStatus;
23 
28 {
37  public function ‪displayWarningMessages_postProcess(array &$warningMessages)
38  {
39  if (!$this->‪getBackendUser()->isAdmin()) {
40  return;
41  }
42  // Get highest severity
43  $registry = GeneralUtility::makeInstance(Registry::class);
44  $highestSeverity = $registry->get('tx_reports', 'status.highestSeverity', null);
45  if ($highestSeverity !== null) {
46  if ($highestSeverity > ReportStatus::OK) {
47  // Display a message that there's something wrong and that
48  // the admin should take a look at the detailed status report
49  $this->‪getLanguageService()->‪includeLLFile('EXT:reports/Resources/Private/Language/locallang_reports.xlf');
50  $reportModuleIdentifier = 'system_reports';
51  $reportModuleParameters = [
52  'extension=tx_reports',
53  'report=status',
54  'action=detail',
55  ];
56  $dispatchArgsList = $reportModuleIdentifier . ',' . '&' . implode('&', $reportModuleParameters);
57  $warningMessages['tx_reports_status_notification'] = sprintf(
58  $this->‪getLanguageService()->getLL('status_problemNotification'),
59  '<a href="#" data-dispatch-action="TYPO3.ModuleMenu.showModule" '
60  . 'data-dispatch-args-list="' . htmlspecialchars($dispatchArgsList) . '">',
61  '</a>'
62  );
63  }
64  }
65  }
66 
70  protected function ‪getLanguageService()
71  {
72  return ‪$GLOBALS['LANG'];
73  }
74 
78  protected function ‪getBackendUser()
79  {
80  return ‪$GLOBALS['BE_USER'];
81  }
82 }
‪TYPO3\CMS\Reports\Report\Status\WarningMessagePostProcessor\getBackendUser
‪BackendUserAuthentication getBackendUser()
Definition: WarningMessagePostProcessor.php:78
‪TYPO3\CMS\Core\Registry
Definition: Registry.php:33
‪TYPO3\CMS\Reports\Report\Status\WarningMessagePostProcessor
Definition: WarningMessagePostProcessor.php:28
‪TYPO3\CMS\Reports\Status
Definition: Status.php:24
‪TYPO3\CMS\Core\Authentication\BackendUserAuthentication
Definition: BackendUserAuthentication.php:62
‪TYPO3\CMS\Reports\Report\Status\WarningMessagePostProcessor\getLanguageService
‪LanguageService getLanguageService()
Definition: WarningMessagePostProcessor.php:70
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:25
‪TYPO3\CMS\Reports\Report\Status\WarningMessagePostProcessor\displayWarningMessages_postProcess
‪displayWarningMessages_postProcess(array &$warningMessages)
Definition: WarningMessagePostProcessor.php:37
‪TYPO3\CMS\Reports\Report\Status
Definition: ConfigurationStatus.php:16
‪TYPO3\CMS\Core\Localization\LanguageService\includeLLFile
‪array includeLLFile($fileRef)
Definition: LanguageService.php:271
‪TYPO3\CMS\Core\Localization\LanguageService
Definition: LanguageService.php:42
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:50