blob: 3a41c1d006069238f535c445400c4992d0fac2e2 [file] [log] [blame]
<?php
require_once "/home/data/httpd/eclipse-php-classes/system/dbconnection_bugs_ro.class.php";
function check_email_as_webtools_committer( $email ) {
$found = FALSE;
$ds = ldap_connect("main");
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
if ($ds) {
$r = @ldap_bind($ds); # anonymous bind
if( $r ) {
$sr=ldap_search($ds, "ou=people,dc=eclipse,dc=org", "(mail=$email)");
$sr2=ldap_search($ds, "cn=webtools,ou=group,dc=eclipse,dc=org", "(member=*)");
$info = ldap_get_entries($ds, $sr);
$info2 = ldap_get_entries($ds, $sr2);
$uid = "DOESNOTEXIST";
$i = 0;
for ($ii=0; $ii<$info[$i]["count"]; $ii++){
$data = $info[$i][$ii];
#echo $data."($i.$ii):&nbsp;&nbsp;".$info[$i][$data][0]."<br>";
if( $data == "uid" ) {
$uid = $info[$i][$data][0];
}
}
$i = 0;
for ($ii=0; $ii<$info2[$i]["count"]; $ii++){
$data = $info2[$i][$ii];
#echo $data."($i.$ii):&nbsp;&nbsp;".$info2[$i][$data][0]."<br>";
if( $data == "member" ) {
for($j = 0; $j<$info2[$i][$data]["count"]; $j++ ) {
$attr = $info2[$i][$data][$j];
#echo "&nbsp;&nbsp;&nbsp;". $attr . "<br>";
if( strstr( $attr, $uid ) ) {
$found = true;
}
}
}
}
}
}
ldap_close($ds);
return $found;
}
$dbc = new DBConnectionBugs();
$dbh = $dbc->connect();
$sql_info = "SELECT bugs.bug_id as bug_id,
bugs.bug_status as bug_status,
bugs.resolution as bug_resolution,
bugs.target_milestone as bug_target_milestone,
attachments.filename as filename,
attachments.thedata as thedata,
attachments.creation_ts as timestamp,
profiles.login_name as attachment_login_name
FROM bugs,
attachments,
profiles
WHERE attachments.bug_id = bugs.bug_id
AND attachments.isobsolete = 0
AND (bugs.bug_status = 'RESOLVED'
OR bugs.bug_status = 'CLOSED'
OR bugs.bug_status = 'VERIFIED')
AND bugs.resolution = 'FIXED'
AND bugs.product_id = 20
AND attachments.submitter_id = profiles.userid
ORDER BY bugs.bug_id";
$rs = mysql_query($sql_info, $dbh);
$output_file = "timquerys.csv";
@ini_set('zlib.output_compression', 'Off');
header('Pragma: public');
header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: pre-check=0, post-check=0, max-age=0');
header('Content-Transfer-Encoding: none');
// This should work for IE & Opera
header('Content-Type: application/octetstream; name="' . $output_file . '"');
// This should work for the rest
header('Content-Type: application/octet-stream; name="' . $output_file . '"');
header('Content-Disposition: inline; filename="' . $output_file . '"');
echo "bug_id,bug_status,resolution,target_milestone,filename,file_timestamp,filename_is_patch,content_is_patch,attachment_login_name,attachment_login_is_committer\n";
while( $myrow = mysql_fetch_assoc($rs) ) {
echo $myrow['bug_id'];
echo ",";
echo $myrow['bug_status'];
echo ",";
echo $myrow['bug_resolution'];
echo ",";
echo $myrow['bug_target_milestone'];
echo ",";
echo $myrow['filename'];
echo ",";
echo $myrow['timestamp'];
echo ",";
$count = preg_match( '/patch/', $myrow['filename'] );
if( $count > 0 ) {
echo "TRUE,";
} else {
echo "FALSE,";
}
$count = preg_match( '/RCS file:/', $myrow['thedata'] );
if( $count > 0 ) {
echo "TRUE,";
} else {
echo "FALSE,";
}
echo $myrow['attachment_login_name'];
echo ",";
if( check_email_as_webtools_committer( $myrow['attachment_login_name'] ) ) {
echo "TRUE";
} else {
echo "FALSE";
}
echo "\n";
}
$dbc->disconnect();
$rs = null;
$dbh = null;
$dbc = null;
exit();
?>