‪TYPO3CMS  9.5
SqlLogging.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types = 1);
3 
5 
6 /*
7  * This file is part of the TYPO3 CMS project.
8  *
9  * It is free software; you can redistribute it and/or modify it under
10  * the terms of the GNU General Public License, either version 2
11  * of the License, or any later version.
12  *
13  * For the full copyright and license information, please read the
14  * LICENSE.txt file that was distributed with this source code.
15  *
16  * The TYPO3 project - inspiring people to share!
17  */
18 
19 use Psr\Http\Message\ResponseInterface;
20 use Psr\Http\Message\ServerRequestInterface;
21 use Psr\Http\Server\MiddlewareInterface;
22 use Psr\Http\Server\RequestHandlerInterface;
27 
33 class ‪SqlLogging implements MiddlewareInterface
34 {
35 
42  public function ‪process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
43  {
45  $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
46  $connection = $connectionPool->getConnectionByName(‪ConnectionPool::DEFAULT_CONNECTION_NAME);
47  $connection->getConfiguration()->setSQLLogger(GeneralUtility::makeInstance(DoctrineSqlLogger::class));
48  }
49  return $handler->handle($request);
50  }
51 }
‪TYPO3\CMS\Adminpanel\Middleware
Definition: AdminPanelDataPersister.php:4
‪TYPO3\CMS\Adminpanel\Utility\StateUtility\isActivatedForUser
‪static bool isActivatedForUser()
Definition: StateUtility.php:33
‪TYPO3\CMS\Adminpanel\Log\DoctrineSqlLogger
Definition: DoctrineSqlLogger.php:28
‪TYPO3\CMS\Adminpanel\Utility\StateUtility
Definition: StateUtility.php:27
‪TYPO3\CMS\Core\Database\ConnectionPool\DEFAULT_CONNECTION_NAME
‪const DEFAULT_CONNECTION_NAME
Definition: ConnectionPool.php:48
‪TYPO3\CMS\Adminpanel\Middleware\SqlLogging\process
‪ResponseInterface process(ServerRequestInterface $request, RequestHandlerInterface $handler)
Definition: SqlLogging.php:42
‪TYPO3\CMS\Adminpanel\Utility\StateUtility\isOpen
‪static bool isOpen()
Definition: StateUtility.php:54
‪TYPO3\CMS\Adminpanel\Middleware\SqlLogging
Definition: SqlLogging.php:34
‪TYPO3\CMS\Core\Database\ConnectionPool
Definition: ConnectionPool.php:44
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45