コード例 #1
0
 private function results_internal($resolve_ids)
 {
     if (!$this->rows) {
         return array();
     }
     $id_to_platform_name = array();
     if ($resolve_ids) {
         foreach ($this->db->select_rows('platforms', 'platform', array()) as $platform) {
             $id_to_platform_name[$platform['platform_id']] = $platform['platform_name'];
         }
     }
     $test_path_resolver = new TestPathResolver($this->db);
     $requests = array();
     foreach ($this->rows as $row) {
         $test_id = $row['request_test'];
         $platform_id = $row['request_platform'];
         $root_set_id = $row['request_root_set'];
         $this->fetch_roots_for_set_if_needed($root_set_id, $resolve_ids);
         array_push($requests, array('id' => $row['request_id'], 'triggerable' => $row['request_triggerable'], 'test' => $resolve_ids ? $test_path_resolver->path_for_test($test_id) : $test_id, 'platform' => $resolve_ids ? $id_to_platform_name[$platform_id] : $platform_id, 'testGroup' => $row['request_group'], 'order' => $row['request_order'], 'rootSet' => $root_set_id, 'status' => $row['request_status'], 'url' => $row['request_url'], 'build' => $row['request_build'], 'createdAt' => $row['request_created_at'] ? strtotime($row['request_created_at']) * 1000 : NULL));
     }
     return $requests;
 }
コード例 #2
0
ファイル: json-header.php プロジェクト: cheekiatng/webkit
function find_triggerable_for_task($db, $task_id)
{
    $task_id = intval($task_id);
    $test_rows = $db->query_and_fetch_all('SELECT metric_test AS "test", task_platform as "platform"
        FROM analysis_tasks JOIN test_metrics ON task_metric = metric_id WHERE task_id = $1', array($task_id));
    if (!$test_rows) {
        return NULL;
    }
    $target_test_id = $test_rows[0]['test'];
    $platform_id = $test_rows[0]['platform'];
    $path_resolver = new TestPathResolver($db);
    $test_ids = $path_resolver->ancestors_for_test($target_test_id);
    $results = $db->query_and_fetch_all('SELECT trigconfig_triggerable AS "triggerable", trigconfig_test AS "test"
        FROM triggerable_configurations WHERE trigconfig_platform = $1 AND trigconfig_test = ANY($2)', array($platform_id, '{' . implode(', ', $test_ids) . '}'));
    if (!$results) {
        return NULL;
    }
    $test_to_triggerable = array();
    foreach ($results as $row) {
        $test_to_triggerable[$row['test']] = $row['triggerable'];
    }
    foreach ($test_ids as $test_id) {
        $triggerable = array_get($test_to_triggerable, $test_id);
        if ($triggerable) {
            return array('id' => $triggerable, 'test' => $test_id, 'platform' => $platform_id);
        }
    }
    return NULL;
}