Exemple #1
0
function checkProject($projectNumber, $component, $includes)
{
    global $dbc;
    global $dbh;
    global $rs;
    global $debug_count;
    global $committerList;
    global $exclusions;
    global $uniqueCount;
    global $uniqueNames;
    $buglist = array();
    $sql_info = "SELECT  bugs.bug_id as bug_id,\n\t\tbugs.bug_status as bug_status,\n\t\tbugs.resolution as bug_resolution,\n\t\tbugs.target_milestone as bug_target_milestone,\n\t\tattachments.filename as filename,\n\t\tattachments.ispatch as ispatch,\n        attachments.creation_ts as timestamp,\n\t\tattachmentProfiles.login_name as attachment_login_name,\n        attachmentProfiles.realname as attachment_real_name,\n        committerProfiles.realname as committer_real_name,\n        attach_data.thedata as thedata,\n\t\tbugs.keywords as bug_keywords,\n\t\tbugs.component_id as component_id\n    FROM bugs,attachments,profiles as attachmentProfiles, profiles as committerProfiles,attach_data\n      WHERE attachments.bug_id = bugs.bug_id\n      \t  AND resolution = \"FIXED\"\n          AND attachments.ispatch = 1\n          AND attachments.isobsolete = 0\n\t\t  AND char_length(bugs.keywords) > 0\n          AND bugs.product_id = {$projectNumber}\n\t\t  AND attachments.submitter_id = attachmentProfiles.userid\n\t\t  AND bugs.assigned_to = committerProfiles.userid\n          AND attach_data.id = attachments.attach_id \n          AND component_id = {$component}\n          ORDER BY bugs.bug_id";
    // AND position('contributed' in bugs.keywords) > 0
    //echo "sql_info: " . $sql_info . "<br />";
    //flush();
    $rs = mysql_query($sql_info, $dbh);
    echo "<table border='1' cellpadding='2' width='80%'>";
    echo "<tr><th>Count</th><th>Bug Number</th><th>Target Milestone</th><th>Id</th><th>Name</th><th>Total Lines</th><th>Added Lines</th><th>Committer</th></tr>";
    while ($debug_count < 1000 && ($myrow = mysql_fetch_assoc($rs))) {
        //echo gettype($committerList) . " " . gettype($includes) . " " . gettype($myrow['attachment_real_name']) . " " . gettype($myrow['bug_target_milestone']);
        if (!in_array($myrow['attachment_real_name'], $committerList) && !in_array($myrow['bug_id'], $exclusions)) {
            if (in_array($myrow['bug_target_milestone'], $includes)) {
                $color = strpos($myrow['bug_keywords'], 'contributed') === false ? strcmp($myrow['committer_real_name'], $myrow['attachment_real_name']) == 0 ? "#FFFF00" : "#FF8080" : "#FFFFFF";
                echo "<tr bgcolor=\"{$color}\">";
                $debug_count++;
                echo "<td>" . $debug_count . "</td>";
                //echo "   ";
                echo "<td>" . "<a href=\"https://bugs.eclipse.org/bugs/show_bug.cgi?id=" . $myrow['bug_id'] . "\">" . $myrow['bug_id'] . "</a>" . "</td>";
                $buglist[] = $myrow['bug_id'];
                //echo "   ";
                //echo $myrow['bug_status'];
                //echo ",";
                //echo $myrow['bug_resolution'];
                //echo ",";
                echo "<td>" . $myrow['bug_target_milestone'] . "</td>";
                //echo "   ";
                //echo $myrow['filename'];
                //echo ",";
                //echo $myrow['timestamp'];
                //echo ",";
                echo "<td>" . str_replace("@", "{at}", $myrow['attachment_login_name']) . "</td>";
                //echo "   ";
                echo "<td>" . $myrow['attachment_real_name'] . "</td>";
                // echo "NOT_WTP_COMMITTER";
                if (!in_array($myrow['attachment_login_name'], $uniqueNames)) {
                    $uniqueNames[$myrow['attachment_login_name']] = $myrow['attachment_real_name'];
                    if (key_exists($myrow['attachment_login_name'], $uniqueCount)) {
                        $uniqueCount[$myrow['attachment_login_name']] = $uniqueCount[$myrow['attachment_login_name']] + 1;
                    } else {
                        $uniqueCount[$myrow['attachment_login_name']] = 1;
                    }
                }
                echo "<td>" . countNewLines($myrow) . "</td>";
                echo "<td>" . countAddedLines($myrow) . "</td>";
                echo "<td>" . $myrow['committer_real_name'] . "</td>";
                echo "</tr>";
            }
        }
    }
    echo "</table>";
    $cslist = "";
    foreach ($buglist as $bug) {
        $cslist = $cslist . $bug . ",";
    }
    if (strlen($cslist) > 0) {
        echo "<p>Tip: You can use this <a href=\"https://bugs.eclipse.org/bugs/buglist.cgi?bug_id=" . $cslist . "\">bugzilla single list</a> for above table to first list all bugs in the table, and then narrow or sort the result how ever you would like.</p>";
    }
    flush();
}
function checkProject($componenetLabel, $projectNumber, $component, $includes)
{
    global $dbc;
    global $dbh;
    global $rs;
    global $committerList;
    global $exclusions;
    global $uniqueCount;
    global $uniqueNames;
    global $uniqueBugs;
    global $committerOverrides;
    global $contributorOverrides;
    global $locationOverrides;
    $buglist = array();
    $sql_info = "SELECT  bugs.bug_id as bug_id,\n\t\tbugs.bug_status as bug_status,\n\t\tbugs.resolution as bug_resolution,\n\t\tbugs.target_milestone as bug_target_milestone,\n\t\tbugs.status_whiteboard as status,\n\t\tbugs.short_desc as description,\n\t\tattachments.filename as filename,\n\t\tattachments.ispatch as ispatch,\n        attachments.creation_ts as timestamp,\n\t\tattachmentProfiles.login_name as attachment_login_name,\n        attachmentProfiles.realname as attachment_real_name,\n        committerProfiles.realname as committer_real_name,\n        attach_data.thedata as thedata,\n\t\tbugs.keywords as bug_keywords,\n\t\tbugs.component_id as component_id\n    FROM bugs,attachments,profiles as attachmentProfiles, profiles as committerProfiles,attach_data\n      WHERE attachments.bug_id = bugs.bug_id\n      \t  AND resolution = \"FIXED\"\n          AND attachments.ispatch = 1\n          AND attachments.isobsolete = 0\n\t\t  AND char_length(bugs.keywords) > 0\n          AND bugs.product_id = {$projectNumber}\n\t\t  AND attachments.submitter_id = attachmentProfiles.userid\n\t\t  AND bugs.assigned_to = committerProfiles.userid\n          AND attach_data.id = attachments.attach_id \n          AND component_id = {$component}\n          ORDER BY bugs.bug_id, attachments.creation_ts DESC";
    $rs = mysql_query($sql_info, $dbh);
    while ($myrow = mysql_fetch_assoc($rs)) {
        if (!array_key_exists($myrow['attachment_real_name'], $committerList) && !in_array($myrow['bug_id'], $exclusions) && !in_array($myrow['bug_id'], $uniqueBugs)) {
            if (in_array($myrow['bug_target_milestone'], $includes)) {
                array_push($uniqueBugs, $myrow['bug_id']);
                $contributor = $myrow['attachment_real_name'];
                $contributorEmail = $myrow['attachment_login_name'];
                if (array_key_exists($myrow['bug_id'], $contributorOverrides)) {
                    $pair = $contributorOverrides[$myrow['bug_id']];
                    $contributorEmail = $pair[1];
                    $contributor = $pair[0];
                }
                if ($contributor == null) {
                    $contributor = $contributorEmail;
                }
                $committer = $myrow['committer_real_name'];
                if (array_key_exists($myrow['bug_id'], $committerOverrides)) {
                    $committer = $committerOverrides[$myrow['bug_id']];
                }
                echo $componenetLabel . ",";
                echo "https://bugs.eclipse.org/bugs/show_bug.cgi?id=" . $myrow['bug_id'] . ",";
                echo str_replace("@", "{at}", $contributor) . ",";
                $count = countAddedLines($myrow);
                echo ($count < 100 ? "small" : $count) . ",";
                echo $committer . ",";
                echo str_replace(",", " ", $myrow['description']);
                echo "\n";
            }
        }
    }
    flush();
}