require_once 'prepend.inc'; if(!strstr($MYSITE,"bugs.php.net")) { Header("Location: http://bugs.php.net/bugstats.php"); exit; } if ($phpver != 4 and $phpver != 3) { $phpver = 0; } function mydate($str) { $year = substr($str,0,4); $month = substr($str,5,2); $day = substr($str,8,2); $hour = substr($str,11,2); $min = substr($str,14,2); $sec = substr($str,17,2); return mktime($hour,$min,$sec,$month,$day,$year); } function ShowTime($sec) { if($sec<60) { return "$sec seconds"; } else if($sec<120) { return (int)($sec/60)." minute ".($sec%60)." seconds"; } else if($sec<3600) { return (int)($sec/60)." minutes ".($sec%60)." seconds"; } else if($sec<7200) { return (int)($sec/3600)." hour ".(int)(($sec%3600)/60)." minutes ".(($sec%3600)%60)." seconds"; } else if($sec<86400) { return (int)($sec/3600)." hours ".(int)(($sec%3600)/60)." minutes ".(($sec%3600)%60)." seconds"; } else if($sec<172800) { return (int)($sec/86400)." day ".(int)(($sec%86400)/3600)." hours ".(int)((($sec%86400)%3600)/60)." minutes ".((($sec%86400)%3600)%60)." seconds"; } else { return (int)($sec/86400)." days ".(int)(($sec%86400)/3600)." hours ".(int)((($sec%86400)%3600)/60)." minutes ".((($sec%86400)%3600)%60)." seconds"; } } commonHeader("Bug Stats"); if ($phpver > 0) { $other = ($phpver == 4 ? 3 : 4); echo '
Currently displaying PHP'. $phpver . ' bugs only. Display all bugs or only PHP' . $other . ' bugs.
' . "\n"; } else { echo 'Currently displaying all bugs. Display only PHP3 bugs or only PHP4 bugs.
' . "\n"; } mysql_connect("localhost","nobody",""); mysql_select_db("php3"); $query = "SELECT * from bugdb"; if ($phpver > 0) { $query .= " WHERE php_version LIKE '" . $phpver . "%'"; } $query.= " ORDER BY bug_type"; $result=mysql_query($query); while($row=mysql_fetch_row($result)) { $bug_type['all'][$row[1]]++; if($row[7]=="Open") { $bug_type['open'][$row[1]]++; $bug_type['open']['all']++; } if($row[7]=="Analyzed") { $bug_type['analyzed'][$row[1]]++; $bug_type['analyzed']['all']++; } if($row[7]=="Feedback" || $row[7]=="OldFeedback") { $bug_type['feedback'][$row[1]]++; $bug_type['feedback']['all']++; } if($row[7]=="Suspended") { $bug_type['suspended'][$row[1]]++; $bug_type['suspended']['all']++; } if($row[7]=="Duplicate") { $bug_type['duplicate'][$row[1]]++; $bug_type['duplicate']['all']++; } if($row[7]=="Assigned") { $bug_type['assigned'][$row[1]]++; $bug_type['assigned']['all']++; } $email[$row[2]]++; $php_version[$row[5]]++; $php_os[$row[6]]++; $status[$row[7]]++; if($row[7]=="Closed") { $bug_type['closed'][$row[1]]++; $bug_type['closed']['all']++; if (mydate($row[10]) > mydate($row[9])) { $time_to_close[] = mydate($row[10]) - mydate($row[9]); } $closed_by[$row[11]]++; } $total++; } function bugstats($status, $type) { global $bug_type, $phpver; if ($bug_type[$status][$type] > 0) { if ($phpver == 4) { $page = "bugs.php"; } else { $page = "bugs-php3.php"; } return '' . $bug_type[$status][$type] . "\n"; } } mysql_freeresult($result); echo "| Total bug entries in system: | $total | "; echo "".sort_url('closed')." | "; echo "".sort_url('open')." | "; echo "".sort_url('analyzed')." | "; echo "".sort_url('suspended')." | "; echo "".sort_url('duplicate')." | "; echo "".sort_url('assigned')." | "; echo "".sort_url('feedback')." |
|---|---|---|---|---|---|---|---|---|
| All: | $total | ".bugstats('closed', 'all')." | ".bugstats('open', 'all')." | ".bugstats('analyzed', 'all')." | ".bugstats('suspended','all')." | ".bugstats('duplicate', 'all')." | ".bugstats('assigned','all')." | ".bugstats('feedback','all')." |
| $type: | ".$bug_type['all'][$type]." | ".bugstats('closed', $type)." | ".bugstats('open', $type)." | ".bugstats('analyzed', $type)." | ".bugstats('suspended',$type)." | ".bugstats('duplicate', $type)." | ".bugstats('assigned',$type)." | ".bugstats('feedback',$type)." |
Bug Report Time to Close Stats\n"; echo "
| Average life of a report: | ".ShowTime((int)($sum/$c))." |
|---|---|
| Median life of a report: | ".ShowTime($median)." |
| Slowest report closure: | ".ShowTime($time_to_close[$c-1])." |
| Quickest report closure: | ".ShowTime($time_to_close[0])." |
Who is closing the bug reports?\n"; echo "
| $who | $value |
|---|
Who is submitting bug reports?\n"; echo "
| $who | $value |
|---|