$i++; } $error_response['arguments'] = $arguments_response; get_labels_JSON_from_query_results("SELECT text FROM label, label2buildfailure\n WHERE label.id=label2buildfailure.labelid AND\n label2buildfailure.buildfailureid='{$buildfailureid}'\n ORDER BY text ASC", $error_response); $stderror = $error_array['stderror']; $stdoutput = $error_array['stdoutput']; if (isset($error_array['sourcefile'])) { $projectCvsUrl = $project_array['cvsurl']; $file = basename($error_array['sourcefile']); $directory = dirname($error_array['sourcefile']); $cvsurl = get_diff_url($projectid, $projectCvsUrl, $directory, $file, $revision); $error_response['cvsurl'] = $cvsurl; $source_dir = get_source_dir($projectid, $projectCvsUrl, $directory); if ($source_dir !== NULL) { $stderror = linkify_compiler_output($projectCvsUrl, $source_dir, $revision, $stderror); $stdoutput = linkify_compiler_output($projectCvsUrl, $source_dir, $revision, $stdoutput); } } if ($stderror) { $error_response['stderror'] = $stderror; } if ($stdoutput) { $error_response['stdoutput'] = $stdoutput; } $error_response['exitcondition'] = $error_array['exitcondition']; $errorid++; $errors_response[] = $error_response; } } // end if onlydeltan $response['errors'] = $errors_response;
/** * Marshals the data of a particular build error into a serializable * friendly format. * * Requires the $data of a build error, the $project, and the buildupdate.revision. **/ public static function marshal($data, $project, $revision) { // Sets up access to $file and $directory extract(self::GetSourceFile($data)); $marshaled = array('new' => isset($data['newstatus']) ? $data['newstatus'] : -1, 'logline' => $data['logline'], 'cvsurl' => get_diff_url($project['id'], $project['cvsurl'], $directory, $file, $revision)); $marshaled = array_merge($marshaled, array('precontext' => linkify_compiler_output($marshaled['cvsurl'], "/\\.\\.\\.", $revision, $data['precontext']), 'text' => linkify_compiler_output($marshaled['cvsurl'], "/\\.\\.\\.", $revision, $data['text']), 'postcontext' => linkify_compiler_output($marshaled['cvsurl'], "/\\.\\.\\.", $revision, $data['postcontext']), 'sourcefile' => $data['sourcefile'], 'sourceline' => $data['sourceline'])); if (isset($data['subprojectid'])) { $marshaled['subprojectid'] = $data['subprojectid']; $marshaled['subprojectname'] = $data['subprojectname']; } return $marshaled; }
/** * Marshal a build failure, this includes the build failure arguments. **/ public static function marshal($data, $project, $revision, $linkifyOutput = false) { $marshaled = array_merge(array('language' => $data['language'], 'sourcefile' => $data['sourcefile'], 'targetname' => $data['targetname'], 'outputfile' => $data['outputfile'], 'outputtype' => $data['outputtype'], 'workingdirectory' => $data['workingdirectory'], 'exitcondition' => $data['exitcondition']), self::GetBuildFailureArguments($data['id'])); $marshaled['stderror'] = $data['stderror']; $marshaled['stdoutput'] = $data['stdoutput']; if (isset($data['sourcefile'])) { $file = basename($data['sourcefile']); $directory = dirname($data['sourcefile']); $marshaled['cvsurl'] = get_diff_url($project['id'], $project['cvsurl'], $directory, $file, $revision); $source_dir = get_source_dir($project['id'], $project['cvsurl'], $directory); if ($source_dir !== null && $linkifyOutput) { $marshaled['stderror'] = linkify_compiler_output($project['cvsurl'], $source_dir, $revision, $data['stderror']); $marshaled['stdoutput'] = linkify_compiler_output($project['cvsurl'], $source_dir, $revision, $data['stdoutput']); } } if (isset($data['subprojectid'])) { $marshaled['subprojectid'] = $data['subprojectid']; $marshaled['subprojectname'] = $data['subprojectname']; } return $marshaled; }