| <?php |
| /******************************************************************************* |
| * Copyright (c) 2010 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: |
| * Wayne Beaton - initial API and implementation |
| *******************************************************************************/ |
| |
| //ini_set('memory_limit', '80M'); |
| |
| require_once($_SERVER['DOCUMENT_ROOT'] . "/projects/classes/common.php"); |
| require_once($_SERVER['DOCUMENT_ROOT'] . "/projects/classes/debug.php"); |
| trace_file_info(__FILE__); |
| |
| 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(); |
| |
| $App->setOutdated(); |
| |
| login_committer(); |
| |
| include($App->getProjectCommon()); |
| |
| require_once($_SERVER['DOCUMENT_ROOT'] . "/projects/classes/Project.class.php"); |
| require_once($_SERVER['DOCUMENT_ROOT'] . "/projects/classes/Bug.class.php"); |
| |
| ob_start(); |
| |
| /* |
| * Obtain the project id. Make sure that the provided id at least looks like a project id. |
| * If it does not, replace it with a known project. |
| * TODO What do we do if the id is valid in form, but otherwise bogus? |
| */ |
| $projectid = $App->getHttpParameter('id'); |
| if (!preg_match('/^[a-zA-Z0-9]+(.[a-zA-Z0-9]+)*$/', $projectid) > 0) { |
| $projectid = 'technology.examples'; |
| } |
| |
| $pageKeywords = ""; |
| $pageTitle = "IP Contribution Review for $projectid"; |
| $pageAuthor = "Wayne Beaton"; |
| ?> |
| |
| <div id="midcolumn"> |
| <div class="homeitem"> |
| <h1><?= $pageTitle ?></h1> |
| |
| <p>This tool scans Bugzilla for information about contributions |
| to your project. Contributions that have been accepted into your |
| project's code base that have been provided by people who are not |
| committers on your project need to be accounted for in your |
| <a href="http://wiki.eclipse.org/Development_Resources/IP_Log">IP Log</a>. |
| Marking these contributions as iplog+ will ensure that they are |
| included in the automated IP Log tools.</p> |
| |
| <?php |
| /* |
| * TODO This form should be abstracted out and made reusable. |
| */ |
| ?> |
| |
| <form method="get"> |
| <?php |
| foreach ($_GET as $key => $value) { |
| if ($key == 'id') continue; |
| echo "<input type=\"hidden\" name=\"$key\" value=\"$value\""; |
| } |
| ?> |
| <p>Select a project: |
| <select name="id"> |
| <?php |
| function generate_project_selections($projects, $depth=0) { |
| global $projectid; |
| |
| foreach($projects as $project) { |
| if ($project->isComponent()) continue; |
| $id = $project->getId(); |
| $name = $project->getName(); |
| $selected = $id == $projectid ? ' selected="true"' : ''; |
| for($count=0;$count<$depth;$count++) $name = " $name"; |
| echo "<option value=\"$id\"$selected>$name</OPTION>"; |
| generate_project_selections($project->getChildren(), $depth+1); |
| } |
| } |
| generate_project_selections(Project::getTopLevelProjects()); |
| ?> |
| </select> |
| <input type="submit" value="Go!"/> |
| </p> |
| </form> |
| <?php |
| |
| /* |
| * Can optionally provide a list of bug ids. These bugs will displayed |
| * in a separate section of the output document. This allows the reader |
| * to focus their attention on a specific subset of the bugs. |
| */ |
| |
| $under_focus_bug_ids = array(); |
| if (isset($_GET['bugs'])) { |
| $rawBugs = preg_split('/\D+/', $_GET['bugs']); |
| foreach($rawBugs as $bug) { |
| $bug = trim($bug); |
| if (preg_match('/^\d*$/', $bug)) $under_focus_bug_ids[] = $bug; |
| } |
| if (isset($_GET['debug'])) echo "<p>Focus on bug ids: " . implode(',', $under_focus_bug_ids) . "<p>"; |
| } |
| |
| |
| $committers = find_committers($projectid); |
| $bugs = find_bugs($projectid, $committers); |
| |
| $under_focus = array(); |
| $bug_and_attachment_flagged = array(); |
| $bug_flagged = array(); |
| $attachment_flagged = array(); |
| $no_patch = array(); |
| $single_patch = array(); |
| $single_contributor = array(); |
| $others = array(); |
| |
| $recommendations = array(); |
| |
| foreach ($bugs as $bug) { |
| if (in_array($bug->bug_id, $under_focus_bug_ids)) { |
| $under_focus[] = $bug; |
| } else if ($bug->has_iplog_flag()) { |
| if ($bug->has_iplog_patch()) { |
| $bug_and_attachment_flagged[] = $bug; |
| } else { |
| $bug_flagged[] = $bug; |
| } |
| } else if ($bug->has_iplog_patch()) { |
| $attachment_flagged[] = $bug; |
| } else if ($bug->has_no_patch()) { |
| $no_patch[] = $bug; |
| } else if ($bug->has_single_patch()) { |
| $single_patch[] = $bug; |
| } else if ($bug->all_patches_from_same_contributor()) { |
| $single_contributor[] = $bug; |
| } else { |
| $others[] = $bug; |
| } |
| $bug->add_recommendations($recommendations); |
| } |
| |
| echo "<p>Attachments that are <strike>crossed-out</strike> were contributed by a committer. More specifically, |
| the contributor was a committer at the time of the contribution. Clicking the links on this page |
| will open a new browser tab.</p>"; |
| |
| echo "<h2>Contents</h2>"; |
| echo "<ul>"; |
| echo "<li><a href=\"#recommendations\">Recommendations</a></li>"; |
| echo "<li><a href=\"#focus\">Bugs that you requested we focus on</a></li>"; |
| echo "<li><a href=\"#flagged_bugs_with_flagged_attachments\">Bugs flagged with iplog+ with attachment(s) flagged with iplog+</a></li>"; |
| echo "<li><a href=\"#flagged_bugs\">Bugs flagged with iplog+</a></li>"; |
| echo "<li><a href=\"#flagged_attachments\">Bugs with attachments flagged with iplog+</a></li>"; |
| echo "<li><a href=\"#no_patches\">Bugs with no patches</a></li>"; |
| echo "<li><a href=\"#single_patch\">Bugs with a single patch</a></li>"; |
| echo "<li><a href=\"#single_contributor\">Bugs with a single contributor</a></li>"; |
| echo "<li><a href=\"#other\">Other Bugs</a></li>"; |
| echo "</ul>"; |
| |
| |
| //echo "<h2>Committers</h2>"; |
| //echo "<p>Attachments created while the contributor was a committer are <strike>crossed-out</strike>.<p>"; |
| //dump_committers($committers); |
| |
| |
| echo "<a name=\"recommendations\"></a><h2>Recommendations</h2>"; |
| if (!$recommendations) echo "<p>No recommendations.</p>"; |
| else { |
| echo "<p>We recommend that you make the following changes. Note that these recommendations |
| have been automatically generated and may in fact be totally bogus. Ultimately, we leave |
| it to your experience and discretion to do the right thing. If you need help, check |
| with your project mentors (if incubating), your PMC, or the EMO.</p>"; |
| foreach($recommendations as $recommendation) { |
| echo "<p>" . $recommendation->get_html_string() . "</p>"; |
| } |
| } |
| |
| echo "<a name=\"focus\"></a><h2>Bugs that you requested we focus on</h2>"; |
| echo "<p>These bugs were identified in the request as bugs you want to isolate. Note that you can |
| populate this section by adding bugs=12345,23345,... to the URL, or by typing/pasting the ids |
| of the bugs you're interested in below (separated by commas, spaces, or anything that's not a digit, really).<p>"; |
| |
| echo " |
| <form action=\"iplog_review.php\" method=\"get\"> |
| <input type=\"hidden\" name=\"id\" value=\"$projectid\"/> |
| <input type=\"text\" name=\"bugs\" size=\"50\" value=\"" . implode(',', $under_focus_bug_ids) ."\"/> |
| <input type=\"submit\" value=\"Go!\"/> |
| </form>"; |
| |
| dump_bugs($under_focus); |
| |
| echo "<a name=\"flagged_bugs_with_flagged_attachments\"></a><h2>Bugs flagged with iplog+ with attachment(s) flagged with iplog+</h2>"; |
| echo "<p>These bugs are themselves flagged with iplog+ and have one or more attachments that are also flagged |
| with iplog+. <strong>This is not a recommended practice.</strong> Generally-speaking, if any |
| attachment is flagged iplog+, then the bug should not have to be similarly flagged.<p>"; |
| dump_bugs($bug_and_attachment_flagged); |
| |
| echo "<a name=\"flagged_bugs\"></a><h2>Bugs flagged with iplog+</h2>"; |
| echo "<p>These bugs are themselves flagged with iplog+. <strong>This is not a recommended practice.</strong> By flagging |
| a bug as iplog+, you are indicating that the summary and/or one or more of the comments includes |
| intellectual property that has been committed to the project's source code repository. The problem |
| with flagging the bug itself is that all comments added to the bug are considered to be potential |
| IP, regardless of when those comments are created.<p>"; |
| dump_bugs($bug_flagged); |
| |
| echo "<a name=\"flagged_attachments\"></a><h2>Bugs with attachments flagged with iplog+</h2>"; |
| echo "<p>These bugs are probably in good shape.<p>"; |
| dump_bugs($attachment_flagged); |
| |
| echo "<a name=\"no_patches\"></a><h2>Bugs with no patches</h2>"; |
| echo "<p>Intellectual property may be contained in the summary or one of the |
| comments on this bug.<p>"; |
| dump_bugs($no_patch); |
| |
| echo "<a name=\"single_patch\"></a><h2>Bugs with a single patch</h2>"; |
| echo "<p>The single patch attachment (contributed by a non-committer) is a likely candidate to be flagged iplog+.<p>"; |
| dump_bugs($single_patch); |
| |
| echo "<a name=\"single_contributor\"></a><h2>Bugs with a single contributor</h2>"; |
| echo "<p>These bugs have several patches from a single contributor (who is not a committer); |
| we may be able to assume that the last patch is the one that should be marked iplog+.</p>"; |
| dump_bugs($single_contributor); |
| |
| echo "<a name=\"other\"></a><h2>Other Bugs</h2>"; |
| echo "<p>These bugs may contain attachments that can be flagged iplog+. But it's hard to know for sure.<p>"; |
| dump_bugs($others); |
| |
| echo get_trace_html(); |
| |
| echo "</div>"; |
| echo "</div>"; |
| |
| $html = ob_get_contents(); |
| ob_end_clean(); |
| $App->generatePage($theme, $Menu, $Nav, $pageAuthor, $pageKeywords, $pageTitle, $html); |
| ?> |