core-command/src/QueryLogger.php
Copilot 7c72b49ecd
Some checks failed
Code Quality Checks / code-quality (push) Has been cancelled
Manage Labels / manage-labels (push) Has been cancelled
Regenerate README file / regenerate-readme (push) Has been cancelled
Testing / test (push) Has been cancelled
Introduce wp profile queries command (#207)
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Pascal Birchler <pascalb@google.com>
2026-04-14 20:00:57 +02:00

41 lines
1.1 KiB
PHP

<?php
namespace WP_CLI\Profile;
/**
* Logger for tracking individual database queries.
*/
class QueryLogger {
/** @var string The SQL query string. */
public $query;
/** @var float The time taken to execute the query, in seconds. */
public $time;
/** @var string The caller that initiated the query. */
public $caller;
/** @var string|null The hook associated with the query, if any. */
public $hook;
/** @var string|null The callback associated with the query, if any. */
public $callback;
/**
* QueryLogger constructor.
*
* @param string $query The SQL query string.
* @param float $time The time taken to execute the query, in seconds.
* @param string $caller The caller that initiated the query.
* @param string|null $hook Optional. The hook associated with the query.
* @param string|null $callback Optional. The callback associated with the query.
*/
public function __construct( $query, $time, $caller, $hook = null, $callback = null ) {
$this->query = $query;
$this->time = $time;
$this->caller = $caller;
$this->hook = $hook;
$this->callback = $callback;
}
}