‪TYPO3CMS  10.4
PhpInformation.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 Psr\Http\Message\ServerRequestInterface;
26 
33 {
37  public function ‪getIdentifier(): string
38  {
39  return 'info_php';
40  }
41 
45  public function ‪getLabel(): string
46  {
47  return $this->‪getLanguageService()->‪sL(
48  'LLL:EXT:adminpanel/Resources/Private/Language/locallang_info.xlf:sub.php.label'
49  );
50  }
51 
55  public function ‪getDataToStore(ServerRequestInterface $request): ‪ModuleData
56  {
57  return new ‪ModuleData(
58  [
59  'general' => [
60  'PHP_VERSION' => PHP_VERSION,
61  'PHP_OS' => PHP_OS,
62  'PHP_SAPI' => PHP_SAPI,
63  'Peak Memory Usage' => GeneralUtility::formatSize(memory_get_peak_usage()),
64  ],
65  'loadedExtensions' => implode(', ', get_loaded_extensions()),
66  'constants' => get_defined_constants(true),
67  ]
68  );
69  }
70 
74  public function ‪getContent(‪ModuleData $data): string
75  {
76  $view = GeneralUtility::makeInstance(StandaloneView::class);
77  $templateNameAndPath = 'EXT:adminpanel/Resources/Private/Templates/Modules/Info/PhpInfo.html';
78  $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName($templateNameAndPath));
79  $view->setPartialRootPaths(['EXT:adminpanel/Resources/Private/Partials']);
80 
81  $view->assignMultiple($data->getArrayCopy());
82  $view->assign('languageKey', $this->‪getBackendUser()->user['lang']);
83 
84  return $view->render();
85  }
86 }
‪TYPO3\CMS\Adminpanel\ModuleApi\AbstractSubModule\getLanguageService
‪LanguageService getLanguageService()
Definition: AbstractSubModule.php:35
‪TYPO3\CMS\Adminpanel\Modules\Info\PhpInformation
Definition: PhpInformation.php:33
‪TYPO3\CMS\Adminpanel\Modules\Info\PhpInformation\getLabel
‪getLabel()
Definition: PhpInformation.php:45
‪TYPO3\CMS\Adminpanel\ModuleApi\DataProviderInterface
Definition: DataProviderInterface.php:30
‪TYPO3\CMS\Adminpanel\Modules\Info\PhpInformation\getContent
‪getContent(ModuleData $data)
Definition: PhpInformation.php:74
‪TYPO3\CMS\Core\Localization\LanguageService\sL
‪string sL($input)
Definition: LanguageService.php:194
‪TYPO3\CMS\Adminpanel\ModuleApi\AbstractSubModule\getBackendUser
‪getBackendUser()
Definition: AbstractSubModule.php:40
‪TYPO3\CMS\Adminpanel\Modules\Info
Definition: GeneralInformation.php:18
‪TYPO3\CMS\Adminpanel\Modules\Info\PhpInformation\getIdentifier
‪getIdentifier()
Definition: PhpInformation.php:37
‪TYPO3\CMS\Fluid\View\StandaloneView
Definition: StandaloneView.php:34
‪TYPO3\CMS\Adminpanel\ModuleApi\ModuleData
Definition: ModuleData.php:27
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46
‪TYPO3\CMS\Adminpanel\Modules\Info\PhpInformation\getDataToStore
‪getDataToStore(ServerRequestInterface $request)
Definition: PhpInformation.php:55
‪TYPO3\CMS\Adminpanel\ModuleApi\AbstractSubModule
Definition: AbstractSubModule.php:29