class MysqlProfilerStorage in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/http-kernel/Profiler/MysqlProfilerStorage.php \Symfony\Component\HttpKernel\Profiler\MysqlProfilerStorage
A ProfilerStorage for Mysql.
@author Jan Schumann <js@schumann-it.com>
Hierarchy
- class \Symfony\Component\HttpKernel\Profiler\PdoProfilerStorage implements ProfilerStorageInterface
- class \Symfony\Component\HttpKernel\Profiler\MysqlProfilerStorage
Expanded class hierarchy of MysqlProfilerStorage
File
- vendor/
symfony/ http-kernel/ Profiler/ MysqlProfilerStorage.php, line 19
Namespace
Symfony\Component\HttpKernel\ProfilerView source
class MysqlProfilerStorage extends PdoProfilerStorage {
/**
* {@inheritdoc}
*/
protected function initDb() {
if (null === $this->db) {
if (0 !== strpos($this->dsn, 'mysql')) {
throw new \RuntimeException(sprintf('Please check your configuration. You are trying to use Mysql with an invalid dsn "%s". The expected format is "mysql:dbname=database_name;host=host_name".', $this->dsn));
}
if (!class_exists('PDO') || !in_array('mysql', \PDO::getAvailableDrivers(), true)) {
throw new \RuntimeException('You need to enable PDO_Mysql extension for the profiler to run properly.');
}
$db = new \PDO($this->dsn, $this->username, $this->password);
$db
->exec('CREATE TABLE IF NOT EXISTS sf_profiler_data (token VARCHAR(255) PRIMARY KEY, data LONGTEXT, ip VARCHAR(64), method VARCHAR(6), url VARCHAR(255), time INTEGER UNSIGNED, parent VARCHAR(255), created_at INTEGER UNSIGNED, status_code SMALLINT UNSIGNED, KEY (created_at), KEY (ip), KEY (method), KEY (url), KEY (parent))');
$this->db = $db;
}
return $this->db;
}
/**
* {@inheritdoc}
*/
protected function buildCriteria($ip, $url, $start, $end, $limit, $method) {
$criteria = array();
$args = array();
if ($ip = preg_replace('/[^\\d\\.]/', '', $ip)) {
$criteria[] = 'ip LIKE :ip';
$args[':ip'] = '%' . $ip . '%';
}
if ($url) {
$criteria[] = 'url LIKE :url';
$args[':url'] = '%' . addcslashes($url, '%_\\') . '%';
}
if ($method) {
$criteria[] = 'method = :method';
$args[':method'] = $method;
}
if (!empty($start)) {
$criteria[] = 'time >= :start';
$args[':start'] = $start;
}
if (!empty($end)) {
$criteria[] = 'time <= :end';
$args[':end'] = $end;
}
return array(
$criteria,
$args,
);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MysqlProfilerStorage:: |
protected | function |
Build SQL criteria to fetch records by ip and url. Overrides PdoProfilerStorage:: |
|
MysqlProfilerStorage:: |
protected | function |
Initializes the database. Overrides PdoProfilerStorage:: |
|
PdoProfilerStorage:: |
protected | property | ||
PdoProfilerStorage:: |
protected | property | ||
PdoProfilerStorage:: |
protected | property | ||
PdoProfilerStorage:: |
protected | property | ||
PdoProfilerStorage:: |
protected | property | ||
PdoProfilerStorage:: |
protected | function | ||
PdoProfilerStorage:: |
protected | function | 1 | |
PdoProfilerStorage:: |
protected | function | ||
PdoProfilerStorage:: |
protected | function | 1 | |
PdoProfilerStorage:: |
protected | function | 1 | |
PdoProfilerStorage:: |
public | function |
Finds profiler tokens for the given criteria. Overrides ProfilerStorageInterface:: |
|
PdoProfilerStorage:: |
protected | function | Returns whether data for the given token already exists in storage. | |
PdoProfilerStorage:: |
protected | function | ||
PdoProfilerStorage:: |
public | function |
Purges all data from the database. Overrides ProfilerStorageInterface:: |
|
PdoProfilerStorage:: |
public | function |
Reads data associated with the given token. Overrides ProfilerStorageInterface:: |
|
PdoProfilerStorage:: |
protected | function | Reads the child profiles for the given token. | |
PdoProfilerStorage:: |
public | function |
Saves a Profile. Overrides ProfilerStorageInterface:: |
|
PdoProfilerStorage:: |
public | function | Constructor. |