#At bzr+ssh://bk-internal.mysql.com/bzrroot/mysql-falcon/
210 Hakan Kuecuekyilmaz 2008-06-25
Added text-only version of Falcon Bug Statistic tool.
added:
falcon_bug_statistic/falcon_bug_statistic_text.php
falcon_bug_statistic/include/fbs_query.php
modified:
falcon_bug_statistic/falcon_bug_statistic.php
falcon_bug_statistic/include/config.inc.php
per-file messages:
falcon_bug_statistic/falcon_bug_statistic.php
Refactored database query for reuse in text-only version.
falcon_bug_statistic/falcon_bug_statistic_text.php
Initial version.
falcon_bug_statistic/include/config.inc.php
Added date.
falcon_bug_statistic/include/fbs_query.php
Initial version.
=== modified file 'falcon_bug_statistic/falcon_bug_statistic.php'
--- a/falcon_bug_statistic/falcon_bug_statistic.php 2008-06-24 16:37:22 +0000
+++ b/falcon_bug_statistic/falcon_bug_statistic.php 2008-06-25 13:57:59 +0000
@@ -1,56 +1,13 @@
<?php
/**
- * Bug statistic for MySQL/Falcon.
+ * Bug statistic for MySQL/Falcon: HTML output.
*
* Hakan Kuecuekyilmaz, <hakan at mysql dot com>, 2008-06-24.
* $Id$
*/
require_once './include/config.inc.php';
-
-$dbh = @mysql_connect(DATABASE_HOST, DATABASE_USER, DATABASE_PASS);
-
-if (!$dbh) {
- echo '[ERROR]: Could not connect to database.';
- exit;
-}
-
-mysql_select_db(DATABASE_NAME);
-
-// Sample data.
-$sql_prio = "SELECT priority, count(*) AS count FROM bugdb
- WHERE status IN (
- 'In progress',
- 'In review',
- 'Patch approved',
- 'Patch pending',
- 'Patch queued',
- 'Post-fix test fail',
- 'QA review',
- 'Verified'
- )
- AND severity <> 4
- AND bug_type = 'Server: Falcon'
- GROUP BY priority";
-
-$sql_stat = "SELECT status, count(*) AS count FROM bugdb
- WHERE status IN (
- 'In progress',
- 'In review',
- 'Patch approved',
- 'Patch pending',
- 'Patch queued',
- 'Post-fix test fail',
- 'QA review',
- 'Verified'
- )
- AND severity <> 4
- AND bug_type = 'Server: Falcon'
- GROUP BY status";
-
-
-$res_prio = mysql_query($sql_prio);
-$res_stat = mysql_query($sql_stat);
+require_once './include/fbs_query.php';
/**
* HTML output.
@@ -72,6 +29,10 @@ $res_stat = mysql_query($sql_stat);
</div>
</div>
+<div class="fbs" style="text-align: center;">
+ <?php echo '<h2>' . THIS_DATE . '</h2>' . "\n"; ?>
+</div>
+
<div class="fbs">
<table style="width: 90%;">
<tr>
=== added file 'falcon_bug_statistic/falcon_bug_statistic_text.php'
--- a/falcon_bug_statistic/falcon_bug_statistic_text.php 1970-01-01 00:00:00 +0000
+++ b/falcon_bug_statistic/falcon_bug_statistic_text.php 2008-06-25 13:57:59 +0000
@@ -0,0 +1,52 @@
+<?php
+/**
+ * Bug statistic for MySQL/Falcon: text output.
+ *
+ * Hakan Kuecuekyilmaz, <hakan at mysql dot com>, 2008-06-24.
+ * $Id$
+ */
+
+require_once './include/config.inc.php';
+require_once './include/fbs_query.php';
+
+$f = 15;
+$s = 6;
+$sv = 3;
+define('FIRST_COLUMN', '%-' . $f . 's');
+define('SECOND_COLUMN', '%-' . $s . 's');
+define('SECOND_COLUMN_VALUE', '%' . $sv . 'd');
+
+$horizontal_rule = str_repeat('-', $f) . '+' . str_repeat('-', $s) . "\n";
+
+/**
+ * Text output.
+ */
+echo 'Report generated at: ' . THIS_DATE . "\n";
+echo "\n";
+echo $horizontal_rule;
+printf(FIRST_COLUMN . '| ' . SECOND_COLUMN . "\n", 'Priority', 'Count');
+echo $horizontal_rule;
+
+$sum = 0;
+while ($row = mysql_fetch_assoc($res_prio)) {
+ $sum += $row['count'];
+ printf(FIRST_COLUMN . '| ' . SECOND_COLUMN_VALUE . "\n", $row['priority'], $row['count']);
+}
+echo $horizontal_rule;
+printf(FIRST_COLUMN . '| ' . SECOND_COLUMN_VALUE . "\n", 'All', $sum);
+
+echo "\n";
+echo "\n";
+echo $horizontal_rule;
+printf(FIRST_COLUMN . '| ' . SECOND_COLUMN . "\n", 'Status', 'Count');
+echo $horizontal_rule;
+
+$sum = 0;
+while ($row = mysql_fetch_assoc($res_stat)) {
+ $sum += $row['count'];
+ printf(FIRST_COLUMN . '| ' . SECOND_COLUMN_VALUE . "\n", $row['status'], $row['count']);
+}
+echo $horizontal_rule;
+printf(FIRST_COLUMN . '| ' . SECOND_COLUMN_VALUE . "\n", 'All', $sum);
+
+?>
=== modified file 'falcon_bug_statistic/include/config.inc.php'
--- a/falcon_bug_statistic/include/config.inc.php 2008-06-24 16:37:22 +0000
+++ b/falcon_bug_statistic/include/config.inc.php 2008-06-25 13:57:59 +0000
@@ -15,6 +15,11 @@ define('DATABASE_USER', 'readonly');
define('DATABASE_PASS', '');
/**
+ * Date used in reports.
+ */
+define('THIS_DATE', date("F jS, Y - H:i:s") . ' CET');
+
+/**
* Array of email addresses who will get a report.
*/
$receiver[] = 'hakan@stripped';
=== added file 'falcon_bug_statistic/include/fbs_query.php'
--- a/falcon_bug_statistic/include/fbs_query.php 1970-01-01 00:00:00 +0000
+++ b/falcon_bug_statistic/include/fbs_query.php 2008-06-25 13:57:59 +0000
@@ -0,0 +1,84 @@
+<?php
+/**
+ * Common queries for Falcon Bug Statistic.
+ *
+ * Currently we have these status in bugdb:
+ *
+ * Open
+ * Closed
+ * Duplicate
+ * Analyzing
+ * Verified
+ * In progress
+ * Patch pending
+ * In review
+ * Patch approved
+ * Patch queued
+ * Documenting
+ * QA testing
+ * QA review
+ * Post-fix test fail
+ * Need Doc Info
+ * To be fixed later
+ * Won't fix
+ * Can't repeat
+ * No Feedback
+ * Need Feedback
+ * Not a Bug
+ * Unsupported
+ *
+ * Hakan Kuecuekyilmaz, <hakan at mysql dot com>, 2008-06-25.
+ * $Id$
+ */
+
+$dbh = @mysql_connect(DATABASE_HOST, DATABASE_USER, DATABASE_PASS);
+
+if (!$dbh) {
+ echo '[ERROR]: Could not connect to database.';
+ exit;
+}
+
+mysql_select_db(DATABASE_NAME);
+
+// Sample data.
+$sql_prio = "SELECT priority, count(*) AS count FROM bugdb
+ WHERE status IN (
+ 'In progress',
+ 'In review',
+ 'Patch approved',
+ 'Patch pending',
+ 'Patch queued',
+ 'Post-fix test fail',
+ 'QA testing',
+ 'QA review',
+ 'Verified'
+ )
+ AND severity <> 4
+ AND bug_type = 'Server: Falcon'
+ GROUP BY priority";
+
+$sql_stat = "SELECT status, count(*) AS count FROM bugdb
+ WHERE status IN (
+ 'Analyzing',
+ 'Documenting',
+ 'In progress',
+ 'In review',
+ 'Need Doc Info',
+ 'Need Feedback',
+ 'Open',
+ 'Patch approved',
+ 'Patch pending',
+ 'Patch queued',
+ 'Post-fix test fail',
+ 'QA testing',
+ 'QA review',
+ 'Verified'
+ )
+ AND severity <> 4
+ AND bug_type = 'Server: Falcon'
+ GROUP BY status";
+
+
+$res_prio = mysql_query($sql_prio);
+$res_stat = mysql_query($sql_stat);
+?>
| Thread |
|---|
| • bzr commit into mysql-falcon branch (hakan:210) | Hakan Kuecuekyilmaz | 25 Jun |