mirror of
https://github.com/farmOS/farmOS.git
synced 2024-02-23 11:37:38 +01:00
Add support for log type, timestamp, and status filtering.
This commit is contained in:
parent
98bfa0a086
commit
b95962ad0b
1 changed files with 16 additions and 0 deletions
|
@ -48,6 +48,22 @@ class LogQueryFactory implements LogQueryFactoryInterface {
|
|||
// Add a tag.
|
||||
$query->addTag('farm.log_query');
|
||||
|
||||
// If a type is specified, only include logs of that type.
|
||||
if (isset($options['type'])) {
|
||||
$query->condition('type', $options['type']);
|
||||
}
|
||||
|
||||
// If a timestamp is specified, only include logs with a timestamp less than
|
||||
// or equal to it.
|
||||
if (isset($options['timestamp'])) {
|
||||
$query->condition('timestamp', $options['timestamp'], '<=');
|
||||
}
|
||||
|
||||
// If a status is specified, only include logs with that status.
|
||||
if (isset($options['status'])) {
|
||||
$query->condition('status', $options['status']);
|
||||
}
|
||||
|
||||
// Sort by timestamp and then log ID, descending.
|
||||
$query->sort('timestamp', 'DESC');
|
||||
$query->sort('id', 'DESC');
|
||||
|
|
Loading…
Reference in a new issue