public function DatabaseProfilerStorage::find in Devel 8.3
Same name and namespace in other branches
- 8 webprofiler/src/Profiler/DatabaseProfilerStorage.php \Drupal\webprofiler\Profiler\DatabaseProfilerStorage::find()
- 8.2 webprofiler/src/Profiler/DatabaseProfilerStorage.php \Drupal\webprofiler\Profiler\DatabaseProfilerStorage::find()
- 4.x webprofiler/src/Profiler/DatabaseProfilerStorage.php \Drupal\webprofiler\Profiler\DatabaseProfilerStorage::find()
File
- webprofiler/
src/ Profiler/ DatabaseProfilerStorage.php, line 34
Class
- DatabaseProfilerStorage
- Implements a profiler storage using the DBTNG query api.
Namespace
Drupal\webprofiler\ProfilerCode
public function find($ip, $url, $limit, $method, $start = NULL, $end = NULL) : array {
$select = $this->database
->select('webprofiler', 'wp', [
'fetch' => \PDO::FETCH_ASSOC,
]);
if (NULL === $start) {
$start = 0;
}
if (NULL === $end) {
$end = time();
}
if ($ip = preg_replace('/[^\\d\\.]/', '', $ip)) {
$select
->condition('ip', '%' . $this->database
->escapeLike($ip) . '%', 'LIKE');
}
if ($url) {
$select
->condition('url', '%' . $this->database
->escapeLike(addcslashes($url, '%_\\')) . '%', 'LIKE');
}
if ($method) {
$select
->condition('method', $method);
}
if (!empty($start)) {
$select
->condition('time', $start, '>=');
}
if (!empty($end)) {
$select
->condition('time', $end, '<=');
}
$select
->fields('wp', [
'token',
'ip',
'method',
'url',
'time',
'parent',
'status_code',
]);
$select
->orderBy('time', 'DESC');
$select
->range(0, $limit);
return $select
->execute()
->fetchAllAssoc('token');
}