first commit

This commit is contained in:
salam committed 2026-10-19 08:18:39 +02:00
commit 1218dd1517
12716 files changed
+989233

No files matched your search

@@ -0,0 +1,186 @@
<?php
declare(strict_types = 1);
namespace TYPO3\CMS\Adminpanel\Modules\Info;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Adminpanel\ModuleApi\AbstractSubModule;
use TYPO3\CMS\Adminpanel\ModuleApi\DataProviderInterface;
use TYPO3\CMS\Adminpanel\ModuleApi\ModuleData;
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Context\UserAspect;
use TYPO3\CMS\Core\TimeTracker\TimeTracker;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Fluid\View\StandaloneView;
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
/**
* General information module displaying info about the current
* request
*
* @internal
*/
class GeneralInformation extends AbstractSubModule implements DataProviderInterface
{
/**
* @inheritdoc
*/
public function getDataToStore(ServerRequestInterface $request): ModuleData
{
/** @var UserAspect $frontendUserAspect */
$frontendUserAspect = GeneralUtility::makeInstance(Context::class)->getAspect('frontend.user');
$tsfe = $this->getTypoScriptFrontendController();
return new ModuleData(
[
'post' => $_POST,
'get' => $_GET,
'cookie' => $_COOKIE,
'server' => $_SERVER,
'info' => [
'pageUid' => $tsfe->id,
'pageType' => $tsfe->type,
'groupList' => implode(',', $frontendUserAspect->getGroupIds()),
'noCache' => $this->isNoCacheEnabled(),
'countUserInt' => count($tsfe->config['INTincScript'] ?? []),
'totalParsetime' => $this->getTimeTracker()->getParseTime(),
'feUser' => [
'uid' => $frontendUserAspect->get('id') ?: 0,
'username' => $frontendUserAspect->get('username') ?: '',
],
'imagesOnPage' => $this->collectImagesOnPage(),
'documentSize' => $this->collectDocumentSize(),
],
]
);
}
/**
* Creates the content for the "info" section ("module") of the Admin Panel
*
* @param \TYPO3\CMS\Adminpanel\ModuleApi\ModuleData $data
* @return string HTML content for the section. Consists of a string with table-rows with four columns.
* @see display()
*/
public function getContent(ModuleData $data): string
{
$view = GeneralUtility::makeInstance(StandaloneView::class);
$templateNameAndPath = 'EXT:adminpanel/Resources/Private/Templates/Modules/Info/General.html';
$view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName($templateNameAndPath));
$view->setPartialRootPaths(['EXT:adminpanel/Resources/Private/Partials']);
$view->assignMultiple($data->getArrayCopy());
return $view->render();
}
/**
* Identifier for this Sub-module,
* for example "preview" or "cache"
*
* @return string
*/
public function getIdentifier(): string
{
return 'info_general';
}
/**
* @inheritdoc
*/
public function getLabel(): string
{
return $this->getLanguageService()->sL(
'LLL:EXT:adminpanel/Resources/Private/Language/locallang_info.xlf:sub.general.label'
);
}
/**
* Collects images from TypoScriptFrontendController and calculates the total size.
* Returns human readable image sizes for fluid template output
*
* @return array
*/
protected function collectImagesOnPage(): array
{
$imagesOnPage = [
'files' => [],
'total' => 0,
'totalSize' => 0,
'totalSizeHuman' => GeneralUtility::formatSize(0),
];
if ($this->isNoCacheEnabled() === false) {
return $imagesOnPage;
}
$count = 0;
$totalImageSize = 0;
if (!empty($this->getTypoScriptFrontendController()->imagesOnPage)) {
foreach ($this->getTypoScriptFrontendController()->imagesOnPage as $file) {
$fileSize = @filesize($file);
$imagesOnPage['files'][] = [
'name' => $file,
'size' => $fileSize,
'sizeHuman' => GeneralUtility::formatSize($fileSize),
];
$totalImageSize += $fileSize;
$count++;
}
}
$imagesOnPage['totalSize'] = GeneralUtility::formatSize($totalImageSize);
$imagesOnPage['total'] = $count;
return $imagesOnPage;
}
/**
* Gets the document size from the current page in a human readable format
*
* @return string
*/
protected function collectDocumentSize(): string
{
$documentSize = 0;
if ($this->isNoCacheEnabled() === true) {
$documentSize = mb_strlen($this->getTypoScriptFrontendController()->content, 'UTF-8');
}
return GeneralUtility::formatSize($documentSize);
}
/**
* @return bool
*/
protected function isNoCacheEnabled(): bool
{
return (bool)$this->getTypoScriptFrontendController()->no_cache;
}
/**
* @return TypoScriptFrontendController
*/
protected function getTypoScriptFrontendController(): TypoScriptFrontendController
{
return $GLOBALS['TSFE'];
}
/**
* @return TimeTracker
*/
protected function getTimeTracker(): TimeTracker
{
return GeneralUtility::makeInstance(TimeTracker::class);
}
}
@@ -0,0 +1,84 @@
<?php
declare(strict_types = 1);
namespace TYPO3\CMS\Adminpanel\Modules\Info;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Adminpanel\ModuleApi\AbstractSubModule;
use TYPO3\CMS\Adminpanel\ModuleApi\DataProviderInterface;
use TYPO3\CMS\Adminpanel\ModuleApi\ModuleData;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Fluid\View\StandaloneView;
/**
* PhpInformation admin panel sub module
*
* @internal
*/
class PhpInformation extends AbstractSubModule implements DataProviderInterface
{
/**
* @inheritdoc
*/
public function getIdentifier(): string
{
return 'info_php';
}
/**
* @inheritdoc
*/
public function getLabel(): string
{
return $this->getLanguageService()->sL(
'LLL:EXT:adminpanel/Resources/Private/Language/locallang_info.xlf:sub.php.label'
);
}
/**
* @inheritdoc
*/
public function getDataToStore(ServerRequestInterface $request): ModuleData
{
return new ModuleData(
[
'general' => [
'PHP_VERSION' => PHP_VERSION,
'PHP_OS' => PHP_OS,
'PHP_SAPI' => PHP_SAPI,
'Peak Memory Usage' => GeneralUtility::formatSize(memory_get_peak_usage()),
],
'loadedExtensions' => implode(', ', get_loaded_extensions()),
'constants' => get_defined_constants(true),
]
);
}
/**
* @inheritdoc
*/
public function getContent(ModuleData $data): string
{
$view = GeneralUtility::makeInstance(StandaloneView::class);
$templateNameAndPath = 'EXT:adminpanel/Resources/Private/Templates/Modules/Info/PhpInfo.html';
$view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName($templateNameAndPath));
$view->setPartialRootPaths(['EXT:adminpanel/Resources/Private/Partials']);
$view->assignMultiple($data->getArrayCopy());
return $view->render();
}
}
@@ -0,0 +1,81 @@
<?php
declare(strict_types = 1);
namespace TYPO3\CMS\Adminpanel\Modules\Info;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Adminpanel\ModuleApi\AbstractSubModule;
use TYPO3\CMS\Adminpanel\ModuleApi\DataProviderInterface;
use TYPO3\CMS\Adminpanel\ModuleApi\ModuleData;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Fluid\View\StandaloneView;
/**
* RequestInformation submodule of the admin panel
*
* @internal
*/
class RequestInformation extends AbstractSubModule implements DataProviderInterface
{
/**
* @inheritdoc
*/
public function getIdentifier(): string
{
return 'info-request';
}
/**
* @inheritdoc
*/
public function getLabel(): string
{
return $this->getLanguageService()->sL(
'LLL:EXT:adminpanel/Resources/Private/Language/locallang_info.xlf:sub.request.label'
);
}
/**
* @inheritdoc
*/
public function getDataToStore(ServerRequestInterface $request): ModuleData
{
return new ModuleData(
[
'post' => $_POST,
'get' => $_GET,
'cookie' => $_COOKIE,
'session' => $_SESSION,
'server' => $_SERVER,
]
);
}
/**
* @inheritdoc
*/
public function getContent(ModuleData $data): string
{
$view = GeneralUtility::makeInstance(StandaloneView::class);
$templateNameAndPath = 'EXT:adminpanel/Resources/Private/Templates/Modules/Info/RequestInformation.html';
$view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName($templateNameAndPath));
$view->setPartialRootPaths(['EXT:adminpanel/Resources/Private/Partials']);
$view->assignMultiple($data->getArrayCopy());
return $view->render();
}
}