Fix #865 : add route in API for scheduler infos

This commit is contained in:
Romain Neutron
2012-08-29 16:15:53 +02:00
parent d44c6fe6b3
commit def3a2b293
4 changed files with 97 additions and 2 deletions

View File

@@ -119,6 +119,7 @@ class task_manager
$appbox = appbox::get_instance(\bootstrap::getCore());
$sql = "SELECT UNIX_TIMESTAMP()-UNIX_TIMESTAMP(schedqtime) AS qdelay
, schedqtime AS updated_on
, schedstatus AS status FROM sitepreff";
$stmt = $this->appbox->get_connection()->prepare($sql);
$stmt->execute();
@@ -139,6 +140,12 @@ class task_manager
fclose($schedlock);
}
if ($ret['updated_on'] == '0000-00-00 00:00:00') {
$ret['updated_on'] = null;
} else {
$ret['updated_on'] = new \DateTime($ret['updated_on']);
}
if ($pid === NULL && $ret['status'] !== 'stopped') {
// auto fix
$this->appbox->get_connection()->exec('UPDATE sitepreff SET schedstatus=\'stopped\'');