mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-16 14:33:14 +00:00
en cours : silexing taskmanager
This commit is contained in:
@@ -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) {
|
||||
|
Reference in New Issue
Block a user