en cours : silexing taskmanager

This commit is contained in:
jygaulier
2012-07-19 17:37:51 +02:00
parent 70f64da8d1
commit be24152468
8 changed files with 263 additions and 0 deletions

View File

@@ -33,6 +33,38 @@ class task_manager
return $this;
}
/**
* status of scheduler and tasks
* used do refresh the taskmanager page
*
* @return array
*/
public function toArray()
{
$ret = array(
'time' => date("H:i:s"),
'scheduler' => $this->getSchedulerState(),
'tasks' => array()
);
foreach ($this->getTasks(true) as $task) {
if ($task->getState() == self::STATE_TOSTOP && $task->getPID() === NULL) {
// fix
$task->setState(self::STATE_STOPPED);
}
$id = $task->getID();
$ret['tasks'][$id] = array(
'id' => $id,
'pid' => $task->getPID(),
'crashed' => $task->getCrashCounter(),
'completed' => $task->getCompletedPercentage(),
'status' => $task->getState()
);
}
return $ret;
}
public function getTasks($refresh = false, Logger $logger = null)
{
if ($this->tasks && ! $refresh) {