fix: [sql logs] captured when benchmarking is enabled but debug level is < 2

pull/9176/merge
iglocska 2024-04-23 15:03:22 +02:00
parent 597977694d
commit cd25980da9
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
3 changed files with 6 additions and 4 deletions

View File

@ -15,9 +15,6 @@ class BenchmarkTool
/** @var retention */
private $retention = 0;
/** @var start_time */
public $start_timexxx;
const BENCHMARK_SCOPES = ['user', 'endpoint', 'user_agent'];
const BENCHMARK_FIELDS = ['time', 'sql_time', 'sql_queries', 'memory'];
const BENCHMARK_UNITS = [

View File

@ -152,7 +152,9 @@ class MysqlExtended extends Mysql
public function execute($sql, $options = [], $params = [])
{
$log = $options['log'] ?? $this->fullDebug;
if (Configure::read('Plugin.Benchmarking_enable')) {
$log = true;
}
if ($log) {
$t = microtime(true);
$this->_result = $this->_execute($sql, $params);

View File

@ -144,6 +144,9 @@ class MysqlObserverExtended extends Mysql
public function execute($sql, $options = [], $params = [])
{
$log = $options['log'] ?? $this->fullDebug;
if (Configure::read('Plugin.Benchmarking_enable')) {
$log = true;
}
$comment = sprintf(
'%s%s%s',
empty(Configure::read('CurrentUserId')) ? '' : sprintf(