2019-08-20 23:34:33 +02:00
|
|
|
<?php
|
2019-09-19 19:52:54 +02:00
|
|
|
|
2019-08-20 23:34:33 +02:00
|
|
|
/**
|
2019-09-19 19:52:54 +02:00
|
|
|
* @author Tobias Matthaiou <developer@tobimat.eu>
|
|
|
|
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
|
2019-08-20 23:34:33 +02:00
|
|
|
*/
|
|
|
|
|
2024-02-02 10:59:40 +01:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
use D3\OxidSqlLogger\OxidEsalesDatabase;
|
|
|
|
use Psr\Container\ContainerExceptionInterface;
|
|
|
|
use Psr\Container\NotFoundExceptionInterface;
|
|
|
|
|
2022-08-18 14:18:43 +02:00
|
|
|
/**
|
2024-02-02 10:59:40 +01:00
|
|
|
* @param string|null $message
|
2022-08-18 14:18:43 +02:00
|
|
|
*
|
2024-02-02 10:59:40 +01:00
|
|
|
* @throws ContainerExceptionInterface
|
|
|
|
* @throws NotFoundExceptionInterface
|
2022-08-18 14:18:43 +02:00
|
|
|
*/
|
2024-02-02 10:59:40 +01:00
|
|
|
function D3StartSQLLog(string $message = null): void
|
|
|
|
{
|
2022-08-18 14:18:43 +02:00
|
|
|
/** @var OxidEsalesDatabase $database */
|
2024-02-02 11:39:13 +01:00
|
|
|
$database = oxNew(OxidEsalesDatabase::class);
|
2021-01-23 21:55:06 +01:00
|
|
|
$database->d3EnableLogger($message);
|
2019-08-20 23:34:33 +02:00
|
|
|
}
|
|
|
|
|
2022-08-18 14:18:43 +02:00
|
|
|
/**
|
2024-02-02 10:59:40 +01:00
|
|
|
* @throws ContainerExceptionInterface
|
|
|
|
* @throws NotFoundExceptionInterface
|
2022-08-18 14:18:43 +02:00
|
|
|
*/
|
2024-02-02 10:59:40 +01:00
|
|
|
function D3StopSQLLog(): void
|
2021-01-23 21:55:06 +01:00
|
|
|
{
|
2022-08-18 14:18:43 +02:00
|
|
|
/** @var OxidEsalesDatabase $database */
|
2024-02-02 11:39:13 +01:00
|
|
|
$database = oxNew(OxidEsalesDatabase::class);
|
2021-01-23 21:55:06 +01:00
|
|
|
$database->d3DisableLogger();
|
2019-08-20 23:34:33 +02:00
|
|
|
}
|
2021-03-02 15:31:09 +01:00
|
|
|
|
2022-08-18 14:18:43 +02:00
|
|
|
/**
|
2024-02-02 11:33:11 +01:00
|
|
|
* @param string $message
|
2022-08-18 14:18:43 +02:00
|
|
|
*
|
2024-02-02 10:59:40 +01:00
|
|
|
* @throws ContainerExceptionInterface
|
|
|
|
* @throws NotFoundExceptionInterface
|
2022-08-18 14:18:43 +02:00
|
|
|
*/
|
2024-02-02 11:33:11 +01:00
|
|
|
function D3AddSQLLogItem(string $message): void
|
2021-03-02 15:31:09 +01:00
|
|
|
{
|
2022-08-18 14:18:43 +02:00
|
|
|
/** @var OxidEsalesDatabase $database */
|
2024-02-02 11:39:13 +01:00
|
|
|
$database = oxNew(OxidEsalesDatabase::class);
|
2024-02-02 11:33:11 +01:00
|
|
|
if ($logger = $database->d3GetLogger()) {
|
2024-02-02 11:39:13 +01:00
|
|
|
$logger->startQuery($message);
|
2024-02-02 11:33:11 +01:00
|
|
|
$logger->stopQuery();
|
|
|
|
}
|
2021-03-02 15:31:09 +01:00
|
|
|
}
|