Update DB.php
This commit is contained in:
parent
a49f577dae
commit
a0fd4aea60
1 changed files with 16 additions and 5 deletions
13
web/DB.php
13
web/DB.php
|
@ -34,11 +34,22 @@ class DB {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function get_all_tasks() {
|
public function get_all_tasks($status = null) {
|
||||||
|
if (is_null($status)) {
|
||||||
$query = '
|
$query = '
|
||||||
SELECT id, host, type, params, creation_date, frequency, last_execution, active
|
SELECT id, host, type, params, creation_date, frequency, last_execution, active
|
||||||
FROM tasks
|
FROM tasks
|
||||||
';
|
';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$query = '
|
||||||
|
SELECT DISTINCT t.id, t.host, t.type, t.params, t.creation_date, t.last_execution, t.active
|
||||||
|
FROM tasks as t
|
||||||
|
JOIN tasks_history as h ON (h.task_id = t.id)
|
||||||
|
WHERE h.status = '.intval($status).' AND h.datetime = t.last_execution
|
||||||
|
';
|
||||||
|
}
|
||||||
|
|
||||||
return $this->query($query);
|
return $this->query($query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue