Moving SQL into classes
parent
bf197ae96b
commit
d854473a06
|
@ -21,15 +21,29 @@ class Component {
|
|||
if (empty($until_time)) {
|
||||
$until_time = '9999-12-31';
|
||||
}
|
||||
|
||||
// this is needed for compatibility with the bash version, so we use '%s' placeholders
|
||||
$from_time = htmlspecialchars(strip_tags($from_time));
|
||||
$until_time = htmlspecialchars(strip_tags($until_time));
|
||||
$sql = $this->queries['jitsi_components'];
|
||||
$sql = sprintf($sql, $jitsi_component, $component_id, $from_time, $until_time);
|
||||
|
||||
// list of jitsi component events
|
||||
$sql = 'SELECT jitsi_component, loglevel, time, component_id, event_type, event_param
|
||||
FROM
|
||||
jitsi_components
|
||||
WHERE
|
||||
jitsi_component = :jitsi_component
|
||||
AND
|
||||
component_id = :component_id
|
||||
AND
|
||||
(time >= :from_time AND time <= :until_time)
|
||||
ORDER BY
|
||||
time';
|
||||
|
||||
$query = $this->db->prepare($sql);
|
||||
$query->execute();
|
||||
$query->execute([
|
||||
':jitsi_component' => $jitsi_component,
|
||||
':component_id' => $component_id,
|
||||
':from_time' => $from_time . ' 00:00:00',
|
||||
':until_time' => $until_time . ' 23:59:59',
|
||||
]);
|
||||
|
||||
return $query->fetchAll(PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
|
|
@ -397,22 +397,6 @@ AND (event_time >= '%s 00:00:00' AND event_time <= '%s 23:59:59')
|
|||
ORDER BY
|
||||
pe.time;",
|
||||
|
||||
|
||||
// list of jitsi component events
|
||||
'jitsi_components' => "
|
||||
SELECT jitsi_component, loglevel, time, component_id, event_type, event_param
|
||||
FROM
|
||||
jitsi_components
|
||||
WHERE
|
||||
jitsi_component = %s
|
||||
AND
|
||||
component_id = %s
|
||||
AND
|
||||
(time >= '%s 00:00:00' AND time <= '%s 23:59:59')
|
||||
ORDER BY
|
||||
time;",
|
||||
|
||||
|
||||
];
|
||||
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue