TYPO3 v15 dev-main snapshot ()

This commit is contained in:
2026-08-10 22:31:09 +02:00
commit af8cc155b5
6818 changed files with 642608 additions and 0 deletions
@@ -0,0 +1,33 @@
<?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\Core\Database\Driver;
use Doctrine\DBAL\Driver\Connection as DriverConnection;
use Doctrine\DBAL\Driver\Middleware\AbstractDriverMiddleware;
use TYPO3\CMS\Core\Database\Driver\DriverConnection as Typo3PdoDriverConnection;
/**
* @internal this implementation is not part of TYPO3's Public API.
*/
final class CustomPdoResultDriverDecorator extends AbstractDriverMiddleware
{
public function connect(#[\SensitiveParameter] array $params): DriverConnection
{
return new Typo3PdoDriverConnection(parent::connect($params));
}
}
@@ -0,0 +1,81 @@
<?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\Core\Database\Driver;
use Doctrine\DBAL\Driver\Middleware\AbstractDriverMiddleware;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\MariaDB1010Platform as DoctrineMariaDB1010Platform;
use Doctrine\DBAL\Platforms\MariaDB1052Platform as DoctrineMariaDB1052Platform;
use Doctrine\DBAL\Platforms\MariaDB1060Platform as DoctrineMariaDB1060Platform;
use Doctrine\DBAL\Platforms\MariaDB110700Platform as DoctrineMariaDB110700Platform;
use Doctrine\DBAL\Platforms\MariaDBPlatform as DoctrineMariaDBPlatform;
use Doctrine\DBAL\Platforms\MySQL80Platform as DoctrineMySQL80Platform;
use Doctrine\DBAL\Platforms\MySQL84Platform as DoctrineMySQL84Platform;
use Doctrine\DBAL\Platforms\MySQLPlatform as DoctrineMySQLPlatform;
use Doctrine\DBAL\Platforms\PostgreSQL120Platform as DoctrinePostgreSQL120Platform;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform as DoctrinePostgreSQLPlatform;
use Doctrine\DBAL\Platforms\SQLitePlatform as DoctrineSQLitePlatform;
use Doctrine\DBAL\ServerVersionProvider;
use TYPO3\CMS\Core\Database\Platform\MariaDB1010Platform as Typo3MariaDB1010Platform;
use TYPO3\CMS\Core\Database\Platform\MariaDB1052Platform as Typo3MariaDB1052Platform;
use TYPO3\CMS\Core\Database\Platform\MariaDB1060Platform as Typo3MariaDB1060Platform;
use TYPO3\CMS\Core\Database\Platform\MariaDB110700Platform as Typo3MariaDB110700Platform;
use TYPO3\CMS\Core\Database\Platform\MariaDBPlatform as Typo3MariaDBPlatform;
use TYPO3\CMS\Core\Database\Platform\MySQL80Platform as Typo3MySQL80Platform;
use TYPO3\CMS\Core\Database\Platform\MySQL84Platform as Typo3MySQL84Platform;
use TYPO3\CMS\Core\Database\Platform\MySQLPlatform as Typo3MySQLPlatform;
use TYPO3\CMS\Core\Database\Platform\PostgreSQL120Platform as Typo3PostgreSQL120Platform;
use TYPO3\CMS\Core\Database\Platform\PostgreSQLPlatform as Typo3PostgreSQLPlatform;
use TYPO3\CMS\Core\Database\Platform\SQLitePlatform as Typo3SQLitePlatform;
/**
* @internal this implementation is not part of TYPO3's Public API.
*/
final class CustomPlatformDriverDecorator extends AbstractDriverMiddleware
{
public function getDatabasePlatform(ServerVersionProvider $versionProvider): AbstractPlatform
{
return $this->elevatePlatform(parent::getDatabasePlatform($versionProvider));
}
/**
* Due to the deprecation doctrine/event-manager usage in doctrine/dbal the platform classes needs to be extended
* to still provide the same behaviour as before. Therefore, we replace the doctrine platform instances with our
* extended classes.
*
* @param AbstractPlatform $platform
* @return AbstractPlatform
*/
private function elevatePlatform(AbstractPlatform $platform): AbstractPlatform
{
return match ($platform::class) {
DoctrineMySQLPlatform::class => new Typo3MySQLPlatform(),
DoctrineMySQL80Platform::class => new Typo3MySQL80Platform(),
DoctrineMySQL84Platform::class => new Typo3MySQL84Platform(),
DoctrineMariaDB110700Platform::class => new Typo3MariaDB110700Platform(),
DoctrineMariaDB1010Platform::class => new Typo3MariaDB1010Platform(),
DoctrineMariaDB1060Platform::class => new Typo3MariaDB1060Platform(),
DoctrineMariaDB1052Platform::class => new Typo3MariaDB1052Platform(),
DoctrineMariaDBPlatform::class => new Typo3MariaDBPlatform(),
DoctrineSQLitePlatform::class => new Typo3SQLitePlatform(),
DoctrinePostgreSQL120Platform::class => new Typo3PostgreSQL120Platform(),
DoctrinePostgreSQLPlatform::class => new Typo3PostgreSQLPlatform(),
default => $platform,
};
}
}
@@ -0,0 +1,41 @@
<?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\Core\Database\Driver;
use Doctrine\DBAL\Driver\Middleware\AbstractConnectionMiddleware;
use Doctrine\DBAL\Driver\Result as ResultInterface;
use Doctrine\DBAL\Driver\Statement as StatementInterface;
/**
* DriverConnection decorator to replace the DriverResult with a custom class directly
* in the connection and the driver statement class.
*
* @internal this implementation is not part of TYPO3's Public API.
*/
class DriverConnection extends AbstractConnectionMiddleware
{
public function prepare(string $sql): StatementInterface
{
return new DriverStatement(parent::prepare($sql));
}
public function query(string $sql): ResultInterface
{
return new DriverResult(parent::query($sql));
}
}
+104
View File
@@ -0,0 +1,104 @@
<?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\Core\Database\Driver;
use Doctrine\DBAL\Driver\Middleware\AbstractResultMiddleware;
/**
* TYPO3's custom Result object for Database statements based on Doctrine DBAL.
*
* This is a lowlevel wrapper around PDO for TYPO3 based drivers to ensure mapResourceToString()
* is called when retrieving data. This isn't the actual Result object (Doctrine\DBAL\Result) which
* is used in user-land code.
*
* @internal this implementation is not part of TYPO3's Public API.
*/
class DriverResult extends AbstractResultMiddleware
{
/**
* {@inheritDoc}
*/
public function fetchNumeric(): array|false
{
return $this->mapResourceToString(parent::fetchNumeric());
}
/**
* {@inheritDoc}
*/
public function fetchAssociative(): array|false
{
return $this->mapResourceToString(parent::fetchAssociative());
}
/**
* {@inheritDoc}
*/
public function fetchOne(): mixed
{
return $this->mapResourceToString(parent::fetchOne());
}
/**
* {@inheritDoc}
*/
public function fetchAllNumeric(): array
{
$data = $this->mapResourceToString(parent::fetchAllNumeric());
assert(is_array($data));
return array_map($this->mapResourceToString(...), $data);
}
/**
* {@inheritDoc}
*/
public function fetchAllAssociative(): array
{
$data = $this->mapResourceToString(parent::fetchAllAssociative());
assert(is_array($data));
return array_map($this->mapResourceToString(...), $data);
}
/**
* {@inheritDoc}
*/
public function fetchFirstColumn(): array
{
$data = $this->mapResourceToString(parent::fetchFirstColumn());
assert(is_array($data));
return array_map($this->mapResourceToString(...), $data);
}
/**
* Map resources to string like is done for e.g. in mysqli driver
*
* @param mixed $record
* @return mixed
*/
protected function mapResourceToString($record)
{
if (is_array($record)) {
foreach ($record as $k => $value) {
if (is_resource($value)) {
$record[$k] = stream_get_contents($value);
}
}
}
return $record;
}
}
@@ -0,0 +1,41 @@
<?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\Core\Database\Driver;
use Doctrine\DBAL\Driver\Middleware\AbstractStatementMiddleware;
use Doctrine\DBAL\Driver\Result as ResultInterface;
/**
* TYPO3's custom Statement decorator object for Database statements based on Doctrine DBAL in TYPO3's drivers.
*
* This is a low-level wrapper around PDOStatement for TYPO3 based drivers to ensure the PDOStatement is put into
* TYPO3's DriverResult object, and not in Doctrine's Result object. If Doctrine DBAL had a factory
* for DriverResults this class could be removed.
*
* @internal this implementation is not part of TYPO3's Public API.
*/
class DriverStatement extends AbstractStatementMiddleware
{
/**
* {@inheritdoc}
*/
public function execute(): ResultInterface
{
return new DriverResult(parent::execute());
}
}