summaryrefslogblamecommitdiffstats
path: root/apis/taskmanager.inc.php
blob: 8365aac7f2b952d3a7e69c98ee5f4e151336f90c (plain) (tree)
1
2
3
4


                                       
                                    


















                                                                                                                                     
<?php

require_once 'inc/taskmanager.inc.php';
require_once 'inc/property.inc.php';

if (!is_array($_POST['ids'])) {
	die('{"error" : "No Task ids given in POST data."}');
}

$return = array();
foreach ($_POST['ids'] as $id) {
	$status = Taskmanager::status($id);
	if ($status === false) {
		$return[] = array('id' => $id, 'error' => 'No connection to TaskManager');
		continue;
	}
	$return[] = $status;
	if (!isset($status['statusCode']) || ($status['statusCode'] !== TASK_WAITING && $status['statusCode'] !== TASK_PROCESSING)) {
		Taskmanager::release($id);
	}
}

echo json_encode(array('tasks' => $return));