TYPO3 v15 dev-main snapshot ()

This commit is contained in:
2026-08-10 22:31:34 +02:00
commit 8a3bef5a34
61 changed files with 4603 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
/vendor/
@@ -0,0 +1,87 @@
<?php
declare(strict_types=1);
/*
* 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!
*/
namespace TYPO3\CMS\Reports\Controller;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Backend\Attribute\AsController;
use TYPO3\CMS\Backend\Routing\UriBuilder;
use TYPO3\CMS\Backend\Template\Components\ButtonBar;
use TYPO3\CMS\Backend\Template\Components\ComponentFactory;
use TYPO3\CMS\Backend\Template\Enum\ModuleLayout;
use TYPO3\CMS\Backend\Template\ModuleTemplateFactory;
use TYPO3\CMS\Core\Localization\LanguageService;
use TYPO3\CMS\Reports\Service\ContentStatisticsService;
/**
* @internal This class is a specific Backend controller implementation and is not considered part of the Public TYPO3 API.
*/
#[AsController]
final readonly class ContentStatisticsController
{
public function __construct(
private ModuleTemplateFactory $moduleTemplateFactory,
private ContentStatisticsService $contentStatisticsService,
private UriBuilder $uriBuilder,
private ComponentFactory $componentFactory,
) {}
public function handleRequest(ServerRequestInterface $request): ResponseInterface
{
$languageService = $this->getLanguageService();
$view = $this->moduleTemplateFactory->create($request);
$view->setLayout(ModuleLayout::NORMAL);
$view->setTitle(
$languageService->sL('reports.messages:mlang_tabs_tab'),
$languageService->sL('reports.messages:contentStatistics.title')
);
$view->makeDocHeaderModuleMenu();
$buttonBar = $view->getDocHeaderComponent()->getButtonBar();
$cType = $request->getQueryParams()['ctype'] ?? '';
if ($this->contentStatisticsService->isValidCtype($cType)) {
$backButton = $this->componentFactory->createBackButton((string)$this->uriBuilder->buildUriFromRoute('system_reports_contentstatistics'));
$buttonBar->addButton($backButton);
$shortcutButton = $this->componentFactory->createShortcutButton()
->setRouteIdentifier('system_reports_contentstatistics')
->setArguments(['ctype' => $cType])
->setDisplayName($languageService->sL('reports.messages:contentStatistics.title'));
$buttonBar->addButton($shortcutButton, ButtonBar::BUTTON_POSITION_RIGHT);
return $view->assignMultiple(
$this->contentStatisticsService->collectStatisticForCtype($cType, (int)($request->getQueryParams()['page'] ?? 1)),
)->renderResponse('ContentStatisticsDetail');
}
$shortcutButton = $this->componentFactory->createShortcutButton()
->setRouteIdentifier('system_reports_contentstatistics')
->setDisplayName($languageService->sL('reports.messages:contentStatistics.title'));
$buttonBar->addButton($shortcutButton, ButtonBar::BUTTON_POSITION_RIGHT);
return $view->assignMultiple([
'data' => $this->contentStatisticsService->collectStatistic(),
])->renderResponse('ContentStatistics');
}
private function getLanguageService(): LanguageService
{
return $GLOBALS['LANG'];
}
}
@@ -0,0 +1,68 @@
<?php
declare(strict_types=1);
/*
* 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!
*/
namespace TYPO3\CMS\Reports\Controller;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Backend\Attribute\AsController;
use TYPO3\CMS\Backend\Template\Enum\ModuleLayout;
use TYPO3\CMS\Backend\Template\ModuleTemplateFactory;
use TYPO3\CMS\Core\Localization\LanguageService;
use TYPO3\CMS\Reports\Service\RecordStatisticsService;
/**
* @internal This class is a specific Backend controller implementation and is not considered part of the Public TYPO3 API.
*/
#[AsController]
final readonly class RecordStatisticsController
{
public function __construct(
private ModuleTemplateFactory $moduleTemplateFactory,
private RecordStatisticsService $recordStatisticsService,
) {}
/**
* Main action - displays database record statistics
*/
public function handleRequest(ServerRequestInterface $request): ResponseInterface
{
$languageService = $this->getLanguageService();
$view = $this->moduleTemplateFactory->create($request);
$view->setLayout(ModuleLayout::NORMAL);
$view->setTitle(
$languageService->translate('title', 'reports.modules.overview'),
$languageService->translate('title', 'reports.modules.statistics')
);
$view->makeDocHeaderModuleMenu();
$view->getDocHeaderComponent()->setShortcutContext(
'system_reports_statistics',
$languageService->translate('title', 'reports.modules.statistics')
);
return $view->assignMultiple([
'pages' => $this->recordStatisticsService->collectPageStatistics(),
'doktypes' => $this->recordStatisticsService->collectDoktypeStatistics(),
'tables' => $this->recordStatisticsService->collectTableStatistics(),
])->renderResponse('RecordStatistics');
}
private function getLanguageService(): LanguageService
{
return $GLOBALS['LANG'];
}
}
@@ -0,0 +1,84 @@
<?php
declare(strict_types=1);
/*
* 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!
*/
namespace TYPO3\CMS\Reports\Controller;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Backend\Attribute\AsController;
use TYPO3\CMS\Backend\Template\Enum\ModuleLayout;
use TYPO3\CMS\Backend\Template\ModuleTemplateFactory;
use TYPO3\CMS\Core\Localization\LanguageService;
use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity;
use TYPO3\CMS\Reports\Service\StatusService;
/**
* @internal This class is a specific Backend controller implementation and is not considered part of the Public TYPO3 API.
*/
#[AsController]
final readonly class StatusReportController
{
public function __construct(
private ModuleTemplateFactory $moduleTemplateFactory,
private StatusService $statusService,
) {}
/**
* Main action - displays the system status report
*/
public function handleRequest(ServerRequestInterface $request): ResponseInterface
{
$statusCollection = $this->statusService->getSystemStatus($request);
$this->statusService->collectAndStoreSystemStatus($request);
// Apply sorting to collection and the providers
$statusCollection = $this->statusService->sortStatusProviders($statusCollection);
foreach ($statusCollection as &$statuses) {
$statuses = $this->statusService->sortStatuses($statuses);
}
unset($statuses);
$languageService = $this->getLanguageService();
$view = $this->moduleTemplateFactory->create($request);
$view->setLayout(ModuleLayout::NORMAL);
$view->setTitle(
$languageService->translate('title', 'reports.modules.overview'),
$languageService->translate('title', 'reports.modules.status')
);
$view->makeDocHeaderModuleMenu();
$view->getDocHeaderComponent()->setShortcutContext(
'system_reports_status',
$languageService->translate('title', 'reports.modules.status')
);
return $view->assignMultiple([
'statusCollection' => $statusCollection,
'severityIconMapping' => [
ContextualFeedbackSeverity::NOTICE->value => 'actions-info',
ContextualFeedbackSeverity::INFO->value => 'actions-info',
ContextualFeedbackSeverity::OK->value => 'actions-check',
ContextualFeedbackSeverity::WARNING->value => 'actions-exclamation',
ContextualFeedbackSeverity::ERROR->value => 'actions-exclamation',
],
])->renderResponse('StatusReport');
}
private function getLanguageService(): LanguageService
{
return $GLOBALS['LANG'];
}
}
@@ -0,0 +1,29 @@
<?php
/*
* 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!
*/
namespace TYPO3\CMS\Reports;
/**
* Interface for classes which provide a status report entry.
*/
interface ExtendedStatusProviderInterface
{
/**
* Returns the detailed status of an extension or (sub)system
*
* @return \TYPO3\CMS\Reports\Status[]
*/
public function getDetailedStatus();
}
@@ -0,0 +1,215 @@
<?php
declare(strict_types=1);
/*
* 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!
*/
namespace TYPO3\CMS\Reports\Integrity;
use Symfony\Component\DependencyInjection\Attribute\Autoconfigure;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Database\Connection;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
use TYPO3\CMS\Core\Schema\TcaSchema;
use TYPO3\CMS\Core\Schema\TcaSchemaFactory;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* This class holds functions used by the TYPO3 backend for the RecordStatistics Service
* of the database.
*
* @internal not part of TYPO3 Core API
*/
#[Autoconfigure(public: true)]
class DatabaseIntegrityCheck
{
/**
* @var array Will hold id/rec pairs from genTree()
*/
protected array $pageIdArray = [];
/**
* @var array Will hold id/rec pairs from genTree() that are not default language
*/
protected array $pageTranslatedPageIDArray = [];
protected array $recStats = [
'all_valid' => [],
'published_versions' => [],
'deleted' => [],
];
protected array $lRecords = [];
public function __construct(
protected readonly TcaSchemaFactory $tcaSchemaFactory,
protected readonly ConnectionPool $connectionPool,
) {}
/**
* Generates a list of Page-uid's that corresponds to the tables in the tree.
* This list should ideally include all records in the pages-table.
*
* @param int $theID a pid (page-record id) from which to start making the tree
* @param bool $versions Internal variable, don't set from outside!
*/
public function genTree(int $theID, bool $versions = false): void
{
$queryBuilder = $this->connectionPool->getQueryBuilderForTable('pages');
$queryBuilder->getRestrictions()->removeAll();
$queryBuilder->select('uid', 'title', 'doktype', 'deleted', 'hidden', 'sys_language_uid')
->from('pages')
->orderBy('sorting');
if ($versions) {
$queryBuilder->addSelect('t3ver_wsid');
$queryBuilder->where(
$queryBuilder->expr()->eq('t3ver_oid', $queryBuilder->createNamedParameter($theID, Connection::PARAM_INT))
);
} else {
$queryBuilder->where(
$queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter($theID, Connection::PARAM_INT))
);
}
$result = $queryBuilder->executeQuery();
// Traverse the records selected
while ($row = $result->fetchAssociative()) {
$newID = $row['uid'];
// Register various data for this item:
if ($row['language_tag'] === 0) {
$this->pageIdArray[$newID] = $row;
} else {
$this->pageTranslatedPageIDArray[$newID] = $row;
}
$this->recStats['all_valid']['pages'][$newID] = $newID;
if ($row['deleted']) {
$this->recStats['deleted']['pages'][$newID] = $newID;
}
if (!isset($this->recStats['hidden'])) {
$this->recStats['hidden'] = 0;
}
if ($row['hidden']) {
$this->recStats['hidden']++;
}
$this->recStats['doktype'][$row['doktype']] ??= 0;
$this->recStats['doktype'][$row['doktype']]++;
// Add sub pages:
$this->genTree($newID);
// If versions are included in the tree, add those now:
$this->genTree($newID, true);
}
}
/**
* Fills $this->lRecords with the records from all tc-tables that are not attached to a PID in the pid-list.
*
* @param array $pageIds list of pid's (page-record uid's). This list is probably made by genTree()
*/
public function lostRecords(array $pageIds): array
{
/** @var TcaSchema $schema */
foreach ($this->tcaSchemaFactory->all() as $table => $schema) {
$queryBuilder = $this->connectionPool->getQueryBuilderForTable($table);
$queryBuilder->getRestrictions()->removeAll();
$queryResult = $queryBuilder
->select('*')
->from($table)
->where(
$queryBuilder->expr()->notIn(
'pid',
$queryBuilder->createNamedParameter($pageIds, Connection::PARAM_INT_ARRAY)
)
)
->executeQuery();
while ($row = $queryResult->fetchAssociative()) {
$recordId = (int)$row['uid'];
$this->lRecords[$table][$recordId] = [
'uid' => $recordId,
'pid' => $row['pid'],
'title' => strip_tags(BackendUtility::getRecordTitle($table, $row)),
];
}
}
return $this->lRecords;
}
/**
* Counts records from $GLOBALS['TCA']-tables that ARE attached to an existing page.
*
* @param array $pageIds list of pid's (page-record uid's). This list is probably made by genTree()
* @return array an array with the number of records from all $GLOBALS['TCA']-tables that are attached to a PID in the pid-list.
*/
public function countRecords(array $pageIds): array
{
$list = [];
$list_n = [];
/** @var TcaSchema $schema */
foreach ($this->tcaSchemaFactory->all() as $table => $schema) {
$pageIdsForTable = $pageIds;
$queryBuilder = $this->connectionPool->getQueryBuilderForTable($table);
$queryBuilder->getRestrictions()->removeAll();
$count = $queryBuilder->count('uid')
->from($table)
->where(
$queryBuilder->expr()->in(
'pid',
$queryBuilder->createNamedParameter($pageIds, Connection::PARAM_INT_ARRAY)
)
)
->executeQuery()
->fetchOne();
if ($count) {
$list[$table] = $count;
}
// same query excluding all deleted records
$queryBuilder = $this->connectionPool->getQueryBuilderForTable($table);
$queryBuilder->getRestrictions()
->removeAll()
->add(GeneralUtility::makeInstance(DeletedRestriction::class));
$count = $queryBuilder->count('uid')
->from($table)
->where(
$queryBuilder->expr()->in(
'pid',
$queryBuilder->createNamedParameter($pageIdsForTable, Connection::PARAM_INT_ARRAY)
)
)
->executeQuery()
->fetchOne();
if ($count) {
$list_n[$table] = $count;
}
}
return ['all' => $list, 'non_deleted' => $list_n];
}
public function getPageIdArray(): array
{
return $this->pageIdArray;
}
public function getPageTranslatedPageIDArray(): array
{
return $this->pageTranslatedPageIDArray;
}
public function getRecStats(): array
{
return $this->recStats;
}
}
+54
View File
@@ -0,0 +1,54 @@
<?php
declare(strict_types=1);
/*
* 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!
*/
namespace TYPO3\CMS\Reports\Registry;
use TYPO3\CMS\Reports\StatusProviderInterface;
/**
* Registry for status providers. The registry receives all services, tagged with "reports.status".
* The tagging of status providers is automatically done based on the implemented StatusProviderInterface.
*
* @internal
*/
class StatusRegistry
{
/**
* @var StatusProviderInterface[]
*/
private array $providers = [];
/**
* @param iterable<StatusProviderInterface> $providers
*/
public function __construct(iterable $providers)
{
foreach ($providers as $item) {
$this->providers[] = $item;
}
}
/**
* Get all registered status providers
*
* @return StatusProviderInterface[]
*/
public function getProviders(): array
{
return $this->providers;
}
}
@@ -0,0 +1,356 @@
<?php
/*
* 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!
*/
namespace TYPO3\CMS\Reports\Report\Status;
use Doctrine\DBAL\Platforms\MariaDBPlatform as DoctrineMariaDBPlatform;
use Doctrine\DBAL\Platforms\MySQLPlatform as DoctrineMySQLPlatform;
use TYPO3\CMS\Backend\Routing\UriBuilder;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Cache\Backend\MemcachedBackend;
use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Localization\LanguageService;
use TYPO3\CMS\Core\Registry;
use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Reports\Status;
use TYPO3\CMS\Reports\Status as ReportStatus;
use TYPO3\CMS\Reports\StatusProviderInterface;
/**
* Performs some checks about the install tool protection status
*/
readonly class ConfigurationStatus implements StatusProviderInterface
{
public function __construct(
private UriBuilder $uriBuilder,
private Registry $registry,
private ConnectionPool $connectionPool,
) {}
/**
* Determines the Install Tool's status, mainly concerning its protection.
*
* @return Status[]
*/
public function getStatus(): array
{
$statuses = [
'emptyReferenceIndex' => $this->getReferenceIndexStatus(),
];
if ($this->isMemcachedUsed()) {
$statuses['memcachedConnection'] = $this->getMemcachedConnectionStatus();
}
if (!Environment::isWindows()) {
$statuses['createdFilesWorldWritable'] = $this->getCreatedFilesWorldWritableStatus();
$statuses['createdDirectoriesWorldWritable'] = $this->getCreatedDirectoriesWorldWritableStatus();
}
if ($this->isMysqlUsed()) {
$statuses['mysqlDatabaseUsesUtf8'] = $this->getMysqlDatabaseUtf8Status();
}
return $statuses;
}
public function getLabel(): string
{
return 'configuration';
}
/**
* Checks if sys_refindex is empty.
*
* @return \TYPO3\CMS\Reports\Status An object representing whether the reference index is empty or not
*/
protected function getReferenceIndexStatus(): ReportStatus
{
$value = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_ok');
$message = '';
$severity = ContextualFeedbackSeverity::OK;
$queryBuilder = $this->connectionPool->getQueryBuilderForTable('sys_refindex');
$count = $queryBuilder
->count('*')
->from('sys_refindex')
->executeQuery()
->fetchOne();
$lastRefIndexUpdate = $this->registry->get('core', 'sys_refindex_lastUpdate');
if (!$count && $lastRefIndexUpdate) {
$value = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_empty');
$severity = ContextualFeedbackSeverity::WARNING;
$url = (string)$this->uriBuilder->buildUriFromRoute('system_maintenance');
$message = sprintf($this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:warning.backend_reference_index'), '<a href="' . htmlspecialchars($url) . '">', '</a>', BackendUtility::datetime($lastRefIndexUpdate));
}
return new ReportStatus($this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_referenceIndex'), $value, $message, $severity);
}
/**
* Checks whether memcached is configured, if that's the case we assume it's also used.
*
* @return bool TRUE if memcached is used, FALSE otherwise.
*/
protected function isMemcachedUsed(): bool
{
$memcachedUsed = false;
$memcachedServers = $this->getConfiguredMemcachedServers();
if (!empty($memcachedServers)) {
$memcachedUsed = true;
}
return $memcachedUsed;
}
/**
* Gets the configured memcached server connections.
*
* @return array An array of configured memcached server connections.
*/
protected function getConfiguredMemcachedServers(): array
{
$configurations = $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'] ?? [];
$memcachedServers = [];
foreach ($configurations as $table => $conf) {
if (is_array($conf)) {
foreach ($conf as $value) {
if ($value === MemcachedBackend::class && is_array($configurations[$table]['options']['servers'])) {
$memcachedServers = $configurations[$table]['options']['servers'];
break;
}
}
}
}
return $memcachedServers;
}
/**
* Checks whether TYPO3 can connect to the configured memcached servers.
*
* @return \TYPO3\CMS\Reports\Status An object representing whether TYPO3 can connect to the configured memcached servers
*/
protected function getMemcachedConnectionStatus(): ReportStatus
{
$value = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_ok');
$message = '';
$severity = ContextualFeedbackSeverity::OK;
$failedConnections = [];
$defaultMemcachedPort = ini_get('memcache.default_port');
$defaultMemcachedPort = MathUtility::canBeInterpretedAsInteger($defaultMemcachedPort) ? (int)$defaultMemcachedPort : 11211;
$memcachedServers = $this->getConfiguredMemcachedServers();
if (function_exists('memcache_connect') && $memcachedServers !== []) {
foreach ($memcachedServers as $testServer) {
$configuredServer = $testServer;
if (str_starts_with($testServer, 'unix://')) {
$host = $testServer;
$port = 0;
} else {
if (str_starts_with($testServer, 'tcp://')) {
$testServer = substr($testServer, 6);
}
if (str_contains($testServer, ':')) {
[$host, $port] = explode(':', $testServer, 2);
$port = (int)$port;
} else {
$host = $testServer;
$port = $defaultMemcachedPort;
}
}
$memcachedConnection = @memcache_connect($host, $port);
if ($memcachedConnection != null) {
@memcache_close($memcachedConnection);
} else {
$failedConnections[] = $configuredServer;
}
}
}
if (!empty($failedConnections)) {
$value = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_connectionFailed');
$severity = ContextualFeedbackSeverity::WARNING;
$message = $this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:warning.memcache_not_usable') . '<br /><br /><ul><li>' . implode('</li><li>', $failedConnections) . '</li></ul>';
}
return new ReportStatus($this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_memcachedConfiguration'), $value, $message, $severity);
}
/**
* Warning, if fileCreateMask has write bit for 'others' set.
*
* @return \TYPO3\CMS\Reports\Status The writable status for 'others'
*/
protected function getCreatedFilesWorldWritableStatus(): ReportStatus
{
$value = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_ok');
$message = '';
$severity = ContextualFeedbackSeverity::OK;
if ((int)$GLOBALS['TYPO3_CONF_VARS']['SYS']['fileCreateMask'] % 10 & 2) {
$value = $GLOBALS['TYPO3_CONF_VARS']['SYS']['fileCreateMask'];
$severity = ContextualFeedbackSeverity::WARNING;
$message = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_CreatedFilePermissions.writable');
}
return new ReportStatus($this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_CreatedFilePermissions'), $value, $message, $severity);
}
/**
* Warning, if folderCreateMask has write bit for 'others' set.
*
* @return \TYPO3\CMS\Reports\Status The writable status for 'others'
*/
protected function getCreatedDirectoriesWorldWritableStatus(): ReportStatus
{
$value = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_ok');
$message = '';
$severity = ContextualFeedbackSeverity::OK;
if ((int)$GLOBALS['TYPO3_CONF_VARS']['SYS']['folderCreateMask'] % 10 & 2) {
$value = $GLOBALS['TYPO3_CONF_VARS']['SYS']['folderCreateMask'];
$severity = ContextualFeedbackSeverity::WARNING;
$message = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_CreatedDirectoryPermissions.writable');
}
return new ReportStatus($this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_CreatedDirectoryPermissions'), $value, $message, $severity);
}
/**
* Checks if the default connection is a MySQL compatible database instance.
*/
protected function isMysqlUsed(): bool
{
$platform = $this->connectionPool
->getConnectionByName(ConnectionPool::DEFAULT_CONNECTION_NAME)
->getDatabasePlatform();
return $platform instanceof DoctrineMariaDBPlatform || $platform instanceof DoctrineMySQLPlatform;
}
/**
* Checks the character set of the default database and reports an error if it is not utf-8.
*/
protected function getMysqlDatabaseUtf8Status(): ReportStatus
{
$collationConstraint = null;
$charset = '';
$connection = $this->connectionPool
->getConnectionByName(ConnectionPool::DEFAULT_CONNECTION_NAME);
$connectionParams = $connection->getParams();
$queryBuilder = $connection->createQueryBuilder();
$defaultDatabaseCharset = (string)$queryBuilder->select('DEFAULT_CHARACTER_SET_NAME')
->from('information_schema.SCHEMATA')
->where(
$queryBuilder->expr()->eq(
'SCHEMA_NAME',
$queryBuilder->createNamedParameter($connection->getDatabase())
)
)
->setMaxResults(1)
->executeQuery()
->fetchOne();
$severity = ContextualFeedbackSeverity::OK;
$statusValue = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_ok');
// also allow utf8mb3 and utf8mb4
if (!str_starts_with($defaultDatabaseCharset, 'utf8')) {
// If the default character set is e.g. latin1, BUT all tables in the system are UTF-8,
// we assume that TYPO3 has the correct charset for adding tables, and everything is fine
$queryBuilder = $connection->createQueryBuilder();
$nonUtf8TableCollationsFound = $queryBuilder->select('table_collation')
->from('information_schema.tables')
->where(
$queryBuilder->expr()->and(
$queryBuilder->expr()->eq('table_schema', $queryBuilder->quote((string)$connection->getDatabase())),
$queryBuilder->expr()->notLike('table_collation', $queryBuilder->quote('utf8%'))
)
)
->setMaxResults(1)
->executeQuery();
if ($nonUtf8TableCollationsFound->rowCount() > 0) {
$message = sprintf($this->getLanguageService()
->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_MysqlDatabaseCharacterSet_Unsupported'), $defaultDatabaseCharset);
$severity = ContextualFeedbackSeverity::ERROR;
$statusValue = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_wrongValue');
} else {
$message = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_MysqlDatabaseCharacterSet_Info');
$severity = ContextualFeedbackSeverity::INFO;
$statusValue = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_info');
}
} elseif (isset($connectionParams['defaultTableOptions'])) {
$message = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_MysqlDatabaseCharacterSet_Ok');
$tableOptions = $connectionParams['defaultTableOptions'];
if (isset($tableOptions['collation'])) {
$collationConstraint = $queryBuilder->expr()->neq('table_collation', $queryBuilder->quote($tableOptions['collation']));
$charset = $tableOptions['collation'];
} elseif (isset($tableOptions['charset'])) {
$collationConstraint = $queryBuilder->expr()->notLike('table_collation', $queryBuilder->quote($tableOptions['charset'] . '%'));
$charset = $tableOptions['charset'];
}
if (isset($collationConstraint)) {
$queryBuilder = $connection->createQueryBuilder();
$wrongCollationTablesFound = $queryBuilder->select('table_collation')
->from('information_schema.tables')
->where(
$queryBuilder->expr()->and(
$queryBuilder->expr()->eq('table_schema', $queryBuilder->quote($connection->getDatabase())),
$collationConstraint
)
)
->setMaxResults(1)
->executeQuery();
if ($wrongCollationTablesFound->rowCount() > 0) {
$message = sprintf($this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_MysqlDatabaseCharacterSet_MixedCollations'), $charset);
$severity = ContextualFeedbackSeverity::ERROR;
$statusValue = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_checkFailed');
} else {
if (isset($tableOptions['collation'])) {
$collationConstraint = $queryBuilder->expr()->neq('collation_name', $queryBuilder->quote($tableOptions['collation']));
} elseif (isset($tableOptions['charset'])) {
$collationConstraint = $queryBuilder->expr()->notLike('collation_name', $queryBuilder->quote($tableOptions['charset'] . '%'));
}
$queryBuilder = $connection->createQueryBuilder();
$wrongCollationColumnsFound = $queryBuilder->select('collation_name')
->from('information_schema.columns')
->where(
$queryBuilder->expr()->and(
$queryBuilder->expr()->eq('table_schema', $queryBuilder->quote($connection->getDatabase())),
$collationConstraint
)
)
->setMaxResults(1)
->executeQuery();
if ($wrongCollationColumnsFound->rowCount() > 0) {
$message = sprintf($this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_MysqlDatabaseCharacterSet_MixedCollations'), $charset);
$severity = ContextualFeedbackSeverity::ERROR;
$statusValue = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_checkFailed');
}
}
}
} else {
$message = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_MysqlDatabaseCharacterSet_Ok');
}
return new ReportStatus(
$this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_MysqlDatabaseCharacterSet'),
$statusValue,
$message,
$severity
);
}
protected function getLanguageService(): LanguageService
{
return $GLOBALS['LANG'];
}
}
+254
View File
@@ -0,0 +1,254 @@
<?php
/*
* 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!
*/
namespace TYPO3\CMS\Reports\Report\Status;
use TYPO3\CMS\Core\Database\Connection;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Localization\LanguageService;
use TYPO3\CMS\Core\Resource\File;
use TYPO3\CMS\Core\Resource\FolderInterface;
use TYPO3\CMS\Core\Resource\ResourceStorage;
use TYPO3\CMS\Core\Resource\Service\ResourceConsistencyService;
use TYPO3\CMS\Core\Resource\StorageRepository;
use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity;
use TYPO3\CMS\Core\Validation\ResultException;
use TYPO3\CMS\Core\Validation\ResultRenderingTrait;
use TYPO3\CMS\Reports\Status;
use TYPO3\CMS\Reports\Status as ReportStatus;
use TYPO3\CMS\Reports\StatusProviderInterface;
/**
* Performs several checks about the FAL status
*/
readonly class FalStatus implements StatusProviderInterface
{
use ResultRenderingTrait;
public function __construct(
private ResourceConsistencyService $resourceConsistencyService,
private ConnectionPool $connectionPool,
private StorageRepository $storageRepository,
) {}
/**
* Determines the status of the FAL index.
*
* @return Status[] List of statuses
*/
public function getStatus(): array
{
return [
'MissingFiles' => $this->getMissingFilesStatus(),
'ConsistencyCheck' => $this->getConsistencyCheckStatus(),
];
}
public function getDetailedStatus(): array
{
return [
'ConsistencyCheck' => $this->getConsistencyCheckStatus(),
];
}
public function getLabel(): string
{
return 'fal';
}
/**
* Checks if there are files marked as missed.
*
* @return \TYPO3\CMS\Reports\Status An object representing whether there are files marked as missed or not
*/
protected function getMissingFilesStatus()
{
$value = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_none');
$count = 0;
$maxFilesToShow = 100;
$message = '';
$severity = ContextualFeedbackSeverity::OK;
$storages = $this->getBrowsableStorages();
if (!empty($storages)) {
$queryBuilder = $this->connectionPool->getQueryBuilderForTable('sys_file');
$count = $queryBuilder
->count('*')
->from('sys_file')
->where(
$queryBuilder->expr()->eq(
'missing',
$queryBuilder->createNamedParameter(1, Connection::PARAM_INT)
),
$queryBuilder->expr()->in(
'storage',
$queryBuilder->createNamedParameter(array_keys($storages), Connection::PARAM_INT_ARRAY)
)
)
->executeQuery()
->fetchOne();
}
if ($count) {
$value = sprintf($this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_missingFilesCount'), $count);
$severity = ContextualFeedbackSeverity::WARNING;
$queryBuilder = $this->connectionPool->getQueryBuilderForTable('sys_file');
$files = $queryBuilder
->select('identifier', 'storage')
->from('sys_file')
->where(
$queryBuilder->expr()->eq(
'missing',
$queryBuilder->createNamedParameter(1, Connection::PARAM_INT)
),
$queryBuilder->expr()->in(
'storage',
$queryBuilder->createNamedParameter(array_keys($storages), Connection::PARAM_INT_ARRAY)
)
)
->setMaxResults($maxFilesToShow)
->executeQuery()
->fetchAllAssociative();
$message = '<p>' . $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_missingFilesMessage') . '</p>';
foreach ($files as $file) {
$message .= $storages[$file['storage']]->getName() . ' ' . $file['identifier'] . '<br />';
}
if ($count > $maxFilesToShow) {
$message .= '...<br />';
}
}
return new ReportStatus($this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_missingFiles'), $value, $message, $severity);
}
protected function getConsistencyCheckStatus(): ReportStatus
{
// @todo for performance reasons, consider using this only in CLI context as `ExtendedStatusProviderInterface`
$storages = $this->getBrowsableStorages();
$inconsistenciesMessage = '';
foreach ($storages as $storage) {
$inconsistencies = $this->checkFolderConsistency($storage->getRootLevelFolder());
if ($inconsistencies !== []) {
$inconsistenciesMessage .= sprintf(
'<h5>%s</h5>%s',
htmlspecialchars(sprintf(
'Storage "%s" (id:%d)',
$storage->getName(),
$storage->getUid()
)),
$this->wrapInHtmlUnorderedList($inconsistencies)
);
}
}
if ($inconsistenciesMessage === '') {
return new ReportStatus(
'Consistency check',
'No inconsistencies found in these storages',
// make sure we have a list of strings (0… index) with `array_values` to ensure correct rendering
$this->wrapInHtmlUnorderedList(array_values(array_map(
static fn(ResourceStorage $storage): string => sprintf(
'%s (id: %d)',
$storage->getName(),
$storage->getUid()
),
$storages,
))),
ContextualFeedbackSeverity::OK,
);
}
return new ReportStatus(
'Consistency Status',
'Inconsistent files have been found',
$inconsistenciesMessage,
ContextualFeedbackSeverity::ERROR,
);
}
private function checkFolderConsistency(FolderInterface $folder): array
{
$inconsistencies = [];
foreach ($folder->getFiles() as $file) {
if (!$file instanceof File) {
continue;
}
try {
$this->resourceConsistencyService->validate($file->getStorage(), $file);
} catch (ResultException $exception) {
$inconsistencies[$file->getCombinedIdentifier()] = $this->compileResultMessages(
$exception->messages,
$this->getLanguageService()
);
}
}
foreach ($folder->getSubfolders() as $subFolder) {
$inconsistencies = [...$inconsistencies, ...$this->checkFolderConsistency($subFolder)];
}
return $inconsistencies;
}
/**
* @param list<string>|array<string, list<string>> $items
*/
protected function wrapInHtmlUnorderedList(array $items): string
{
if (array_is_list($items)) {
return sprintf(
'<ul>%s</ul>',
implode('', array_map(
static fn(string $item): string => '<li>' . htmlspecialchars($item) . '</li>',
$items
))
);
}
return sprintf(
'<ul>%s</ul>',
implode('', array_map(
fn(string $key, array $values): string => sprintf(
'<li>%s%s</li>',
htmlspecialchars($key),
$this->wrapInHtmlUnorderedList($values)
),
array_keys($items),
array_values($items)
))
);
}
/**
* Filter available storages that are actually browsable
*
* @return array<int,ResourceStorage>
*/
protected function getBrowsableStorages(): array
{
$storages = [];
foreach ($this->storageRepository->findAll() as $storageObject) {
if ($storageObject->isBrowsable()) {
$storages[$storageObject->getUid()] = $storageObject;
}
}
return $storages;
}
protected function getLanguageService(): LanguageService
{
return $GLOBALS['LANG'];
}
}
@@ -0,0 +1,111 @@
<?php
/*
* 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!
*/
namespace TYPO3\CMS\Reports\Report\Status;
use TYPO3\CMS\Core\Imaging\GraphicalFunctions;
use TYPO3\CMS\Core\Localization\LanguageService;
use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Reports\Status;
use TYPO3\CMS\Reports\StatusProviderInterface;
/**
* Performs several checks about processing images
*/
class ImageProcessingStatus implements StatusProviderInterface
{
/**
* Determines the status of the FAL index.
*
* @return Status[] List of statuses
*/
public function getStatus(): array
{
return [
'webp' => $this->getMissingFilesStatus('webp'),
'avif' => $this->getMissingFilesStatus('avif'),
];
}
public function getLabel(): string
{
return 'imageprocessing';
}
/**
* Checks if webp | avif support is activated, but webp | avif is not enabled in ImageMagick / GraphicsMagick
*/
protected function getMissingFilesStatus(string $fileFormat = 'webp'): Status
{
switch ($fileFormat) {
case 'avif':
$messageNotConfigured = 'LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_imageprocessing_avif_not_configured';
$messageAvailable = 'LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_imageprocessing_avif_available';
$messageNotAvailable = 'LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_imageprocessing_avif_not_available';
$messageAvailableAndConfigured = 'LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_imageprocessing_avif_available_and_configured';
$messageTitle = 'LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_imageprocessing_avif';
break;
case 'webp':
default:
$messageNotConfigured = 'LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_imageprocessing_webp_not_configured';
$messageAvailable = 'LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_imageprocessing_webp_available';
$messageNotAvailable = 'LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_imageprocessing_webp_not_available';
$messageAvailableAndConfigured = 'LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_imageprocessing_webp_available_and_configured';
$messageTitle = 'LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_imageprocessing_webp';
break;
}
$imageProcessing = GeneralUtility::makeInstance(GraphicalFunctions::class);
if (!$imageProcessing->isProcessingEnabled()) {
$severity = ContextualFeedbackSeverity::INFO;
$value = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_disabled');
$message = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_imageprocessing_disabled');
// ImageMagick / GraphicsMagick is not enabled, all good
} elseif (!in_array($fileFormat, $imageProcessing->getImageFileExt(), true)) {
// webp | avif is not enabled in TYPO3's Configuration
$severity = ContextualFeedbackSeverity::INFO;
$message = $this->getLanguageService()->sL($messageNotConfigured);
$value = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_disabled');
// But ImageMagick can do it, maybe it could be activated
if ($imageProcessing->isConvertSupportAvailableForFormat(strtoupper($fileFormat))) {
$message = $this->getLanguageService()->sL($messageAvailable);
}
} elseif (!$imageProcessing->isConvertSupportAvailableForFormat(strtoupper($fileFormat))) {
// webp | avif is configured to be available, but ImageMagick/GraphicsMagick does not support this.
$severity = ContextualFeedbackSeverity::WARNING;
$message = $this->getLanguageService()->sL($messageNotAvailable);
$value = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_enabled');
} else {
// webp | avif is configured to be available, and ImageMagick/GraphicsMagick supports this.
$severity = ContextualFeedbackSeverity::OK;
$message = $this->getLanguageService()->sL($messageAvailableAndConfigured);
$value = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_enabled');
}
return new Status(
$this->getLanguageService()->sL($messageTitle),
$value,
$message,
$severity
);
}
protected function getLanguageService(): LanguageService
{
return $GLOBALS['LANG'];
}
}
+247
View File
@@ -0,0 +1,247 @@
<?php
declare(strict_types=1);
/*
* 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!
*/
namespace TYPO3\CMS\Reports\Report\Status;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Localization\LanguageService;
use TYPO3\CMS\Core\Middleware\VerifyHostHeader;
use TYPO3\CMS\Core\Resource\Security\FileNameValidator;
use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Reports\RequestAwareStatusProviderInterface;
use TYPO3\CMS\Reports\Status as ReportStatus;
/**
* Performs several checks about the system's health
*/
class SecurityStatus implements RequestAwareStatusProviderInterface
{
/**
* Determines the security of this TYPO3 installation
*
* @param ServerRequestInterface|null $request
* @return ReportStatus[] List of statuses
*/
public function getStatus(?ServerRequestInterface $request = null): array
{
$statuses = [
'trustedHostsPattern' => $this->getTrustedHostsPatternStatus(),
'fileDenyPattern' => $this->getFileDenyPatternStatus(),
'htaccessUpload' => $this->getHtaccessUploadStatus(),
'exceptionHandler' => $this->getExceptionHandlerStatus(),
'exportedFiles' => $this->getExportedFilesStatus(),
];
if ($request !== null) {
$statuses['encryptedConnectionStatus'] = $this->getEncryptedConnectionStatus($request);
$lockSslStatus = $this->getLockSslStatus($request);
if ($lockSslStatus) {
$statuses['getLockSslStatus'] = $lockSslStatus;
}
}
return $statuses;
}
public function getLabel(): string
{
return 'security';
}
/**
* Checks if the current connection is encrypted (HTTPS)
*/
protected function getEncryptedConnectionStatus(ServerRequestInterface $request): ReportStatus
{
$value = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_ok');
$message = '';
$severity = ContextualFeedbackSeverity::OK;
$normalizedParams = $request->getAttribute('normalizedParams');
if (!$normalizedParams->isHttps()) {
$value = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_insecure');
$severity = ContextualFeedbackSeverity::WARNING;
$message = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_encryptedConnectionStatus_insecure');
}
return new ReportStatus($this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_encryptedConnectionStatus'), $value, $message, $severity);
}
/**
* @return ReportStatus
*/
protected function getLockSslStatus(ServerRequestInterface $request): ?ReportStatus
{
$normalizedParams = $request->getAttribute('normalizedParams');
if ($normalizedParams->isHttps()) {
$value = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_ok');
$message = '';
$severity = ContextualFeedbackSeverity::OK;
if (!$GLOBALS['TYPO3_CONF_VARS']['BE']['lockSSL']) {
$value = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_insecure');
$message = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_lockSslStatus_insecure');
$severity = ContextualFeedbackSeverity::WARNING;
}
return new ReportStatus($this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_lockSslStatus'), $value, $message, $severity);
}
return null;
}
/**
* Checks if the trusted hosts pattern check is disabled.
*
* @return ReportStatus An object representing whether the check is disabled
*/
protected function getTrustedHostsPatternStatus(): ReportStatus
{
$value = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_ok');
$message = '';
$severity = ContextualFeedbackSeverity::OK;
if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['trustedHostsPattern'] === VerifyHostHeader::ENV_TRUSTED_HOSTS_PATTERN_ALLOW_ALL) {
$value = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_insecure');
$severity = ContextualFeedbackSeverity::ERROR;
$message = $this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:warning.install_trustedhosts');
}
return new ReportStatus($this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_trustedHostsPattern'), $value, $message, $severity);
}
/**
* Checks if fileDenyPattern was changed which is dangerous on Apache
*
* @return ReportStatus An object representing whether the file deny pattern has changed
*/
protected function getFileDenyPatternStatus(): ReportStatus
{
$value = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_ok');
$message = '';
$severity = ContextualFeedbackSeverity::OK;
$fileAccessCheck = GeneralUtility::makeInstance(FileNameValidator::class);
if ($fileAccessCheck->missingImportantPatterns()) {
$value = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_insecure');
$severity = ContextualFeedbackSeverity::ERROR;
$message = sprintf(
$this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:warning.file_deny_pattern_partsNotPresent'),
'<br /><pre>' . htmlspecialchars($fileAccessCheck::DEFAULT_FILE_DENY_PATTERN) . '</pre><br />'
);
}
return new ReportStatus($this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_fileDenyPattern'), $value, $message, $severity);
}
/**
* Checks if fileDenyPattern allows to upload .htaccess files which is
* dangerous on Apache.
*
* @return ReportStatus An object representing whether it's possible to upload .htaccess files
*/
protected function getHtaccessUploadStatus(): ReportStatus
{
$value = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_ok');
$message = '';
$severity = ContextualFeedbackSeverity::OK;
$fileNameAccess = GeneralUtility::makeInstance(FileNameValidator::class);
if ($fileNameAccess->customFileDenyPatternConfigured()
&& $fileNameAccess->isValid('.htaccess')) {
$value = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_insecure');
$severity = ContextualFeedbackSeverity::ERROR;
$message = $this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:warning.file_deny_htaccess');
}
return new ReportStatus($this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_htaccessUploadProtection'), $value, $message, $severity);
}
protected function getExceptionHandlerStatus(): ReportStatus
{
$value = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_ok');
$message = '';
$severity = ContextualFeedbackSeverity::OK;
if (
str_contains($GLOBALS['TYPO3_CONF_VARS']['SYS']['productionExceptionHandler'], 'Debug')
|| (Environment::getContext()->isProduction() && (int)$GLOBALS['TYPO3_CONF_VARS']['SYS']['displayErrors'] === 1)
) {
$value = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_insecure');
$severity = ContextualFeedbackSeverity::ERROR;
$message = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_exceptionHandler_errorMessage');
} elseif ((int)$GLOBALS['TYPO3_CONF_VARS']['SYS']['displayErrors'] === 1) {
$severity = ContextualFeedbackSeverity::WARNING;
$message = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_exceptionHandler_warningMessage');
}
return new ReportStatus($this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_exceptionHandler'), $value, $message, $severity);
}
protected function getExportedFilesStatus(): ReportStatus
{
$value = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_ok');
$message = '';
$severity = ContextualFeedbackSeverity::OK;
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('sys_file');
$exportedFiles = $queryBuilder
->select('storage', 'identifier')
->from('sys_file')
->where(
$queryBuilder->expr()->like(
'identifier',
$queryBuilder->createNamedParameter('%/_temp_/importexport/%')
),
$queryBuilder->expr()->or(
$queryBuilder->expr()->like(
'identifier',
$queryBuilder->createNamedParameter('%.xml')
),
$queryBuilder->expr()->like(
'identifier',
$queryBuilder->createNamedParameter('%.t3d')
)
),
)
->executeQuery()
->fetchAllAssociative();
if (count($exportedFiles) > 0) {
$files = [];
foreach ($exportedFiles as $exportedFile) {
$files[] = '<li>' . htmlspecialchars($exportedFile['storage'] . ':' . $exportedFile['identifier']) . '</li>';
}
$value = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_insecure');
$severity = ContextualFeedbackSeverity::WARNING;
$message = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_exportedFiles_warningMessage');
$message .= '<ul>' . implode(PHP_EOL, $files) . '</ul>';
$message .= $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_exportedFiles_warningRecommendation');
}
return new ReportStatus($this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_exportedFiles'), $value, $message, $severity);
}
protected function getLanguageService(): LanguageService
{
return $GLOBALS['LANG'];
}
}
+95
View File
@@ -0,0 +1,95 @@
<?php
/*
* 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!
*/
namespace TYPO3\CMS\Reports\Report\Status;
use TYPO3\CMS\Core\Localization\LanguageService;
use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Reports\Status;
use TYPO3\CMS\Reports\Status as ReportStatus;
use TYPO3\CMS\Reports\StatusProviderInterface;
/**
* Performs several checks about the system's health
*/
class SystemStatus implements StatusProviderInterface
{
/**
* Determines the Install Tool's status, mainly concerning its protection.
*
* @return Status[] List of statuses
*/
public function getStatus(): array
{
$statuses = [
'PhpModules' => $this->getMissingPhpModulesOfExtensions(),
];
return $statuses;
}
public function getLabel(): string
{
return 'system';
}
/**
* Reports whether extensions need additional PHP modules different from standard core requirements
*
* @return \TYPO3\CMS\Reports\Status A status of missing PHP modules
*/
protected function getMissingPhpModulesOfExtensions()
{
$modules = [];
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install/mod/class.tx_install.php']['requiredPhpModules'] ?? null)) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install/mod/class.tx_install.php']['requiredPhpModules'] as $className) {
$hookObject = GeneralUtility::makeInstance($className);
$modules = $hookObject->setRequiredPhpModules($modules, $this);
}
}
$missingPhpModules = [];
foreach ($modules as $module) {
if (is_array($module)) {
$detectedSubmodules = false;
foreach ($module as $submodule) {
if (extension_loaded($submodule)) {
$detectedSubmodules = true;
}
}
if ($detectedSubmodules === false) {
$missingPhpModules[] = sprintf($this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_phpModulesGroup'), '(' . implode(', ', $module) . ')');
}
} elseif (!extension_loaded($module)) {
$missingPhpModules[] = $module;
}
}
if (!empty($missingPhpModules)) {
$value = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_phpModulesMissing');
$message = sprintf($this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_phpModulesList'), implode(', ', $missingPhpModules));
$message .= ' ' . $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_phpModulesInfo');
$severity = ContextualFeedbackSeverity::ERROR;
} else {
$value = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_phpModulesPresent');
$message = '';
$severity = ContextualFeedbackSeverity::OK;
}
return new ReportStatus($this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_phpModules'), $value, $message, $severity);
}
protected function getLanguageService(): LanguageService
{
return $GLOBALS['LANG'];
}
}
+94
View File
@@ -0,0 +1,94 @@
<?php
/*
* 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!
*/
namespace TYPO3\CMS\Reports\Report\Status;
use TYPO3\CMS\Core\Localization\LanguageService;
use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity;
use TYPO3\CMS\Reports\Status;
use TYPO3\CMS\Reports\Status as ReportStatus;
use TYPO3\CMS\Reports\StatusProviderInterface;
/**
* Performs basic checks about the TYPO3 install
*/
class Typo3Status implements StatusProviderInterface
{
/**
* Returns the status for this report
*
* @return Status[] List of statuses
*/
public function getStatus(): array
{
$statuses = [
'registeredXclass' => $this->getRegisteredXclassStatus(),
];
return $statuses;
}
public function getLabel(): string
{
return 'typo3';
}
/**
* List any Xclasses registered in the system
*
* @return \TYPO3\CMS\Reports\Status
*/
protected function getRegisteredXclassStatus()
{
$message = '';
$value = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_none');
$severity = ContextualFeedbackSeverity::OK;
$xclassFoundArray = [];
if (array_key_exists('Objects', $GLOBALS['TYPO3_CONF_VARS']['SYS'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'] as $originalClass => $override) {
if (array_key_exists('className', $override)) {
$xclassFoundArray[$originalClass] = $override['className'];
}
}
}
if (!empty($xclassFoundArray)) {
$value = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_xclassUsageFound');
$message = $this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_xclassUsageFound_message') . '<br />';
$message .= '<ol>';
foreach ($xclassFoundArray as $originalClass => $xClassName) {
$messageDetail = sprintf(
(string)($this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_xclassUsageFound_message_detail')),
'<code>' . htmlspecialchars((string)$originalClass) . '</code>',
'<code>' . htmlspecialchars((string)$xClassName) . '</code>'
);
$message .= '<li>' . $messageDetail . '</li>';
}
$message .= '</ol>';
$severity = ContextualFeedbackSeverity::NOTICE;
}
return new ReportStatus(
$this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_xclassUsage'),
$value,
$message,
$severity
);
}
protected function getLanguageService(): LanguageService
{
return $GLOBALS['LANG'];
}
}
+73
View File
@@ -0,0 +1,73 @@
<?php
declare(strict_types=1);
/*
* 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!
*/
namespace TYPO3\CMS\Reports\Report;
use TYPO3\CMS\Backend\Controller\Event\ModifyGenericBackendMessagesEvent;
use TYPO3\CMS\Core\Attribute\AsEventListener;
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Localization\LanguageService;
use TYPO3\CMS\Core\Messaging\FlashMessage;
use TYPO3\CMS\Core\Registry;
use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity;
/**
* Adds a warning message about problems in the current installation to the About module
*
* @internal This is a concrete Event Listener implementation and not part of the TYPO3 Core API.
*/
final class WarningsForAboutModule
{
private string $reportsModuleName = 'system_reports_status';
public function __construct(
private readonly Registry $registry,
private readonly Context $context
) {}
/**
* Tries to get the highest severity of the system's status first, if
* something is found it is assumed that the status update task is set up
* properly or the status report has been checked manually. We then add
* a system warning message.
*/
#[AsEventListener('typo3-reports/warnings')]
public function __invoke(ModifyGenericBackendMessagesEvent $event): void
{
if (!$this->context->getAspect('backend.user')->isAdmin()) {
return;
}
// Get the highest severity
$highestSeverity = $this->registry->get('tx_reports', 'status.highestSeverity');
if ($highestSeverity === null || $highestSeverity <= ContextualFeedbackSeverity::OK->value) {
return;
}
// Display a message that there's something wrong and that
// the administrator should take a look at the detailed status report
$event->addMessage(new FlashMessage(sprintf(
$this->getLanguageService()->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_problemNotification'),
'<a href="#" data-dispatch-action="TYPO3.ModuleMenu.showModule" '
. 'data-dispatch-args-list="' . $this->reportsModuleName . '">',
'</a>'
)));
}
private function getLanguageService(): LanguageService
{
return $GLOBALS['LANG'];
}
}
@@ -0,0 +1,34 @@
<?php
declare(strict_types=1);
/*
* 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!
*/
namespace TYPO3\CMS\Reports;
use Psr\Http\Message\ServerRequestInterface;
/**
* Interface for classes which provide a status report entry using information from the current request
*/
interface RequestAwareStatusProviderInterface extends StatusProviderInterface
{
/**
* Returns the status of an extension or (sub)system
*
* @param ServerRequestInterface|null $request the currently handled request
* @return Status[]
*/
public function getStatus(?ServerRequestInterface $request = null): array;
}
@@ -0,0 +1,184 @@
<?php
declare(strict_types=1);
/*
* 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!
*/
namespace TYPO3\CMS\Reports\Service;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Query\QueryBuilder;
use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
use TYPO3\CMS\Core\Pagination\QueryBuilderPaginator;
use TYPO3\CMS\Core\Pagination\SimplePagination;
use TYPO3\CMS\Core\Schema\Exception\InvalidSchemaTypeException;
use TYPO3\CMS\Core\Schema\Exception\UndefinedSchemaException;
use TYPO3\CMS\Core\Schema\SchemaLabelResolver;
use TYPO3\CMS\Core\Schema\Struct\SelectItem;
use TYPO3\CMS\Core\Schema\TcaSchemaFactory;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* Service for collecting content element statistics
*
* @internal This is not part of the public API and may change at any time
*/
final readonly class ContentStatisticsService
{
public function __construct(
private TcaSchemaFactory $tcaSchemaFactory,
private ConnectionPool $connectionPool,
private SchemaLabelResolver $schemaLabelResolver,
) {}
public function collectStatistic(): array
{
$defaultFields = ['colPos', 'CType', 'starttime', 'endtime', 'editlock', 'sys_language_uid', 'l18n_parent', 'fe_group', 'rowDescription', 'hidden'];
$countInformation = $this->getCountInformation();
$schema = $this->tcaSchemaFactory->get('tt_content');
try {
$typeField = $schema->getSubSchemaTypeInformation()->getFieldName();
} catch (InvalidSchemaTypeException) {
return ['error' => true];
}
$fieldConfig = $schema->hasField($typeField) ? $schema->getField($typeField)->getConfiguration() : [];
$itemGroups = $fieldConfig['itemGroups'] ?? [];
$groupedWizardItems = [];
foreach (array_keys($itemGroups) as $groupIdentifier) {
$groupedWizardItems['exists'][$groupIdentifier]['header'] = $itemGroups[$groupIdentifier];
$groupedWizardItems['unused'][$groupIdentifier]['header'] = $itemGroups[$groupIdentifier];
}
foreach ($fieldConfig['items'] ?? [] as $item) {
$selectItem = SelectItem::fromTcaItemArray($item);
if ($selectItem->isDivider()) {
continue;
}
$recordType = $selectItem->getValue();
$groupIdentifier = $selectItem->getGroup();
if (!isset($countInformation[$recordType])
|| ($countInformation[$recordType]['visible'] === 0 && $countInformation[$recordType]['hidden'] === 0)
) {
$usageIdentifier = 'unused';
} else {
$usageIdentifier = 'exists';
}
$groupedWizardItems[$usageIdentifier][$groupIdentifier]['elements'] ??= [];
// In case this group is not defined in itemGroups, use the group identifier as label.
$groupedWizardItems[$usageIdentifier][$groupIdentifier]['header'] ??= $groupIdentifier;
$itemDescription = $selectItem->getDescription();
$wizardEntry = [
'iconIdentifier' => $selectItem->getIcon(),
'iconOverlay' => $selectItem->getIconOverlay(),
'title' => $selectItem->getLabel(),
'description' => $itemDescription['description'] ?? ($itemDescription ?? ''),
];
$groupedWizardItems[$usageIdentifier][$groupIdentifier]['elements'][$recordType] = $wizardEntry;
$groupedWizardItems[$usageIdentifier][$groupIdentifier]['elements'][$recordType]['count'] = $countInformation[$recordType] ?? [];
try {
$subschema = $schema->getSubSchema($recordType);
$groupedWizardItems[$usageIdentifier][$groupIdentifier]['elements'][$recordType]['fields']
= $subschema->getFields(fn($field) => !in_array($field->getName(), $defaultFields, true));
} catch (UndefinedSchemaException) {
}
}
return $groupedWizardItems;
}
public function collectStatisticForCtype(string $cType, int $currentPage): array
{
$paginator = new QueryBuilderPaginator($this->buildQueryBuilderForCtype($cType), $currentPage, 10);
$pagination = new SimplePagination($paginator);
$rows = $paginator->getPaginatedItems();
foreach ($rows as &$row) {
$row['path'] = BackendUtility::getRecordPath($row['pid'], '', 0);
$row['tstamp_formatted'] = BackendUtility::datetime($row['tstamp']);
}
return [
'ctype' => $cType,
'label' => $this->schemaLabelResolver->getLabelForFieldValue('tt_content', 'CType', $cType),
'count' => $this->getCountInformation($cType)[$cType] ?? [],
'rows' => $rows,
'paginator' => $paginator,
'pagination' => $pagination,
];
}
public function isValidCtype(string $cType): bool
{
if ($cType === '') {
return false;
}
return $this->tcaSchemaFactory->get('tt_content')->hasSubSchema($cType);
}
private function buildQueryBuilderForCtype(string $cType): QueryBuilder
{
$queryBuilder = $this->connectionPool->getQueryBuilderForTable('tt_content');
$queryBuilder->getRestrictions()
->removeAll()
->add(GeneralUtility::makeInstance(DeletedRestriction::class));
return $queryBuilder
->select('uid', 'pid', 'header', 'tstamp', 'crdate', 'hidden', 'fe_group')
->from('tt_content')
->where(
$queryBuilder->expr()->eq('CType', $queryBuilder->createNamedParameter($cType)),
)
->orderBy('uid', 'desc');
}
private function getCountInformation(string $cType = ''): array
{
$queryBuilder = $this->connectionPool->getQueryBuilderForTable('tt_content');
$queryBuilder->getRestrictions()->removeAll();
$queryBuilder = $queryBuilder
->select('CType', 'deleted', 'hidden')
->addSelectLiteral('COUNT(*) as count')
->from('tt_content')
->groupBy('CType')
->addGroupBy('hidden')
->addGroupBy('deleted');
if ($cType !== '') {
$queryBuilder = $queryBuilder->where($queryBuilder->expr()->eq('CType', $queryBuilder->createNamedParameter($cType)));
}
$counts = [];
foreach ($queryBuilder->executeQuery()->fetchAllAssociative() as $row) {
$cType = $row['CType'];
$deleted = (int)$row['deleted'];
$hidden = (int)$row['hidden'];
$count = (int)$row['count'];
if (!isset($counts[$cType])) {
$counts[$cType] = ['deleted' => 0, 'hidden' => 0, 'visible' => 0];
}
$key = match (true) {
$deleted === 1 => 'deleted',
$hidden === 1 => 'hidden',
default => 'visible',
};
$counts[$cType][$key] += $count;
}
return $counts;
}
}
+161
View File
@@ -0,0 +1,161 @@
<?php
declare(strict_types=1);
/*
* 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!
*/
namespace TYPO3\CMS\Reports\Service;
use Symfony\Component\DependencyInjection\Attribute\Autoconfigure;
use TYPO3\CMS\Core\DataHandling\PageDoktypeRegistry;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Imaging\IconSize;
use TYPO3\CMS\Core\Localization\LanguageService;
use TYPO3\CMS\Core\Schema\Capability\TcaSchemaCapability;
use TYPO3\CMS\Core\Schema\TcaSchema;
use TYPO3\CMS\Core\Schema\TcaSchemaFactory;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Reports\Integrity\DatabaseIntegrityCheck;
/**
* Service for collecting database record statistics
*
* @internal This is not part of the public API and may change at any time
*/
#[Autoconfigure(public: true)]
final readonly class RecordStatisticsService
{
public function __construct(
private IconFactory $iconFactory,
private TcaSchemaFactory $tcaSchemaFactory,
private PageDoktypeRegistry $pageDoktypeRegistry,
) {}
/**
* Collects page statistics including total, translated, hidden, and deleted pages
*
* @return array<string, array{icon: string, count: int}>
*/
public function collectPageStatistics(): array
{
$databaseIntegrityCheck = GeneralUtility::makeInstance(DatabaseIntegrityCheck::class);
$databaseIntegrityCheck->genTree(0);
return [
'total_pages' => [
'icon' => $this->iconFactory->getIconForRecord('pages', [], IconSize::SMALL)->render(),
'count' => count($databaseIntegrityCheck->getPageIdArray()),
],
'translated_pages' => [
'icon' => $this->iconFactory->getIconForRecord('pages', [], IconSize::SMALL)->render(),
'count' => count($databaseIntegrityCheck->getPageTranslatedPageIDArray()),
],
'hidden_pages' => [
'icon' => $this->iconFactory->getIconForRecord('pages', ['hidden' => 1], IconSize::SMALL)->render(),
'count' => $databaseIntegrityCheck->getRecStats()['hidden'] ?? 0,
],
'deleted_pages' => [
'icon' => $this->iconFactory->getIconForRecord('pages', ['deleted' => 1], IconSize::SMALL)->render(),
'count' => isset($databaseIntegrityCheck->getRecStats()['deleted']['pages']) ? count($databaseIntegrityCheck->getRecStats()['deleted']['pages']) : 0,
],
];
}
/**
* Collects statistics for different page doktypes
*
* @return array<int, array{icon: string, title: string, count: int}>
*/
public function collectDoktypeStatistics(): array
{
$languageService = $this->getLanguageService();
$databaseIntegrityCheck = GeneralUtility::makeInstance(DatabaseIntegrityCheck::class);
$databaseIntegrityCheck->genTree(0);
$doktypes = [];
foreach ($this->pageDoktypeRegistry->getAllDoktypes() as $doktype) {
if ($doktype->isDivider()) {
continue;
}
$doktypes[] = [
'icon' => $this->iconFactory->getIconForRecord('pages', ['doktype' => $doktype->getValue()], IconSize::SMALL)->render(),
'title' => $languageService->sL($doktype->getLabel()) . ' (' . $doktype->getValue() . ')',
'count' => (int)($databaseIntegrityCheck->getRecStats()['doktype'][$doktype->getValue()] ?? 0),
];
}
return $doktypes;
}
/**
* Collects statistics for all TCA tables including lost records
*
* @return array<string, array{icon: string, title: string, count: int|string, lostRecords: string}>
*/
public function collectTableStatistics(): array
{
$languageService = $this->getLanguageService();
$databaseIntegrityCheck = GeneralUtility::makeInstance(DatabaseIntegrityCheck::class);
$databaseIntegrityCheck->genTree(0);
// Tables and lost records
$pageIds = array_merge([0], array_keys($databaseIntegrityCheck->getPageIdArray()));
$lostRecords = $databaseIntegrityCheck->lostRecords($pageIds);
$tableStatistic = [];
$countArr = $databaseIntegrityCheck->countRecords($pageIds);
$lostPageIds = isset($lostRecords['pages']) ? array_keys($lostRecords['pages']) : [];
/** @var TcaSchema $schema */
foreach ($this->tcaSchemaFactory->all() as $table => $schema) {
if ($schema->hasCapability(TcaSchemaCapability::HideInUi)) {
continue;
}
$lostRecordCount = isset($lostRecords[$table]) ? count($lostRecords[$table]) : 0;
$recordCount = 0;
if ($countArr['all'][$table] ?? false) {
$recordCount = (int)($countArr['non_deleted'][$table] ?? 0) . '/' . $lostRecordCount;
}
$lostRecordList = [];
foreach ($lostRecords[$table] ?? [] as $data) {
if (!in_array((int)$data['pid'], $lostPageIds, true)) {
$lostRecordList[]
= '<div class="record">'
. $this->iconFactory->getIcon('status-dialog-error', IconSize::SMALL)->render()
. 'uid:' . $data['uid'] . ', pid:' . $data['pid'] . ', ' . htmlspecialchars(GeneralUtility::fixed_lgd_cs(strip_tags($data['title']), 20))
. '</div>';
} else {
$lostRecordList[]
= '<div class="record-noicon">'
. 'uid:' . $data['uid'] . ', pid:' . $data['pid'] . ', ' . htmlspecialchars(GeneralUtility::fixed_lgd_cs(strip_tags($data['title']), 20))
. '</div>';
}
}
$tableStatistic[$table] = [
'icon' => $this->iconFactory->getIconForRecord($table, [], IconSize::SMALL)->render(),
'title' => $schema->getTitle($languageService->sL(...)),
'count' => $recordCount,
'lostRecords' => implode(LF, $lostRecordList),
];
}
ksort($tableStatistic);
return $tableStatistic;
}
private function getLanguageService(): LanguageService
{
return $GLOBALS['LANG'];
}
}
+190
View File
@@ -0,0 +1,190 @@
<?php
declare(strict_types=1);
/*
* 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!
*/
namespace TYPO3\CMS\Reports\Service;
use Psr\Http\Message\ServerRequestInterface;
use Symfony\Component\DependencyInjection\Attribute\Autoconfigure;
use TYPO3\CMS\Core\Localization\LanguageService;
use TYPO3\CMS\Core\Registry;
use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity;
use TYPO3\CMS\Reports\ExtendedStatusProviderInterface;
use TYPO3\CMS\Reports\Registry\StatusRegistry;
use TYPO3\CMS\Reports\RequestAwareStatusProviderInterface;
use TYPO3\CMS\Reports\Status;
/**
* Service for collecting and processing system status information
*
* @internal This is not part of the public API and may change at any time
*/
#[Autoconfigure(public: true)]
final readonly class StatusService
{
public function __construct(
private StatusRegistry $statusRegistry,
private Registry $registry,
) {}
/**
* Runs through all status providers and returns all statuses collected.
*
* @param ServerRequestInterface|null $request
* @return Status[][]
*/
public function getSystemStatus(?ServerRequestInterface $request = null): array
{
$status = [];
foreach ($this->statusRegistry->getProviders() as $statusProvider) {
$statusProviderId = $statusProvider->getLabel();
$status[$statusProviderId] ??= [];
if ($statusProvider instanceof RequestAwareStatusProviderInterface) {
$statuses = $statusProvider->getStatus($request);
} else {
$statuses = $statusProvider->getStatus();
}
$status[$statusProviderId] = array_merge($status[$statusProviderId], $statuses);
}
return $status;
}
/**
* Runs through all status providers and returns all statuses collected, which are detailed.
*
* @return Status[][]
*/
public function getDetailedSystemStatus(): array
{
$status = [];
foreach ($this->statusRegistry->getProviders() as $statusProvider) {
$statusProviderId = $statusProvider->getLabel();
if ($statusProvider instanceof ExtendedStatusProviderInterface) {
$statuses = $statusProvider->getDetailedStatus();
$status[$statusProviderId] = array_merge($status[$statusProviderId] ?? [], $statuses);
}
}
return $status;
}
/**
* Determines the highest severity from the given statuses.
*
* @param array<string, array<string, Status>> $statusCollection An array of Status objects.
* @return int The highest severity found from the statuses.
*/
public function getHighestSeverity(array $statusCollection): int
{
$highestSeverity = ContextualFeedbackSeverity::NOTICE;
foreach ($statusCollection as $providerStatuses) {
foreach ($providerStatuses as $status) {
if ($status->getSeverity()->value > $highestSeverity->value) {
$highestSeverity = $status->getSeverity();
}
// Reached the highest severity level, no need to go on
if ($highestSeverity === ContextualFeedbackSeverity::ERROR) {
break;
}
}
}
return $highestSeverity->value;
}
/**
* Collects system status and stores the highest severity in the registry.
* This is useful for displaying warnings at login or in the backend.
*
* @param ServerRequestInterface|null $request
*/
public function collectAndStoreSystemStatus(?ServerRequestInterface $request = null): void
{
$status = $this->getSystemStatus($request);
$this->registry->set('tx_reports', 'status.highestSeverity', $this->getHighestSeverity($status));
}
/**
* Sorts the status providers (alphabetically and puts primary status providers at the beginning)
*
* @param array<string, array<string, Status>> $statusCollection A collection of statuses (with providers)
* @return array<string, array<string, Status>> The collection of statuses sorted by provider
*/
public function sortStatusProviders(array $statusCollection): array
{
$languageService = $this->getLanguageService();
// Extract the primary status collections, i.e. the status groups
// that must appear on top of the status report
// Change their keys to localized collection titles
$primaryStatuses = [
$languageService->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_typo3') => $statusCollection['typo3'] ?? [],
$languageService->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_system') => $statusCollection['system'] ?? [],
$languageService->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_security') => $statusCollection['security'] ?? [],
$languageService->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_configuration') => $statusCollection['configuration'] ?? [],
];
unset($statusCollection['typo3'], $statusCollection['system'], $statusCollection['security'], $statusCollection['configuration']);
// Assemble list of secondary status collections with left-over collections
// Change their keys using localized labels if available
$secondaryStatuses = [];
foreach ($statusCollection as $statusProviderId => $collection) {
if (str_starts_with($statusProviderId, 'LLL:')) {
// Label provided by extension
$label = $languageService->sL($statusProviderId);
} else {
// Generic label
// @todo phase this out
$label = $languageService->sL('LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_' . $statusProviderId);
}
$providerLabel = empty($label) ? $statusProviderId : $label;
$secondaryStatuses[$providerLabel] = $collection;
}
// Sort the secondary status collections alphabetically
ksort($secondaryStatuses);
return array_merge($primaryStatuses, $secondaryStatuses);
}
/**
* Sorts the statuses by severity
*
* @param array<string, Status> $statusCollection A collection of statuses per provider
* @return list<Status> The collection of statuses sorted by severity
*/
public function sortStatuses(array $statusCollection): array
{
$statuses = [];
$sortTitle = [];
$header = null;
foreach ($statusCollection as $status) {
if ($status->getTitle() === 'TYPO3') {
$header = $status;
continue;
}
$statuses[] = $status;
$sortTitle[] = $status->getSeverity();
}
array_multisort($sortTitle, SORT_DESC, $statuses);
// Making sure that the core version information is always on the top
if (is_object($header)) {
array_unshift($statuses, $header);
}
return $statuses;
}
private function getLanguageService(): LanguageService
{
return $GLOBALS['LANG'];
}
}
+108
View File
@@ -0,0 +1,108 @@
<?php
/*
* 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!
*/
namespace TYPO3\CMS\Reports;
use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity;
/**
* A class representing a certain status
*/
class Status
{
/**
* @var string
*/
protected $title;
/**
* @var string
*/
protected $value;
/**
* @var string
*/
protected $message;
protected ContextualFeedbackSeverity $severity;
/**
* Construct a status
*
* All values must be given as constructor arguments.
* All strings should be localized.
*
* @param string $title Status title, eg. "Deprecation log"
* @param string $value Status value, eg. "Disabled"
* @param string $message Optional message further describing the title/value combination
* Example:, eg "The deprecation log is important and does foo, to disable it do bar"
* @param ContextualFeedbackSeverity $severity A severity level
*/
public function __construct($title, $value, $message = '', ContextualFeedbackSeverity $severity = ContextualFeedbackSeverity::OK)
{
$this->title = (string)$title;
$this->value = (string)$value;
$this->message = (string)$message;
$this->severity = $severity;
}
/**
* Gets the status' title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Gets the status' value
*
* @return string
*/
public function getValue()
{
return $this->value;
}
/**
* Gets the status' message (if any)
*
* @return string
*/
public function getMessage()
{
return $this->message;
}
public function getSeverity(): ContextualFeedbackSeverity
{
return $this->severity;
}
/**
* Creates a string representation of a status.
*
* @return string String representation of this status.
*/
public function __toString()
{
// Max length 80 characters
$stringRepresentation = str_pad('[' . $this->severity->name . ']', 7) . str_pad($this->title, 40) . ' - ' . substr($this->value, 0, 30);
return $stringRepresentation;
}
}
+34
View File
@@ -0,0 +1,34 @@
<?php
/*
* 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!
*/
namespace TYPO3\CMS\Reports;
/**
* Interface for classes which provide a status report entry.
*/
interface StatusProviderInterface
{
/**
* Returns the status of an extension or (sub)system
*
* @return Status[]
*/
public function getStatus(): array;
/**
* Return label of this status
*/
public function getLabel(): string;
}
+164
View File
@@ -0,0 +1,164 @@
<?php
declare(strict_types=1);
/*
* 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!
*/
namespace TYPO3\CMS\Reports\Task;
use Psr\Http\Message\ServerRequestInterface;
use Symfony\Component\Mime\Address;
use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Core\Mail\MailerInterface;
use TYPO3\CMS\Core\Mail\TemplatedEmailFactory;
use TYPO3\CMS\Core\Messaging\FlashMessage;
use TYPO3\CMS\Core\Messaging\FlashMessageService;
use TYPO3\CMS\Core\Registry;
use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Reports\Service\StatusService;
use TYPO3\CMS\Reports\Status;
use TYPO3\CMS\Scheduler\Task\AbstractTask;
/**
* A task that should be run regularly to determine the system's status.
* @internal This class is a specific scheduler task implementation and is not considered part of the Public TYPO3 API.
*/
class SystemStatusUpdateTask extends AbstractTask
{
/**
* Email addresses to send email notification to in case we find problems with
* the system.
*
* @var string
*/
protected $notificationEmail = '';
/**
* Checkbox for to send all types of notification, not only problems
*
* @var bool
*/
protected $notificationAll = false;
/**
* Executes the System Status Update task, determining the highest severity of
* status reports and saving that to the registry to be displayed at login
* if necessary.
*
* @see \TYPO3\CMS\Scheduler\Task\AbstractTask::execute()
*/
public function execute()
{
$statusService = GeneralUtility::makeInstance(StatusService::class);
$systemStatus = $statusService->getDetailedSystemStatus();
$highestSeverity = $statusService->getHighestSeverity($systemStatus);
$registry = GeneralUtility::makeInstance(Registry::class);
$registry->set('tx_reports', 'status.highestSeverity', $highestSeverity);
if (($highestSeverity > ContextualFeedbackSeverity::OK->value) || $this->notificationAll) {
$this->sendNotificationEmail($systemStatus);
}
return true;
}
/**
* Sends a notification email, reporting system issues.
*
* @param Status[][] $systemStatus Array of statuses
*/
protected function sendNotificationEmail(array $systemStatus): void
{
$systemIssues = [];
foreach ($systemStatus as $statusProvider) {
foreach ($statusProvider as $status) {
if ($this->notificationAll || ($status->getSeverity()->value > ContextualFeedbackSeverity::OK->value)) {
$systemIssues[] = (string)$status . CRLF . $status->getMessage() . CRLF . CRLF;
}
}
}
$notificationEmails = GeneralUtility::trimExplode(LF, $this->notificationEmail, true);
$sendEmailsTo = [];
foreach ($notificationEmails as $notificationEmail) {
$sendEmailsTo[] = new Address($notificationEmail);
}
$subject = sprintf($this->getLanguageService()->sL('reports.reports:status_updateTask_email_subject'), $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']);
$message = sprintf($this->getLanguageService()->sL('reports.reports:' . ($this->notificationAll ? 'status_allNotification' : 'status_problemNotification')), '', '');
if (Environment::isCli()) {
$message .= CRLF . CRLF;
$message .= $this->getLanguageService()->sL('reports.reports:status_problem_notification_cli_disclaimer');
}
$message .= CRLF . CRLF;
$message .= $this->getLanguageService()->sL('reports.reports:status_updateTask_email_site') . ': ' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'];
$message .= CRLF . CRLF;
$message .= $this->getLanguageService()->sL('reports.reports:status_updateTask_email_issues') . ': ' . CRLF;
$message .= implode(CRLF, $systemIssues);
$message .= CRLF . CRLF;
$request = ($GLOBALS['TYPO3_REQUEST'] ?? null) instanceof ServerRequestInterface ? $GLOBALS['TYPO3_REQUEST'] : null;
// @todo DI should be used to inject the MailerInterface in v15.0
$email = GeneralUtility::makeInstance(TemplatedEmailFactory::class)->createWithOverrides(
[20 => 'EXT:reports/Resources/Private/Templates/Email/'],
[],
[],
$request,
);
$email
->to(...$sendEmailsTo)
->format('plain')
->subject($subject)
->setTemplate('Report')
->assign('message', $message);
// @todo DI should be used to inject the MailerInterface in v15.0
GeneralUtility::makeInstance(MailerInterface::class)->send($email);
}
public function getAdditionalInformation()
{
return sprintf($this->getLanguageService()->sL('reports.reports:status_updateAdditionalInformation'), preg_replace('#\s+#', ', ', trim($this->notificationEmail)));
}
public function getTaskParameters(): array
{
return [
'tx_reports_notification_email' => $this->notificationEmail,
'tx_reports_notification_all' => $this->notificationAll,
];
}
public function setTaskParameters(array $parameters): void
{
$this->notificationEmail = $parameters['notificationEmail'] ?? $parameters['tx_reports_notification_email'] ?? '';
$this->notificationAll = (bool)($parameters['notificationAll'] ?? $parameters['tx_reports_notification_all'] ?? false);
}
public function validateTaskParameters(array $parameters): bool
{
$validInput = true;
$notificationEmails = GeneralUtility::trimExplode(LF, $parameters['tx_reports_notification_email'] ?? '', true);
foreach ($notificationEmails as $notificationEmail) {
if (!GeneralUtility::validEmail($notificationEmail)) {
$validInput = false;
break;
}
}
if (!$validInput || empty($parameters['tx_reports_notification_email'] ?? '')) {
GeneralUtility::makeInstance(FlashMessageService::class)->getMessageQueueByIdentifier()->addMessage(
new FlashMessage($this->getLanguageService()->sL('reports.reports:status_updateTaskField_notificationEmails_invalid'), '', ContextualFeedbackSeverity::ERROR)
);
$validInput = false;
}
return $validInput;
}
}
+60
View File
@@ -0,0 +1,60 @@
<?php
use TYPO3\CMS\Reports\Controller\ContentStatisticsController;
use TYPO3\CMS\Reports\Controller\RecordStatisticsController;
use TYPO3\CMS\Reports\Controller\StatusReportController;
/**
* Definitions for modules provided by EXT:reports
*/
return [
'system_reports' => [
'parent' => 'admin',
'position' => ['after' => 'system_log'],
'access' => 'admin',
'path' => '/module/system/reports',
'iconIdentifier' => 'module-reports',
'labels' => 'reports.modules.overview',
'showSubmoduleOverview' => true,
],
'system_reports_status' => [
'parent' => 'system_reports',
'access' => 'admin',
'path' => '/module/system/reports/status',
'iconIdentifier' => 'module-reports',
'labels' => 'reports.modules.status',
'routes' => [
'_default' => [
'target' => StatusReportController::class . '::handleRequest',
],
],
],
'system_reports_statistics' => [
'parent' => 'system_reports',
'access' => 'admin',
'path' => '/module/system/reports/statistics',
'iconIdentifier' => 'module-reports',
'labels' => 'reports.modules.statistics',
'routes' => [
'_default' => [
'target' => RecordStatisticsController::class . '::handleRequest',
],
],
],
'system_reports_contentstatistics' => [
'parent' => 'system_reports',
'access' => 'admin',
'path' => '/module/system/reports/content-statistics',
'iconIdentifier' => 'module-reports',
'labels' => [
'title' => 'reports.messages:contentStatistics.title',
'shortDescription' => 'reports.messages:contentStatistics.shortDescription',
'description' => 'reports.messages:contentStatistics.description',
],
'routes' => [
'_default' => [
'target' => ContentStatisticsController::class . '::handleRequest',
],
],
],
];
+12
View File
@@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
namespace TYPO3\CMS\Reports;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $container, ContainerBuilder $containerBuilder) {
$containerBuilder->registerForAutoconfiguration(StatusProviderInterface::class)->addTag('reports.status');
};
+14
View File
@@ -0,0 +1,14 @@
services:
_defaults:
autowire: true
autoconfigure: true
public: false
TYPO3\CMS\Reports\:
resource: '../Classes/*'
# Tasks require EXT:scheduler to be installed, ignore for now.
exclude: '../Classes/Task'
TYPO3\CMS\Reports\Registry\StatusRegistry:
arguments:
- !tagged_iterator reports.status
@@ -0,0 +1,57 @@
<?php
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Reports\Task\SystemStatusUpdateTask;
defined('TYPO3') or die();
if (isset($GLOBALS['TCA']['tx_scheduler_task'])) {
ExtensionManagementUtility::addTCAcolumns(
'tx_scheduler_task',
[
'tx_reports_notification_email' => [
'label' => 'LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_updateTaskField_notificationEmails',
'config' => [
'type' => 'text',
'rows' => 3,
'cols' => 50,
'required' => true,
'placeholder' => 'admin@example.com',
],
],
'tx_reports_notification_all' => [
'label' => 'LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_updateTaskField_notificationAll',
'config' => [
'type' => 'check',
'renderType' => 'checkboxToggle',
'default' => 0,
],
],
]
);
ExtensionManagementUtility::addRecordType(
[
'label' => 'LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_updateTaskTitle',
'description' => 'LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_updateTaskDescription',
'value' => SystemStatusUpdateTask::class,
'icon' => 'mimetypes-x-tx_scheduler_task_group',
'group' => 'reports',
],
'
--div--;core.form.tabs:general,
tasktype,
task_group,
description,
tx_reports_notification_email,
tx_reports_notification_all,
--div--;core.form.tabs:timing,
--palette--;;execution,
--div--;core.form.tabs:access,
disable,
--div--;core.form.tabs:extended,',
[],
'',
'tx_scheduler_task'
);
}
@@ -0,0 +1,13 @@
.. include:: /Includes.rst.txt
.. _ExtendedStatusProviderInterface:
===============================
ExtendedStatusProviderInterface
===============================
This interface extends
:php:interface:`TYPO3\\CMS\\Reports\\StatusProviderInterface`. It can be used
to provide detailed status reports.
.. include:: /CodeSnippets/Generated/ExtendedStatusProviderInterface.rst.txt
+16
View File
@@ -0,0 +1,16 @@
.. include:: /Includes.rst.txt
.. _api:
===
API
===
**Contents:**
.. toctree::
:titlesonly:
:glob:
StatusProviderInterface
*
@@ -0,0 +1,13 @@
.. include:: /Includes.rst.txt
.. _RequestAwareStatusProviderInterface:
===================================
RequestAwareStatusProviderInterface
===================================
This interface extends
:php:interface:`TYPO3\\CMS\\Reports\\StatusProviderInterface`. It can be used
if information from the current request is required for the status message.
.. include:: /CodeSnippets/Generated/RequestAwareStatusProviderInterface.rst.txt
@@ -0,0 +1,32 @@
.. include:: /Includes.rst.txt
.. _StatusProviderInterfaceAPI:
=======================
StatusProviderInterface
=======================
Classes implementing this interface are registered automatically as status
in the module :guilabel:`Reports > Status` if :yaml:`autoconfigure` is enabled in
:file:`Services.yaml` or if it was registered manually by the tag
:ref:`reports.status <register-custom-status>`.
If information from the current request is required for the status report implement
:php:interface:`TYPO3\\CMS\\Reports\\RequestAwareStatusProviderInterface`.
If you need to provide extended information implement
:php:interface:`TYPO3\\CMS\\Reports\\ExtendedStatusProviderInterface`.
.. note::
In PHP it is possible to implement several interfaces, so you can
give detailed status reports that are request-aware:
.. code-block:: php
:caption: EXT:my_extension/Classes/Status/MyStatus.php
class MyStatus implements RequestAwareStatusProviderInterface, ExtendedStatusProviderInterface
{
// ...
}
.. include:: /CodeSnippets/Generated/StatusProviderInterface.rst.txt
@@ -0,0 +1,10 @@
.. Generated by https://github.com/linawolf/t3docs_restructured_api_tools
.. php:namespace:: TYPO3\CMS\Reports
.. php:interface:: ExtendedStatusProviderInterface
Interface for classes which provide a status report entry.
.. php:method:: getDetailedStatus()
Returns the detailed status of an extension or (sub)system
@@ -0,0 +1,19 @@
.. Generated by https://github.com/linawolf/t3docs_restructured_api_tools
.. php:namespace:: TYPO3\CMS\Reports
.. php:interface:: RequestAwareStatusProviderInterface
Interface for classes which provide a status report entry using information from the current request
.. php:method:: getStatus(Psr\\Http\\Message\\ServerRequestInterface request = NULL)
Returns the status of an extension or (sub)system
:param Psr\\Http\\Message\\ServerRequestInterface $request: the request, default: NULL
:returntype: array
.. php:method:: getLabel()
Return label of this status
:returntype: string
@@ -0,0 +1,18 @@
.. Generated by https://github.com/linawolf/t3docs_restructured_api_tools
.. php:namespace:: TYPO3\CMS\Reports
.. php:interface:: StatusProviderInterface
Interface for classes which provide a status report entry.
.. php:method:: getStatus()
Returns the status of an extension or (sub)system
:returntype: array
.. php:method:: getLabel()
Return label of this status
:returntype: string
@@ -0,0 +1,6 @@
.. code-block:: yaml
:caption: EXT:my_extension/Configuration/Services.yaml
services:
_defaults:
autoconfigure: true
@@ -0,0 +1,25 @@
<?php
// See https://github.com/TYPO3-Documentation/t3docs-codesnippets
// ddev exec vendor/bin/typo3 restructured_api_tools:php_domain public/fileadmin/reports/Documentation/CodeSnippets/
return [
[
'action' => 'createPhpClassDocs',
'class' => \TYPO3\CMS\Reports\StatusProviderInterface::class,
'targetFileName' => 'Generated/StatusProviderInterface.rst.txt',
'withCode' => false,
],
[
'action' => 'createPhpClassDocs',
'class' => \TYPO3\CMS\Reports\RequestAwareStatusProviderInterface::class,
'targetFileName' => 'Generated/RequestAwareStatusProviderInterface.rst.txt',
'withCode' => false,
],
[
'action' => 'createPhpClassDocs',
'class' => \TYPO3\CMS\Reports\ExtendedStatusProviderInterface::class,
'targetFileName' => 'Generated/ExtendedStatusProviderInterface.rst.txt',
'withCode' => false,
],
];
+108
View File
@@ -0,0 +1,108 @@
.. include:: /Includes.rst.txt
.. _custom-reports-more:
.. _custom-reports:
============================
Custom reports registration
============================
The only report provided by the TYPO3 core is the one
called :guilabel:`Status`.
The status report itself is extendable and shows status messages like a system
environment check and the status of the installed extensions.
Reports and status are automatically registered through the service
configuration, based on the implemented interface.
.. _register-custom-report:
Register a custom report
========================
Create a custom submodule extending the reports module.
.. code-block:: php
<?php
return [
'system_reports_myreport' => [
'parent' => 'system_reports',
'access' => 'admin',
'path' => '/module/system/reports/myreport',
'iconIdentifier' => 'my-report-icon',
'labels' => [
'title' => 'LLL:EXT:my_extension/Resources/Private/Language/locallang.xlf:myreport.title',
'description' => 'LLL:EXT:my_extension/Resources/Private/Language/locallang.xlf:myreport.description',
],
'routes' => [
'_default' => [
'target' => \Vendor\MyExtension\Controller\MyReportController::class . '::handleRequest',
],
],
],
];
Implement the logic into your class:
.. code-block:: php
<?php
declare(strict_types=1);
namespace MyVender\MyExtension\Reports;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Backend\Attribute\AsController;
use TYPO3\CMS\Backend\Template\ModuleTemplateFactory;
#[AsController]
final readonly class MyReportController
{
public function __construct(
protected ModuleTemplateFactory $moduleTemplateFactory,
) {}
public function handleRequest(ServerRequestInterface $request): ResponseInterface
{
$view = $this->moduleTemplateFactory->create($request);
$view->makeDocHeaderModuleMenu();
$view->assign('data', $this->collectReportData());
return $view->renderResponse('MyReport');
}
}
Use a template like below:
.. code-block:: html
<html
xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
data-namespace-typo3-fluid="true"
>
<f:layout name="Module"/>
<f:section name="Content">
<h1>My report</h1>
<p>Report it!</p>
</f:section>
</html>
.. _register-custom-status:
Register a custom status
========================
All status providers must implement
:php:interface:`TYPO3\\CMS\\Reports\\StatusProviderInterface`.
If :yaml:`autoconfigure` is enabled in :file:`Services.yaml`,
the status providers implementing this interface will be automatically
registered.
.. include:: /CodeSnippets/Manual/Autoconfigure.rst.txt
Alternatively, one can manually tag a custom report with the
:yaml:`reports.status` tag:
Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

+1
View File
@@ -0,0 +1 @@
.. You can put central messages to display on all pages here
+85
View File
@@ -0,0 +1,85 @@
.. include:: /Includes.rst.txt
.. _start:
===============
TYPO3 Reports
===============
:Extension key:
reports
:Package name:
typo3/cms-reports
:Version:
|release|
:Language:
en
:Author:
TYPO3 contributors
:License:
This document is published under the
`Creative Commons BY 4.0 <https://creativecommons.org/licenses/by/4.0/>`__
license.
:Rendered:
|today|
----
This extension shows status reports and installed services in the
:guilabel:`Administration > Reports` backend module.
----
.. card-grid::
:columns: 1
:columns-md: 2
:gap: 4
:class: pb-4
:card-height: 100
.. card:: :ref:`Introduction <introduction>`
Written for new users, this chapter introduces the module
:guilabel:`Reports` and what it does.
.. card:: :ref:`Installation <installation>`
Explains how to install the extension if it is not installed yet.
.. card:: :ref:`API Reference <api>`
Explains the underlying API and its interfaces.
.. card:: :ref:`Custom reports <custom-reports>`
Introduction into developing your own custom reports or status
messages.
.. card:: :ref:`Scheduler task <scheduler-task>`
Use the system extension scheduler to configure automatic
status reports sent via email.
.. Table of Contents
.. toctree::
:hidden:
Introduction/Index
Installation/Index
Api/Index
CustomReports/Index
Scheduler/Index
.. Meta Menu
.. toctree::
:hidden:
Sitemap
+56
View File
@@ -0,0 +1,56 @@
.. include:: /Includes.rst.txt
.. _installation:
============
Installation
============
This extension is part of the TYPO3 Core, but not installed by default.
.. contents:: Table of contents
:local:
.. _installation-composer:
Installation with Composer
==========================
Check whether you are already using the extension with:
.. code-block:: bash
composer show | grep reports
This should either give you no result or something similar to:
.. code-block:: none
typo3/cms-reports v12.4.11
If it is not installed yet, use the ``composer require`` command to install
the extension:
.. code-block:: bash
composer require typo3/cms-reports
The given version depends on the version of the TYPO3 Core you are using.
.. _installation-no-composer:
Installation without Composer
=============================
In an installation without Composer, the extension is already shipped but might
not be activated yet. Activate it as follows:
#. In the backend, navigate to the :guilabel:`System > Extensions`
module.
#. Click the :guilabel:`Activate` icon for the Reports extension.
.. figure:: /Images/InstallActivate.png
:class: with-border
:alt: Extension manager showing Reports extension
Extension manager showing Reports extension
+69
View File
@@ -0,0 +1,69 @@
.. include:: /Includes.rst.txt
.. _introduction:
============
Introduction
============
.. contents:: Table of contents
.. _what-does-it-do:
What does it do?
================
.. figure:: /Images/ModuleReports.png
:class: with-shadow
The backend module :guilabel:`Administration > Reports`
The TYPO3 system extension EXT:reports displays the extendable backend module
:guilabel:`Administration > Reports` for users with administrator role.
The Reports module groups several system reports and gives you a quick
overview about important system statuses and site parameters.
.. _check-security:
Section "Security"
==================
.. figure:: /Images/Security.png
:class: with-shadow
Regularly check the section :guilabel:`Security`
From a security perspective, the section :guilabel:`Security` should be checked
regularly: it provides information about the administrator user
account, encryption key, file deny pattern, module :guilabel:`System > Environment`
checks and more.
.. warning::
In case of a compromised system, the information displayed here may
have been manipulated by the attacker.
Thus, if no problems are pointed out - it does not necessarily mean
that there are no security issues. But, on the other hand, if security
problems are pointed out, you most certainly should fix them.
.. _record-statistics:
Record Statistics
=================
.. versionchanged:: 14.0
The record statistics have been moved from module :guilabel:`System > Database`,
provided by the system extension :composer:`typo3/cms-lowlevel` into the
module :guilabel:`Administration > Reports` of this extension :composer:`typo3/cms-reports`.
Backend users with administrator permissions can find this module at
:guilabel:`Administration > Reports > Records Statistics`.
This module gives an overview of the count of records of different types.
.. figure:: /Images/RecordStatistics.png
:alt: The TYPO3 backend module "Reports" with submodule "Record Statistics"
The records are counted installation-wide. Soft-deleted (flag `deleted = 1`)
records are ignored.
+45
View File
@@ -0,0 +1,45 @@
:navigation-title: Scheduler task
.. include:: /Includes.rst.txt
.. _scheduler-task:
=====================================
Scheduler task "System Status Update"
=====================================
If the system extension :composer:`typo3/cms-scheduler` is installed,
you can create automatic reports with the help of a scheduler task.
To create a task for the reports functionality go to
:guilabel:`Administration > Scheduler`, click on :guilabel:`+ (add Task)` and chose
:guilabel:`System Status Update (reports)` as :guilabel:`Class`.
Enter :guilabel:`Notification Email Addresses` where the reports should be sent
and chose whether you want to be informed with each run.
The remaining settings are standard task settings provided by the scheduler
extension.
.. figure:: /Images/SchedulerTask.png
:alt: TYPO3 Backend module "Scheduler", "New task" popup, Category "Reports"
Create a :guilabel:`System Status Update` task in module :guilabel:`Administration > Scheduler`
.. _scheduler-task-mail:
System status notification mail
===============================
You will receive mails looking like this:
.. code-block:: text
:caption: Example mail from the System status notification
This report contains all System Status Notifications from your TYPO3
installation. Please check the status report for more information.
Site: [DDEV] TYPO3
Issues:
[WARN] System environment check - 1 Test(s)
### Trusted hosts pattern is insecure: 1
+11
View File
@@ -0,0 +1,11 @@
:template: sitemap.html
.. include:: /Includes.rst.txt
.. _sitemap:
=======
Sitemap
=======
.. The sitemap.html template will insert here the page tree automatically.
+21
View File
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<guides xmlns="https://www.phpdoc.org/guides" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://www.phpdoc.org/guides ../vendor/phpdocumentor/guides-cli/resources/schema/guides.xsd"
links-are-relative="true">
<extension class="\T3Docs\Typo3DocsTheme\DependencyInjection\Typo3DocsThemeExtension"
project-home="https://extensions.typo3.org/extension/reports/"
project-contact="https://typo3.slack.com/archives/C025BQLFA"
project-repository="https://github.com/typo3/typo3"
project-issues="https://forge.typo3.org/projects/typo3cms-core/issues"
edit-on-github-branch="main"
edit-on-github="typo3/typo3"
edit-on-github-directory="typo3/sysext/reports/Documentation/"
typo3-core-preferred="main"
interlink-shortcode="typo3/cms-reports"
/>
<project title="Reports"
release="main (development)"
version="main (development)"
copyright="since 2018 by the TYPO3 contributors"
/>
</guides>
+339
View File
@@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
+11
View File
@@ -0,0 +1,11 @@
===========================
TYPO3 extension ``reports``
===========================
This extension shows status reports and installed services in the
(System>Reports) backend module.
:Repository: https://github.com/typo3/typo3
:Issues: https://forge.typo3.org/
:Read online: https://docs.typo3.org/c/typo3/cms-reports/main/en-us/
:Packagist: https://packagist.org/packages/typo3/cms-reports
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
<file source-language="en" datatype="plaintext" original="EXT:reports/Resources/Private/Language/Modules/overview.xlf" date="2026-11-10T13:37:37Z" product-name="overview">
<header/>
<body>
<trans-unit id="short_description">
<source>System monitoring and analysis reports</source>
</trans-unit>
<trans-unit id="description">
<source>Access reports for monitoring and analyzing the TYPO3 installation including system status checks, database statistics, and custom reports provided by extensions.</source>
</trans-unit>
<trans-unit id="title">
<source>Reports</source>
</trans-unit>
</body>
</file>
</xliff>
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
<file source-language="en" datatype="plaintext" original="EXT:reports/Resources/Private/Language/Modules/statistics.xlf" date="2026-11-10T13:37:37Z" product-name="statistics">
<header/>
<body>
<trans-unit id="short_description">
<source>Shows database record statistics</source>
</trans-unit>
<trans-unit id="description">
<source>Get statistics for database records, including total, translated, hidden, and deleted pages, page type distribution, and and detailed table records with lost record detection. The report analyzes the entire page tree.</source>
</trans-unit>
<trans-unit id="title">
<source>Record Statistics</source>
</trans-unit>
<trans-unit id="doktype">
<source>Document types</source>
</trans-unit>
<trans-unit id="doktype_value">
<source>Document types (value)</source>
</trans-unit>
<trans-unit id="count">
<source>Count</source>
</trans-unit>
<trans-unit id="pages">
<source>Pages</source>
</trans-unit>
<trans-unit id="total_pages">
<source>Total number of default language pages</source>
</trans-unit>
<trans-unit id="translated_pages">
<source>Total number of translated pages</source>
</trans-unit>
<trans-unit id="deleted_pages">
<source>Marked-deleted pages</source>
</trans-unit>
<trans-unit id="hidden_pages">
<source>Hidden pages</source>
</trans-unit>
<trans-unit id="tables">
<source>Tables</source>
</trans-unit>
<trans-unit id="label">
<source>Label</source>
</trans-unit>
<trans-unit id="tablename">
<source>Table name</source>
</trans-unit>
<trans-unit id="total_lost">
<source>Records total / lost</source>
</trans-unit>
</body>
</file>
</xliff>
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
<file source-language="en" datatype="plaintext" original="EXT:reports/Resources/Private/Language/Modules/status.xlf" date="2026-11-10T13:37:37Z" product-name="status">
<header/>
<body>
<trans-unit id="short_description">
<source>Get a status report about your site's operation and any detected problems.</source>
</trans-unit>
<trans-unit id="description">
<source>Review key site parameters and installation issues. You can copy this information into TYPO3 support requests or project issue trackers.</source>
</trans-unit>
<trans-unit id="title">
<source>Status Report</source>
</trans-unit>
</body>
</file>
</xliff>
+86
View File
@@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
<file source-language="en" datatype="plaintext" original="EXT:reports/Resources/Private/Language/locallang.xlf" date="2011-10-17T20:22:35Z" product-name="reports">
<header/>
<body>
<trans-unit id="reports_overview">
<source>Reports overview</source>
</trans-unit>
<trans-unit id="choose_report">
<source>Report</source>
</trans-unit>
<trans-unit id="noReportsTitle">
<source>No registered reports</source>
</trans-unit>
<trans-unit id="noReportsMessage">
<source>There are no reports registered in the system and default reports have been disabled.</source>
</trans-unit>
<trans-unit id="link.openModule">
<source>Open</source>
</trans-unit>
<trans-unit id="link.openModuleWithTitle">
<source>Open %1s</source>
</trans-unit>
<trans-unit id="contentStatistics.title">
<source>Content Statistics</source>
</trans-unit>
<trans-unit id="contentStatistics.shortDescription">
<source>Shows statistics about used content elements</source>
</trans-unit>
<trans-unit id="contentStatistics.description">
<source>Provides an overview of all content element types, showing how often each appears across the site. Includes summaries per type.</source>
</trans-unit>
<trans-unit id="contentStatistics.statistic">
<source>Statistics</source>
</trans-unit>
<trans-unit id="contentStatistics.existingElements.header">
<source>Existing Content Element Types</source>
</trans-unit>
<trans-unit id="contentStatistics.existingElements.description">
<source>The listed content elements include both visible and hidden records.</source>
</trans-unit>
<trans-unit id="contentStatistics.existingElements.explanation">
<source>Keep in mind that some elements may not appear on any page, and others might be rendered by alternative methods (TypoScript, ViewHelpers, etc.). As a result, it is not technically possible to determine actual usage.</source>
</trans-unit>
<trans-unit id="contentStatistics.existingElements.error">
<source>The content element database table's schema ("tt_content") could not be analyzed due to a missing or disabled schema type.</source>
</trans-unit>
<trans-unit id="contentStatistics.unusedElements.header">
<source>Unused content elements</source>
</trans-unit>
<trans-unit id="contentStatistics.unusedElements.description">
<source>This list includes content element types that are not used anywhere, or whose existing instances are all flagged as deleted.</source>
</trans-unit>
<trans-unit id="contentStatistics.fields">
<source>%d fields</source>
</trans-unit>
<trans-unit id="contentStatistics.field.type">
<source>Type</source>
</trans-unit>
<trans-unit id="contentStatistics.field.excluded">
<source>Excluded</source>
</trans-unit>
<trans-unit id="contentStatistics.field.not_excluded">
<source>Always visible</source>
</trans-unit>
<trans-unit id="contentStatistics.field.required">
<source>Required</source>
</trans-unit>
<trans-unit id="contentStatistics.statistic.active_text">
<source>%d active / %d hidden</source>
</trans-unit>
<trans-unit id="contentStatistics.statistic.deleted_text">
<source>%d deleted</source>
</trans-unit>
<trans-unit id="contentStatistics.statistic.deleted">
<source>Deleted</source>
</trans-unit>
<trans-unit id="contentStatistics.records">
<source>Records</source>
</trans-unit>
<trans-unit id="contentStatistics.noRecords">
<source>No records found</source>
</trans-unit>
</body>
</file>
</xliff>
@@ -0,0 +1,260 @@
<?xml version="1.0" encoding="UTF-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
<file source-language="en" datatype="plaintext" original="EXT:reports/Resources/Private/Language/locallang_reports.xlf" date="2011-10-17T20:22:35Z" product-name="reports">
<header/>
<body>
<trans-unit id="status_ok">
<source>OK</source>
</trans-unit>
<trans-unit id="status_wrongValue">
<source>Wrong value detected</source>
</trans-unit>
<trans-unit id="status_info">
<source>Information</source>
</trans-unit>
<trans-unit id="status_insecure">
<source>Insecure</source>
</trans-unit>
<trans-unit id="status_disabled">
<source>Disabled</source>
</trans-unit>
<trans-unit id="status_enabled">
<source>Enabled</source>
</trans-unit>
<trans-unit id="status_enabledPermanently">
<source>Enabled permanently</source>
</trans-unit>
<trans-unit id="status_enabledTemporarily">
<source>Enabled temporarily</source>
</trans-unit>
<trans-unit id="status_empty">
<source>Empty</source>
</trans-unit>
<trans-unit id="status_none">
<source>None</source>
</trans-unit>
<trans-unit id="status_connectionFailed">
<source>Connection Failed</source>
</trans-unit>
<trans-unit id="status_checkFailed">
<source>Check Failed</source>
</trans-unit>
<trans-unit id="status_updateComplete">
<source>Update Complete</source>
</trans-unit>
<trans-unit id="status_updateIncomplete">
<source>Update Incomplete</source>
</trans-unit>
<trans-unit id="status_problemNotification">
<source>One or more problems were detected with your TYPO3 installation. Please check the %sstatus report%s for more information.</source>
</trans-unit>
<trans-unit id="status_allNotification">
<source>This report contains all System Status Notifications from your TYPO3 installation. Please check the %sstatus report%s for more information.</source>
</trans-unit>
<trans-unit id="status_typo3">
<source>TYPO3 System</source>
</trans-unit>
<trans-unit id="status_system">
<source>System</source>
</trans-unit>
<trans-unit id="status_security">
<source>Security</source>
</trans-unit>
<trans-unit id="status_configuration">
<source>Configuration</source>
</trans-unit>
<trans-unit id="status_referenceIndex">
<source>Reference Index</source>
</trans-unit>
<trans-unit id="status_fal">
<source>File Abstraction Layer</source>
</trans-unit>
<trans-unit id="status_missingFiles">
<source>Files flagged as missing</source>
</trans-unit>
<trans-unit id="status_missingFilesCount">
<source>%1$s files</source>
</trans-unit>
<trans-unit id="status_missingFilesMessage">
<source>These files are flagged as missing. Restore the files and run the indexer to reset the missing flag.</source>
</trans-unit>
<trans-unit id="status_memcachedConfiguration">
<source>Memcached Configuration</source>
</trans-unit>
<trans-unit id="status_CreatedFilePermissions">
<source>Permissions of created files</source>
</trans-unit>
<trans-unit id="status_CreatedFilePermissions.writable">
<source>Files created by TYPO3 are configured to be world writable. Depending on your server configuration, this can be a security risk. It is usually better to configure the create mask to not allow writing to files by "others". A sane default is often '0660' for $GLOBALS['TYPO3_CONF_VARS']['SYS']['fileCreateMask']. This can be set in the install tool.</source>
</trans-unit>
<trans-unit id="status_CreatedDirectoryPermissions">
<source>Permissions of created directories</source>
</trans-unit>
<trans-unit id="status_CreatedDirectoryPermissions.writable">
<source>Directories created by TYPO3 are configured to be world writable. Depending on your server configuration, this can be a security risk. It is usually better to configure the create mask to not allow writing to directories by "others". A sane default is often '2770' for $GLOBALS['TYPO3_CONF_VARS']['SYS']['folderCreateMask']. This can be set in the install tool.</source>
</trans-unit>
<trans-unit id="status_MysqlDatabaseCharacterSet">
<source>MySQL Database Character Set</source>
</trans-unit>
<trans-unit id="status_MysqlDatabaseCharacterSet_CheckFailed">
<source>Checking database character set failed, got key "%1$s" instead of "character_set_database"</source>
</trans-unit>
<trans-unit id="status_MysqlDatabaseCharacterSet_Unsupported">
<source>Your default database uses character set "%1$s", but only "utf8", "utf8mb3" or "utf8mb4" is supported with TYPO3.</source>
</trans-unit>
<trans-unit id="status_MysqlDatabaseCharacterSet_Ok">
<source>Your default database uses utf-8. All good.</source>
</trans-unit>
<trans-unit id="status_MysqlDatabaseCharacterSet_Info">
<source>Your default database uses a different charset, but all tables uses utf-8. All good. But consider fixing your database collation and check the table creation settings.</source>
</trans-unit>
<trans-unit id="status_MysqlDatabaseCharacterSet_MixedCollations">
<source>Your default database is set to create tables with character set "%1$s", but contains tables or columns with different collations. Please fix these tables to avoid "illegal mix of collations" errors.</source>
</trans-unit>
<trans-unit id="status_encryptedConnectionStatus">
<source>Encrypted backend connection (HTTPS)</source>
</trans-unit>
<trans-unit id="status_encryptedConnectionStatus_insecure">
<source>Your backend access is not secured using HTTPS but relies on HTTP which sends all your data (including login passwords) over an insecure connection. All modern web sites should rely on HTTPS and only sites secured differently, for instance some intranet installations may use HTTP only.</source>
</trans-unit>
<trans-unit id="status_lockSslStatus">
<source>Backend only accessible through HTTPS</source>
</trans-unit>
<trans-unit id="status_lockSslStatus_insecure">
<source><![CDATA[It is highly recommended to activate the option (<code>$GLOBALS['TYPO3_CONF_VARS']['BE']['lockSSL']</code>).]]></source>
</trans-unit>
<trans-unit id="status_trustedHostsPattern">
<source>Trusted Hosts Pattern</source>
</trans-unit>
<trans-unit id="status_encryptionKey">
<source>Encryption Key</source>
</trans-unit>
<trans-unit id="status_fileDenyPattern">
<source>File Deny Pattern</source>
</trans-unit>
<trans-unit id="status_htaccessUploadProtection">
<source>.htaccess Upload Protection</source>
</trans-unit>
<trans-unit id="status_exceptionHandler">
<source>Exception Handler / Error Reporting</source>
</trans-unit>
<trans-unit id="status_exportedFiles">
<source>XML/T3D export files</source>
</trans-unit>
<trans-unit id="status_exceptionHandler_warningMessage">
<source>Display Errors is set to 1 - errors will be displayed with the DebugExceptionHandler including stack traces.</source>
</trans-unit>
<trans-unit id="status_exceptionHandler_errorMessage">
<source>Debug Exception Handler enabled in Production Context - will show full error messages including stack traces.</source>
</trans-unit>
<trans-unit id="status_exportedFiles_warningMessage">
<source>The following exported files were found:</source>
</trans-unit>
<trans-unit id="status_exportedFiles_warningRecommendation">
<source>It is recommended to delete exported files to avoid possible disclosure of exported data to backend users with lower/different access rights than user(s) who originally created the export(s).</source>
</trans-unit>
<trans-unit id="status_installTool">
<source>Install Tool</source>
</trans-unit>
<trans-unit id="status_phpModules">
<source>PHP Modules</source>
</trans-unit>
<trans-unit id="status_phpModulesMissing">
<source>One or more modules are missing.</source>
</trans-unit>
<trans-unit id="status_phpModulesList">
<source>The following PHP module(s) is/are missing: %s.</source>
</trans-unit>
<trans-unit id="status_phpModulesInfo">
<source>You need to install and enable these modules to let TYPO3 function correctly.</source>
</trans-unit>
<trans-unit id="status_phpModulesGroup">
<source>one of: %s</source>
</trans-unit>
<trans-unit id="status_phpModulesPresent">
<source>All required modules are installed.</source>
</trans-unit>
<trans-unit id="status_installEnabledTemporarily">
<source>The Install Tool is temporarily enabled. Delete the file "%s" when you have finished setting up TYPO3. If not used the Install Tool will be disabled automatically in %s minutes.</source>
</trans-unit>
<trans-unit id="status_updateTaskTitle">
<source>System Status Update</source>
</trans-unit>
<trans-unit id="status_updateTaskDescription">
<source>Runs a system status check and sends notifications if problems have been found.</source>
</trans-unit>
<trans-unit id="status_updateAdditionalInformation">
<source>Send notification to: %s</source>
</trans-unit>
<trans-unit id="status_updateTaskField_notificationEmails">
<source>Notification Email Addresses (one per line)</source>
</trans-unit>
<trans-unit id="status_updateTaskField_notificationEmails_invalid">
<source>Empty or invalid notification email addresses.</source>
</trans-unit>
<trans-unit id="status_updateTaskField_notificationAll">
<source>Always send notification mail (not only on errors or warnings)</source>
</trans-unit>
<trans-unit id="status_updateTask_email_subject">
<source>System Status Notification for site %s</source>
</trans-unit>
<trans-unit id="status_updateTask_email_site">
<source>Site</source>
</trans-unit>
<trans-unit id="status_updateTask_email_issues">
<source>Issues</source>
</trans-unit>
<trans-unit id="status_xclassUsage">
<source>XCLASS used</source>
</trans-unit>
<trans-unit id="status_xclassUsageFound">
<source>Your system registers XCLASS</source>
</trans-unit>
<trans-unit id="status_xclassUsageFound_message">
<source>XCLASS can overwrite methods or classes of the core or other extensions. This is not necessarily a bad thing, but those XCLASS might break during extension or core upgrades. You should keep an eye on extension compatibility and make sure the intended functionality is still given after updates.</source>
</trans-unit>
<trans-unit id="status_xclassUsageFound_message_detail">
<source>%2$s registers an XCLASS of %1$s</source>
</trans-unit>
<trans-unit id="status_imageprocessing">
<source>Image Processing</source>
</trans-unit>
<trans-unit id="status_imageprocessing_webp">
<source>WebP support and availability</source>
</trans-unit>
<trans-unit id="status_imageprocessing_disabled">
<source>Image processing via ImageMagick/GraphicsMagick is disabled</source>
</trans-unit>
<trans-unit id="status_imageprocessing_webp_not_configured">
<source>WebP image generation is not enabled in $TYPO3_CONF_VARS[GFX][imagefile_ext]. No WebP image files will be generated.</source>
</trans-unit>
<trans-unit id="status_imageprocessing_webp_available">
<source>WebP image generation is not enabled in $TYPO3_CONF_VARS[GFX][imagefile_ext], but it is supported by ImageMagick/GraphicsMagick.</source>
</trans-unit>
<trans-unit id="status_imageprocessing_webp_not_available">
<source>WebP image generation is enabled in $TYPO3_CONF_VARS[GFX][imagefile_ext], but it is NOT supported by ImageMagick/GraphicsMagick. Please update your system environment or disable webp support in TYPO3 Configuration.</source>
</trans-unit>
<trans-unit id="status_imageprocessing_webp_available_and_configured">
<source>WebP image generation is enabled in $TYPO3_CONF_VARS[GFX][imagefile_ext] and supported by ImageMagick/GraphicsMagick — Everything is configured correctly.</source>
</trans-unit>
<trans-unit id="status_imageprocessing_avif">
<source>AVIF support and availability</source>
</trans-unit>
<trans-unit id="status_imageprocessing_avif_not_configured">
<source>AVIF image generation is not enabled in $TYPO3_CONF_VARS[GFX][imagefile_ext]. No AVIF image files will be generated.</source>
</trans-unit>
<trans-unit id="status_imageprocessing_avif_available">
<source>AVIF image generation is not enabled in $TYPO3_CONF_VARS[GFX][imagefile_ext], but it is supported by ImageMagick/GraphicsMagick.</source>
</trans-unit>
<trans-unit id="status_imageprocessing_avif_not_available">
<source>AVIF image generation is enabled in $TYPO3_CONF_VARS[GFX][imagefile_ext], but it is NOT supported by ImageMagick/GraphicsMagick. Please update your system environment or disable AVIF support in TYPO3 Configuration.</source>
</trans-unit>
<trans-unit id="status_imageprocessing_avif_available_and_configured">
<source>AVIF image generation is enabled in $TYPO3_CONF_VARS[GFX][imagefile_ext] and supported by ImageMagick/GraphicsMagick — Everything is configured correctly.</source>
</trans-unit>
<trans-unit id="status_problem_notification_cli_disclaimer">
<source>This report was generated from the Command Line Interface (CLI) context. The PHP settings and modules might differ from the ones defined for the webserver process, for example when using a different php.ini file. In case of problems, always compare the report with the one generated via the backend report module.</source>
</trans-unit>
</body>
</file>
</xliff>
@@ -0,0 +1,113 @@
<html
xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers"
xmlns:core="http://typo3.org/ns/TYPO3/CMS/Core/ViewHelpers"
data-namespace-typo3-fluid="true"
>
<f:layout name="Module" />
<f:section name="Content">
<h1>{f:translate(key:'reports.messages:contentStatistics.title')}</h1>
<p class="lead">{f:translate(key:'reports.messages:contentStatistics.description')}</p>
<f:if condition="{data.error}">
<f:be.infobox state="{f:constant(name: 'TYPO3\CMS\Core\Type\ContextualFeedbackSeverity::ERROR')}">{f:translate(key:'reports.messages:contentStatistics.existingElements.error')}</f:be.infobox>
</f:if>
<f:if condition="{data.exists}">
<h2>{f:translate(key:'reports.messages:contentStatistics.existingElements.header')}</h2>
<p>{f:translate(key:'reports.messages:contentStatistics.existingElements.description')}</p>
<f:be.infobox state="{f:constant(name: 'TYPO3\CMS\Core\Type\ContextualFeedbackSeverity::INFO')}">{f:translate(key:'reports.messages:contentStatistics.existingElements.explanation')}</f:be.infobox>
<f:for each="{data.exists}" as="groupItem" key="group">
<f:if condition="{groupItem.elements}">
<f:if condition="{groupItem.header}">
<h3>{f:translate(key:groupItem.header, default:groupItem.header)} ({groupItem.elements -> f:count()})</h3>
</f:if>
<f:for each="{groupItem.elements}" as="type" key="ctype" iteration="i">
<f:render section="panel" arguments="{type:type, ctype:ctype, mode:'exists'}" />
</f:for>
</f:if>
</f:for>
</f:if>
<f:if condition="{data.unused}">
<h2>{f:translate(key:'reports.messages:contentStatistics.unusedElements.header')}</h2>
<p>{f:translate(key:'reports.messages:contentStatistics.unusedElements.description')}</p>
<f:for each="{data.unused}" as="groupItem" key="group">
<f:if condition="{groupItem.elements}">
<f:if condition="{groupItem.header}">
<h3>{f:translate(key:groupItem.header, default:groupItem.header)} ({groupItem.elements -> f:count()})</h3>
</f:if>
<div class="panel-group">
<f:for each="{groupItem.elements}" as="type" key="ctype" iteration="i">
<f:render section="panel" arguments="{type:type, ctype:ctype, mode:'unused'}" />
</f:for>
</div>
</f:if>
</f:for>
</f:if>
</f:section>
<f:section name="panel">
<div class="panel panel-default">
<h4 class="panel-heading">
<div class="panel-heading-row">
<button class="panel-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapsible-panel-{ctype}" aria-expanded="false">
<span class="caret"></span>
<div class="panel-title">
<f:if condition="{type.iconIdentifier}">
<core:icon identifier="{type.iconIdentifier}" overlay="{type.iconOverlay}" />
</f:if>
{f:translate(key:type.title, default:type.title)}
<code>[{ctype}]</code>
</div>
</button>
<div>
<f:if condition="{mode} == exists">
<f:then>
<f:translate key="reports.messages:contentStatistics.statistic.active_text" arguments="{0:type.count.visible, 1:type.count.hidden}" />
</f:then>
<f:else if="{type.count.deleted}">
<f:translate key="reports.messages:contentStatistics.statistic.deleted_text" arguments="{0:type.count.deleted}" />
</f:else>
</f:if>
</div>
<f:if condition="{type.count}">
<div class="panel-actions">
<a class="btn btn-default btn-sm" href="{be:moduleLink(route: 'system_reports_contentstatistics', arguments:{ctype:ctype})}">
<core:icon identifier="actions-document-view" />
{f:translate(key:'core.common:details')}
</a>
</div>
</f:if>
</div>
</h4>
<div class="panel-collapse collapse" id="collapsible-panel-{ctype}" aria-expanded="false">
<div class="panel-body">
<h4><f:translate key="reports.messages:contentStatistics.fields" arguments="{0:'{type.fields -> f:count()}'}" /></h4>
<table class="table table-sm table-hover table-condensed table-striped">
<thead>
<tr>
<th>{f:translate(key:'core.core:labels.th.name')}</th>
<th>{f:translate(key:'reports.messages:contentStatistics.field.type')}</th>
<th>{f:translate(key:'reports.messages:contentStatistics.field.not_excluded')}</th>
<th>{f:translate(key:'reports.messages:contentStatistics.field.required')}</th>
</tr>
</thead>
<tbody>
<f:for each="{type.fields}" as="field">
<tr>
<td>{f:translate(key:field.label, default:field.label)} <code>[{field.name}]</code></td>
<td>{field.type}</td>
<td>{f:if(condition:'!{field.configuration.exclude}', then:'{core:icon(identifier:\'actions-check-circle\')}')}</td>
<td>{f:if(condition:field.configuration.required, then:'{core:icon(identifier:\'actions-check-circle\')}')}</td>
</tr>
</f:for>
</tbody>
</table>
</div>
</div>
</div>
</f:section>
</html>
@@ -0,0 +1,174 @@
<html
xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers"
xmlns:core="http://typo3.org/ns/TYPO3/CMS/Core/ViewHelpers"
data-namespace-typo3-fluid="true"
>
<f:layout name="Module" />
<f:section name="Content">
<h1>{f:translate(key:label, default:label)} <code>[{ctype}]</code></h1>
<h2>{f:translate(key:'reports.messages:contentStatistics.statistic')}</h2>
<div class="table-fit">
<table class="table table-striped table-hover">
<tr>
<th>{f:translate(key:'core.general:LGL.enabled')}</th>
<td>{count.visible}</td>
</tr>
<tr>
<th>{f:translate(key:'core.general:LGL.disabled')}</th>
<td>{count.hidden}</td>
</tr>
<tr>
<th>{f:translate(key:'reports.messages:contentStatistics.statistic.deleted')}</th>
<td>{count.deleted}</td>
</tr>
</table>
</div>
<h2 id="recordlist">{f:translate(key:'reports.messages:contentStatistics.records')}</h2>
<f:if condition="{rows}">
<f:then>
<div class="table-fit">
<table class="table table-striped table-hover table-border">
<thead>
<tr>
<th>UID</th>
<th>{f:translate(key:'frontend.db.tt_content:header')}</th>
<th>{f:translate(key:'core.core:labels.pid')}</th>
<th>{f:translate(key:'core.core:labels.tstamp')}</th>
<th>{f:translate(key:'core.core:labels.path')}</th>
<th></th>
</tr>
</thead>
<tbody>
<f:for each="{rows}" as="row">
<tr>
<td class="nowrap">{row.uid}</td>
<td class="col-title col-responsive nowrap">
<be:link.editRecord
returnUrl="{returnUrl}"
table="tt_content"
uid="{row.uid}"
title="{f:translate(key:'core.mod_web_list:edit')}"
>
<span><core:iconForRecord table="tt_content" row="{row}" /></span>
{row.header}
</be:link.editRecord>
</td>
<td class="nowrap">{row.pid}</td>
<td class="nowrap">{row.tstamp_formatted}</td>
<td class="col-path nowrap">{row.path}</td>
<td class="col-control nowrap">
<div class="btn-group" role="group">
<be:link.editRecord
uid="{row.uid}"
table="tt_content"
class="btn btn-default"
returnUrl="{returnUrl}"
title="{f:translate(key:'core.mod_web_list:edit')}"
>
<core:icon identifier="actions-open" />
</be:link.editRecord>
</div>
</td>
</tr>
</f:for>
</tbody>
</table>
</div>
<f:if condition="{paginator.numberOfPages} > 1">
<nav class="pagination-wrap">
<ul class="pagination">
<f:if condition="{pagination.previousPageNumber}">
<f:then>
<li class="page-item">
<a href="{f:be.uri(route:'system_reports_contentstatistics', parameters:'{ctype: ctype, page:1}')}#recordlist" title="{f:translate(extensionName: 'fluid', key:'widget.pagination.first')}" class="page-link">
<core:icon identifier="actions-view-paging-first" />
</a>
</li>
<li class="page-item">
<a href="{f:be.uri(route:'system_reports_contentstatistics', parameters:'{ctype: ctype, page:pagination.previousPageNumber}')}#recordlist" title="{f:translate(extensionName: 'fluid', key:'widget.pagination.previous')}" class="page-link">
<core:icon identifier="actions-view-paging-previous" />
</a>
</li>
</f:then>
<f:else>
<li class="page-item disabled">
<span class="page-link">
<core:icon identifier="empty-empty"/>
</span>
</li>
<li class="page-item disabled">
<span class="page-link">
<core:icon identifier="empty-empty"/>
</span>
</li>
</f:else>
</f:if>
<li class="page-item">
<span class="page-link">
{pagination.startRecordNumber} - {pagination.endRecordNumber}
</span>
</li>
<li class="page-item">
<span class="page-link">
<f:translate extensionName="fluid" key="widget.pagination.page" />
<f:variable name="goToPageUrl">
<f:be.uri route="system_reports_contentstatistics" parameters="{action:'overview', page:987654322}" />
</f:variable>
<form data-on-submit="processNavigate" class="form-inline">
<input type="number"
value="{paginator.currentPageNumber}"
name="paginator-target-page"
class="form-control form-control-sm paginator-input"
min="1"
max="{paginator.numberOfPages}"
data-number-of-pages="{paginator.numberOfPages}"
data-url="{goToPageUrl}" />
</form>
/ {paginator.numberOfPages}
</span>
</li>
<f:if condition="{pagination.nextPageNumber}">
<f:then>
<li class="page-item">
<a href="{f:be.uri(route:'system_reports_contentstatistics', parameters:'{ctype: ctype, page: pagination.nextPageNumber}')}#recordlist" title="{f:translate(extensionName: 'fluid', key:'widget.pagination.next')}" class="page-link">
<core:icon identifier="actions-view-paging-next" />
</a>
</li>
<li class="page-item">
<a href="{f:be.uri(route:'system_reports_contentstatistics', parameters:'{ctype: ctype, page: paginator.numberOfPages}')}#recordlist" title="{f:translate(extensionName: 'fluid', key:'widget.pagination.last')}" class="page-link">
<core:icon identifier="actions-view-paging-last" />
</a>
</li>
</f:then>
<f:else>
<li class="page-item disabled">
<span class="page-link">
<core:icon identifier="empty-empty"/>
</span>
</li>
<li class="page-item disabled">
<span class="page-link">
<core:icon identifier="empty-empty"/>
</span>
</li>
</f:else>
</f:if>
<li class="page-item">
<a href="{f:be.uri(route:'system_reports_contentstatistics', parameters:'{ctype: ctype, page: paginator.currentPageNumber}')}#recordlist" title="{f:translate(extensionName: 'fluid', key:'widget.pagination.refresh')}" class="page-link">
<core:icon identifier="actions-refresh" />
</a>
</li>
</ul>
</nav>
</f:if>
</f:then>
<f:else>
<f:be.infobox>{f:translate(key:'reports.messages:contentStatistics.noRecords')}</f:be.infobox>
</f:else>
</f:if>
</f:section>
</html>
@@ -0,0 +1,2 @@
<f:layout name="SystemEmail" />
<f:section name="Main">{message -> f:format.raw()}</f:section>
@@ -0,0 +1,98 @@
<html
xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
data-namespace-typo3-fluid="true"
>
<f:layout name="Module" />
<f:section name="Content">
<h1>{f:translate(key:'title', domain:'reports.modules.statistics')}</h1>
<p>{f:translate(key:'description', domain:'reports.modules.statistics')}</p>
<h2>{f:translate(key:'pages', domain: 'reports.modules.statistics')}</h2>
<div class="table-fit">
<table class="table table-striped table-hover">
<colgroup>
<col width="24">
<col>
<col width="150">
</colgroup>
<thead>
<tr>
<th colspan="2"></th>
<th>{f:translate(key:'count', domain: 'reports.modules.statistics')}</th>
</tr>
</thead>
<tbody>
<f:for each="{pages}" as="item" key="name">
<tr>
<td><f:format.raw>{item.icon}</f:format.raw></td>
<td>{f:translate(key:'{name}', domain: 'reports.modules.statistics')}</td>
<td>{item.count}</td>
</tr>
</f:for>
</tbody>
</table>
</div>
<h2>{f:translate(key:'doktype', domain: 'reports.modules.statistics')}</h2>
<div class="table-fit">
<table class="table table-striped table-hover">
<colgroup>
<col width="24">
<col>
<col width="150">
</colgroup>
<thead>
<tr>
<th></th>
<th>{f:translate(key:'doktype_value', domain: 'reports.modules.statistics')}</th>
<th>{f:translate(key:'count', domain: 'reports.modules.statistics')}</th>
</tr>
</thead>
<tbody>
<f:for each="{doktypes}" as="item">
<tr>
<td><f:format.raw>{item.icon}</f:format.raw></td>
<td>{item.title}</td>
<td>{item.count}</td>
</tr>
</f:for>
</tbody>
</table>
</div>
<h2>{f:translate(key:'tables', domain: 'reports.modules.statistics')}</h2>
<div class="table-fit">
<table class="table table-striped table-hover">
<colgroup>
<col width="24">
<col>
<col width="150">
</colgroup>
<thead>
<tr>
<th></th>
<th>{f:translate(domain:'reports.modules.statistics', key:'label')}</th>
<th>{f:translate(domain:'reports.modules.statistics', key:'tablename')}</th>
<th>{f:translate(domain:'reports.modules.statistics', key:'total_lost')}</th>
<th></th>
</tr>
</thead>
<tbody>
<f:for each="{tables}" key="name" as="item">
<tr>
<td><f:format.raw>{item.icon}</f:format.raw></td>
<td>{item.title}</td>
<td>{name}</td>
<td>{item.count}</td>
<td><f:format.raw>{item.lostRecords}</f:format.raw></td>
</tr>
</f:for>
</tbody>
</table>
</div>
</f:section>
</html>
@@ -0,0 +1,40 @@
<html
xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
xmlns:core="http://typo3.org/ns/TYPO3/CMS/Core/ViewHelpers"
data-namespace-typo3-fluid="true"
>
<f:layout name="Module" />
<f:section name="Content">
<h1>
<f:translate key="title" domain="reports.modules.status" />
</h1>
<p>
<f:translate key="description" domain="reports.modules.status" />
</p>
<f:for each="{statusCollection}" as="statuses" key="title">
<h2>{title}</h2>
<div class="statusreport-wrapper">
<f:for each="{statuses}" as="status">
<div class="statusreport" data-severity="{status.severity.cssClass}">
<div class="statusreport-indicator">
<div class="statusreport-indicator-icon">
<core:icon identifier="{severityIconMapping.{status.severity.value}}" size="default" />
</div>
</div>
<div class="statusreport-title">
{status.title}
</div>
<div class="statusreport-body">
<strong>{status.value}</strong><br>
{status.message -> f:format.raw()}
</div>
</div>
</f:for>
</div>
</f:for>
</f:section>
</html>
Binary file not shown.

After

Width:  |  Height:  |  Size: 733 B

+59
View File
@@ -0,0 +1,59 @@
{
"name": "typo3/cms-reports",
"type": "typo3-cms-framework",
"description": "TYPO3 CMS Reports - Show status reports and installed services in the (System>Reports) backend module.",
"homepage": "https://typo3.community/",
"funding": [
{
"type": "membership",
"url": "https://typo3.org/membership"
}
],
"license": [
"GPL-2.0-or-later"
],
"authors": [
{
"name": "TYPO3 Core Team",
"email": "typo3cms@typo3.org",
"role": "Developer"
}
],
"support": {
"issues": "https://forge.typo3.org/issues/",
"forum": "https://talk.typo3.org/",
"source": "https://github.com/TYPO3/typo3/",
"docs": "https://docs.typo3.org/",
"rss": "https://news.typo3.com/rss/",
"chat": "https://typo3.community/meet/slack/",
"security": "https://typo3.org/security/"
},
"config": {
"sort-packages": true
},
"require": {
"typo3/cms-core": "15.0.*@dev"
},
"suggest": {
"typo3/cms-scheduler": "Determine system's status and send it via email"
},
"conflict": {
"typo3/cms": "*"
},
"extra": {
"branch-alias": {
"dev-main": "15.0.x-dev"
},
"typo3/cms": {
"Package": {
"partOfFactoryDefault": true
},
"extension-key": "reports"
}
},
"autoload": {
"psr-4": {
"TYPO3\\CMS\\Reports\\": "Classes/"
}
}
}