protected function DatabaseAggregatorSensorPlugin::getQuery in Monitoring 8
Builds the query for verbose output.
Similar to the aggregate query, but without aggregation.
Return value
\Drupal\Core\Database\Query\Select The select query object.
See also
\Drupal\monitoring\Plugin\monitoring\SensorPlugin\DatabaseAggregatorSensorPlugin::getAggregateQuery()
5 calls to DatabaseAggregatorSensorPlugin::getQuery()
- DatabaseAggregatorSensorPlugin::verboseResultUnaggregated in src/
Plugin/ monitoring/ SensorPlugin/ DatabaseAggregatorSensorPlugin.php - Adds unaggregated verbose output to the render array $output.
- Dblog404SensorPlugin::getQuery in src/
Plugin/ monitoring/ SensorPlugin/ Dblog404SensorPlugin.php - Builds the query for verbose output.
- PhpNoticesSensorPlugin::getQuery in src/
Plugin/ monitoring/ SensorPlugin/ PhpNoticesSensorPlugin.php - Builds the query for verbose output.
- Redirect404SensorPlugin::getQuery in src/
Plugin/ monitoring/ SensorPlugin/ Redirect404SensorPlugin.php - Builds the query for verbose output.
- TemporaryFilesUsagesSensorPlugin::getQuery in src/
Plugin/ monitoring/ SensorPlugin/ TemporaryFilesUsagesSensorPlugin.php - Builds the query for verbose output.
4 methods override DatabaseAggregatorSensorPlugin::getQuery()
- Dblog404SensorPlugin::getQuery in src/
Plugin/ monitoring/ SensorPlugin/ Dblog404SensorPlugin.php - Builds the query for verbose output.
- PhpNoticesSensorPlugin::getQuery in src/
Plugin/ monitoring/ SensorPlugin/ PhpNoticesSensorPlugin.php - Builds the query for verbose output.
- Redirect404SensorPlugin::getQuery in src/
Plugin/ monitoring/ SensorPlugin/ Redirect404SensorPlugin.php - Builds the query for verbose output.
- TemporaryFilesUsagesSensorPlugin::getQuery in src/
Plugin/ monitoring/ SensorPlugin/ TemporaryFilesUsagesSensorPlugin.php - Builds the query for verbose output.
File
- src/
Plugin/ monitoring/ SensorPlugin/ DatabaseAggregatorSensorPlugin.php, line 153 - Contains \Drupal\monitoring\Plugin\monitoring\SensorPlugin\DatabaseAggregatorSensorPlugin.
Class
- DatabaseAggregatorSensorPlugin
- Database aggregator able to query a single db table.
Namespace
Drupal\monitoring\Plugin\monitoring\SensorPluginCode
protected function getQuery() {
/* @var \Drupal\Core\Database\Connection $database */
$database = $this
->getService('database');
// Get query for the table.
$query = $database
->select($this->sensorConfig
->getSetting('table'));
// Add conditions.
foreach ($this
->getConditions() as $condition) {
$this
->translateCondition($condition, $query);
$query
->condition($condition['field'], $condition['value'], isset($condition['operator']) ? $condition['operator'] : NULL);
}
// Apply time interval on field.
if ($this
->getTimeIntervalField() && $this
->getTimeIntervalValue()) {
$query
->condition($this
->getTimeIntervalField(), \Drupal::time()
->getRequestTime() - $this
->getTimeIntervalValue(), '>');
}
// Add key fields.
$fields = $this->sensorConfig
->getSetting('verbose_fields');
if (!empty($fields)) {
foreach ($fields as $field) {
$query
->addField($this->sensorConfig
->getSetting('table'), $field);
}
}
if ($this
->getTimeIntervalField()) {
$query
->orderBy($this
->getTimeIntervalField(), 'DESC');
}
return $query;
}