Exemplo n.º 1
0
 public static function createOutOfOrder($machine_id, $mode_id, $revision, $run_before_id, $run_after_id)
 {
     $run_before = new Run($run_before_id);
     $run_after = new Run($run_after_id);
     // Find the sorting order where we could add this revision;
     $sort_order = RunReporter::findSortOrder($run_before, $mode_id, $revision);
     // Get the approx stamp of the run with the sort_order before the one we are replacing.
     $old_run = Run::withMachineAndSortOrder($machine_id, $sort_order - 1);
     $approx_stamp = $old_run->approx_stamp();
     // sanity check.
     RunReporter::assertInBound($run_before, $run_after, $mode_id, $sort_order);
     // Create a space at the given sort_order, by shifting all sort_order,
     // equal or higher than the given sort_order.
     RunReporter::increaseNextSortOrder($machine_id, $sort_order);
     $run = Run::insert($machine_id, $sort_order, $approx_stamp);
     $run->updateInt("out_of_order", 1);
     $build = Build::insert($run, $mode_id, $revision);
     return $run;
 }