public function project_page($ctl) { if (empty($_REQUEST['p'])) { $ctl->redirect('list.php'); } $projects = $ctl->stage->get_projects_from_param($_REQUEST['p']); $projects_lookup = array_flip((array) $_REQUEST['p']); ### Read Command output $previous_command = $this->read_previous_command($ctl); ### Load for each project $locally_modified = false; $project_data = array(); foreach ($projects as $project) { ### Load and parse the file list $file_tags = $project->get_file_tags(); $files = $project->get_affected_files(); $project_data[$project->project_name]['project'] = $project; $project_data[$project->project_name]['file_lines'] = array(); foreach ($files as $file) { $file_line = array('file' => $file); ### Get Current Version $file_line['cur_vers'] = delayed_load_span(array($file), create_function('$file', now_doc('DELAY'))); ### Get PROD_SAFE Version $file_line['prod_safe_vers'] = delayed_load_span(array($file), create_function('$file', now_doc('DELAY'))); ### Get PROD_TEST Version $file_line['prod_test_vers'] = delayed_load_span(array($file), create_function('$file', now_doc('DELAY'))); ### Get HEAD Version $file_line['head_vers'] = delayed_load_span(array($file, $project, $file_tags), create_function('$file,$project,$file_tags', now_doc('DELAY'))); ### Do Target $file_line['target_vers'] = delayed_load_span(array($file, $project), create_function('$file,$project', now_doc('DELAY'))); ### Changes by $file_line['changes_by'] = delayed_load_span(array($file, $project), create_function('$file,$project', now_doc('DELAY'))); ### Actions $file_line['actions'] = delayed_load_span(array($file, $project), create_function('$file,$project', now_doc('DELAY'))); ### Other Projects Sharing files $other_projects = array(); foreach ($ctl->stage->get_projects() as $pname) { if (empty($pname) || $pname == $project->project_name) { continue; } $other_project = new Ansible__Project($pname, $ctl->stage, false); if (!in_array($other_project->get_group(), array('00_none', '01_staging', '03_testing_done', '04_prod_rollout_prep'))) { continue; } foreach ($files as $our_file) { foreach ($other_project->get_affected_files() as $their_file) { if ($our_file == $their_file) { if (!isset($other_projects[$pname])) { $other_projects[$pname] = array('data' => array('project' => $other_project, 'included' => isset($projects_lookup[$other_project->project_name]), 'remove_project_url' => $ctl->stage->get_projects_url($projects, $other_project->project_name))); } $other_projects[$pname][] = $their_file; } } } } $project_data[$project->project_name]['other_projects'] = $other_projects; $project_data[$project->project_name]['remove_project_url'] = $ctl->stage->get_projects_url($projects, $project->project_name); $project_data[$project->project_name]['files'][] = $file_line; } } /// Find all rollback points that include ALL of these projects require_once dirname(__FILE__) . '/../model/RollPoint.class.php'; $proj_join = array(); foreach ($projects as $p) { $proj_join[$p->project_name] = $ctl->stage->dbh()->quote($p->project_name); } $roll_points = Ansible__RollPoint::get_where(array("(SELECT COUNT(*) FROM rlpt_project r WHERE roll_point.rlpt_id = r.rlpt_id AND r.project IN (" . join(',', $proj_join) . " )) == " . count($proj_join), "(SELECT COUNT(*) FROM rlpt_project r WHERE roll_point.rlpt_id = r.rlpt_id ) == " . count($proj_join)), false, 'creation_date DESC'); return array('project_data' => $project_data, 'previous_command' => $previous_command, 'locally_modified' => $locally_modified, 'project_url_params' => $ctl->stage->get_projects_url($projects), 'roll_points' => $roll_points); }