3 require('../include/json-header.php');
7 exit_with_error('InvalidRequest');
11 exit_with_error('DatabaseConnectionFailure');
13 $task_id = array_get($_GET, 'task');
16 $triggerable = find_triggerable_for_task($db, $task_id);
18 exit_with_error('TriggerableNotFoundForTask', array('task' => $task_id));
19 $query['id'] = $triggerable['id'];
22 $id_to_triggerable = array();
23 foreach ($db->select_rows('build_triggerables', 'triggerable', $query) as $row) {
24 $id = $row['triggerable_id'];
25 $repositories = array();
26 $id_to_triggerable[$id] = array('id' => $id, 'name' => $row['triggerable_name'], 'acceptedRepositories' => &$repositories);
29 foreach ($db->select_rows('triggerable_repositories', 'trigrepo', array()) as $row) {
30 $triggerable = array_get($id_to_triggerable, $row['trigrepo_triggerable']);
32 array_push($triggerable['acceptedRepositories'], $row['trigrepo_repository']);
35 exit_with_success(array('triggerables' => array_values($id_to_triggerable)));
38 main(array_key_exists('PATH_INFO', $_SERVER) ? explode('/', trim($_SERVER['PATH_INFO'], '/')) : array());