| <?php require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/app.class.php"); require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/nav.class.php"); require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/menu.class.php"); $App = new App(); $Nav = new Nav(); $Menu = new Menu(); include($App->getProjectCommon()); # All on the same line to unclutter the user's desktop' | |
| /******************************************************************************* | |
| * Copyright (c) 2009 Eclipse Foundation and others. | |
| * All rights reserved. This program and the accompanying materials | |
| * are made available under the terms of the Eclipse Public License v1.0 | |
| * which accompanies this distribution, and is available at | |
| * http://www.eclipse.org/legal/epl-v10.html | |
| * | |
| * Contributors: | |
| * Eclipse Foundation- initial API and implementation | |
| *******************************************************************************/ | |
| /*================================================= | |
| * C O M M I T T E R S | |
| */ | |
| /* | |
| * Step 1: | |
| * Find ALL the past and present committers on this project | |
| * complete with their current employer's name | |
| */ | |
| function dump_project_committers(&$projectids) { | |
| global $App; | |
| $all_committers_in_db = array(); | |
| $sql = " | |
| SELECT DISTINCT(People.PersonID) as PID, FName, LName, Name1, Name2, | |
| PeopleProjects.InactiveDate is NULL as Active | |
| FROM PeopleProjects, Projects, People | |
| LEFT JOIN OrganizationContacts | |
| ON OrganizationContacts.PersonID = People.PersonID | |
| LEFT JOIN Organizations | |
| ON OrganizationContacts.OrganizationID = Organizations.OrganizationID | |
| WHERE PeopleProjects.Relation in ('CM') | |
| AND People.PersonID = PeopleProjects.PersonID | |
| AND Projects.ProjectID = PeopleProjects.ProjectID | |
| AND ( | |
| Projects.ProjectID IN ( '" . implode( "','", $projectids ) . "' ) | |
| OR ( | |
| ParentProjectID IN ( '" . implode( "','", $projectids ) . "' ) | |
| AND IsComponent = 1) | |
| ) | |
| ORDER BY LName, FName"; | |
| $result = $App->foundation_sql( $sql ); | |
| //mysql_error_check(); | |
| while( $row = mysql_fetch_assoc($result) ) { | |
| $row['Comment'] = ''; | |
| $all_committers_in_db[ $row['PID'] ] = $row; | |
| } | |
| /* | |
| * Step 2: | |
| * Get the commits activity to figure out everyone who | |
| * ever committed code to the project. | |
| */ | |
| $blob = file("http://dash.eclipse.org/dash/commits/web-api/commits-index.php?projectid=" . implode(',', $projectids) ); | |
| $cm_counts = array(); | |
| foreach( $blob as $line ) { | |
| $words = split( "\t", $line ); | |
| if( substr($words[0],0,1) == '#' ) // skip comments | |
| continue; | |
| if( $words[2] == 999999 ) // only use the 'inf' records | |
| // WTB Only add if the person is actually a committer on the project. | |
| if (isset($all_committers_in_db[$words[0]])) | |
| $cm_counts[$words[0]] = $words[1]; | |
| } | |
| /* | |
| * Step 4: | |
| * Compute three lists: committers who once committed code | |
| * and committers who appear never to have committed any code | |
| * and committers who have been excluded | |
| */ | |
| $committers_at_least_once = array(); | |
| $committers_never = array(); | |
| foreach( $all_committers_in_db as $key => $row ) { | |
| if( isset($cm_counts[$key]) ) { | |
| $committers_at_least_once[$key] = $row; | |
| } else { | |
| $committers_never[$key] = $row; | |
| } | |
| } | |
| foreach( $cm_counts as $key => $row ) { | |
| if( !isset($all_committers_in_db[$key] ) ) { | |
| $committers_at_least_once[$key] = | |
| array( 'PID' => $key, | |
| 'FName' => '', // WTB Previously used the pid for FName. Feels wrong. | |
| 'LName' => '', | |
| 'Name1' => '', // WTB Removed '(Not a current committer)'. Seems silly. | |
| 'Name2' => '', | |
| 'Active' => '0'); | |
| } | |
| } | |
| /* | |
| * Step 5: | |
| * Sort the lists | |
| */ | |
| foreach($committers_at_least_once as $committer) { | |
| dump_committer($committer, true); | |
| } | |
| foreach($committers_never as $committer) { | |
| dump_committer($committer, false); | |
| } | |
| } | |
| function dump_committer(&$committer, $hasCommits) { | |
| $id = $committer['PID']; | |
| $first = htmlentities($committer['FName'], ENT_COMPAT | ENT_XML1); | |
| $last = htmlentities($committer['LName'], ENT_COMPAT | ENT_XML1); | |
| $name1 = htmlentities($committer['Name1'], ENT_COMPAT | ENT_XML1); | |
| $name2 = htmlentities($committer['Name2'], ENT_COMPAT | ENT_XML1); | |
| $active = $committer['Active'] ? 'true' : 'false'; | |
| $commits = $hasCommits ? 'true' : 'false'; | |
| echo "<iplog:committer id=\"$id\" firstName=\"$first\" lastName=\"$last\" affiliation=\"$name1\" active=\"$active\" hasCommits=\"$commits\"/>\n"; | |
| } | |
| ?> |