‪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 
20 use Symfony\Component\DependencyInjection\Attribute\Autoconfigure;
27 
31 #[Autoconfigure(public: true)]
33 {
34  public function ‪getIdentifier(): string
35  {
36  return 'debug';
37  }
38 
39  public function ‪getIconIdentifier(): string
40  {
41  return 'actions-debug';
42  }
43 
44  public function ‪getLabel(): string
45  {
46  return $this->‪getLanguageService()->sL(
47  'LLL:EXT:adminpanel/Resources/Private/Language/locallang_debug.xlf:module.label'
48  );
49  }
50 
51  public function ‪getShortInfo(): string
52  {
53  $logRecords = GeneralUtility::makeInstance(InMemoryLogWriter::class)->getLogEntries();
54  $errorsAndWarnings = array_filter($logRecords, static function (‪LogRecord $entry): bool {
55  return ‪LogLevel::normalizeLevel($entry->‪getLevel()) <= 4;
56  });
57 
58  $queryInformation = $this->moduleData->offsetGet($this->subModules['debug_queryinformation']);
59 
60  return sprintf(
61  $this->‪getLanguageService()->sL('LLL:EXT:adminpanel/Resources/Private/Language/locallang_debug.xlf:module.shortinfoErrorsAndSQL'),
62  count($errorsAndWarnings),
63  $queryInformation->offsetGet('totalQueries'),
64  round($queryInformation->offsetGet('totalTime'))
65  );
66  }
67 }
‪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:44
‪TYPO3\CMS\Adminpanel\Log\InMemoryLogWriter
Definition: InMemoryLogWriter.php:38
‪TYPO3\CMS\Adminpanel\Modules\DebugModule
Definition: DebugModule.php:33
‪TYPO3\CMS\Adminpanel\Modules\DebugModule\getIdentifier
‪getIdentifier()
Definition: DebugModule.php:34
‪TYPO3\CMS\Adminpanel\Modules\DebugModule\getShortInfo
‪getShortInfo()
Definition: DebugModule.php:51
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:52
‪TYPO3\CMS\Adminpanel\Modules\DebugModule\getIconIdentifier
‪getIconIdentifier()
Definition: DebugModule.php:39
‪TYPO3\CMS\Core\Log\LogLevel
Definition: LogLevel.php:24