‪TYPO3CMS  ‪main
DebugModule.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
26 
31 {
32  public function ‪getIdentifier(): string
33  {
34  return 'debug';
35  }
36 
37  public function ‪getIconIdentifier(): string
38  {
39  return 'actions-debug';
40  }
41 
42  public function ‪getLabel(): string
43  {
44  return $this->‪getLanguageService()->sL(
45  'LLL:EXT:adminpanel/Resources/Private/Language/locallang_debug.xlf:module.label'
46  );
47  }
48 
49  public function ‪getShortInfo(): string
50  {
51  $logRecords = GeneralUtility::makeInstance(InMemoryLogWriter::class)->getLogEntries();
52  $errorsAndWarnings = array_filter($logRecords, static function (‪LogRecord $entry): bool {
53  return ‪LogLevel::normalizeLevel($entry->‪getLevel()) <= 4;
54  });
55 
56  $queryInformation = $this->moduleData->offsetGet($this->subModules['debug_queryinformation']);
57 
58  return sprintf(
59  $this->‪getLanguageService()->sL('LLL:EXT:adminpanel/Resources/Private/Language/locallang_debug.xlf:module.shortinfoErrorsAndSQL'),
60  count($errorsAndWarnings),
61  $queryInformation->offsetGet('totalQueries'),
62  round($queryInformation->offsetGet('totalTime'))
63  );
64  }
65 }
‪TYPO3\CMS\Adminpanel\ModuleApi\AbstractModule
Definition: AbstractModule.php:29
‪TYPO3\CMS\Core\Log\LogLevel\normalizeLevel
‪static normalizeLevel($level)
Definition: LogLevel.php:90
‪TYPO3\CMS\Adminpanel\ModuleApi\AbstractModule\getLanguageService
‪getLanguageService()
Definition: AbstractModule.php:95
‪TYPO3\CMS\Core\Log\LogRecord\getLevel
‪string getLevel()
Definition: LogRecord.php:159
‪TYPO3\CMS\Adminpanel\ModuleApi\ShortInfoProviderInterface
Definition: ShortInfoProviderInterface.php:30
‪TYPO3\CMS\Core\Log\LogRecord
Definition: LogRecord.php:24
‪TYPO3\CMS\Adminpanel\Modules
Definition: CacheModule.php:18
‪TYPO3\CMS\Adminpanel\Modules\DebugModule\getLabel
‪getLabel()
Definition: DebugModule.php:42
‪TYPO3\CMS\Adminpanel\Log\InMemoryLogWriter
Definition: InMemoryLogWriter.php:38
‪TYPO3\CMS\Adminpanel\Modules\DebugModule
Definition: DebugModule.php:31
‪TYPO3\CMS\Adminpanel\Modules\DebugModule\getIdentifier
‪getIdentifier()
Definition: DebugModule.php:32
‪TYPO3\CMS\Adminpanel\Modules\DebugModule\getShortInfo
‪getShortInfo()
Definition: DebugModule.php:49
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:52
‪TYPO3\CMS\Adminpanel\Modules\DebugModule\getIconIdentifier
‪getIconIdentifier()
Definition: DebugModule.php:37
‪TYPO3\CMS\Core\Log\LogLevel
Definition: LogLevel.php:24