svn: /web/php-bugs/trunk/www/ api.php
| From: | Philip Olson | Date: | Sun, 08 May 2011 20:12:57 +0000 |
| Subject: | svn: /web/php-bugs/trunk/www/ api.php | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-10974@lists.php.net to get a copy of this message | ||
philip Sun, 08 May 2011 20:12:57 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=310845
Log:
Added simple API, with its only [current] use being for the doc team, regarding who closed bugs last
week.
Changed paths:
A web/php-bugs/trunk/www/api.php
Added: web/php-bugs/trunk/www/api.php
===================================================================
--- web/php-bugs/trunk/www/api.php (rev 0)
+++ web/php-bugs/trunk/www/api.php 2011-05-08 20:12:57 UTC (rev 310845)
@@ -0,0 +1,42 @@
+<?php
+/*
+ Hack note: This is for emailing the documentation team about commit/bugs emails, but could be
expanded in the future.
+
+ The API itself will probably be abandoned in the future, but here's the current URL:
+ - http://bugs.php.net/api.php?type=docs&action=closed&interval=week
+*/
+require_once '../include/prepend.php';
+
+$type = isset($_GET['type']) ? $_GET['type'] :
'unknown';
+$action = isset($_GET['action']) ? $_GET['action'] :
'unknown';
+$interval = isset($_GET['interval']) ? $_GET['interval'] :
'unknown';
+
+if ($type === 'docs' && $action === 'closed' && $interval ===
'week') {
+
+ $query =
+ "
+ SELECT bugdb_comments.reporter_name, COUNT(*) as count
+ FROM bugdb_comments, bugdb
+ WHERE comment_type = 'log'
+ AND package_name IN ('Doc Build problem', 'Documentation problem',
'Translation problem', 'Online Doc Editor problem')
+ AND comment LIKE '%+Status: Closed</span>%'
+ AND date_sub(curdate(), INTERVAL 7 DAY) <= ts
+ AND bugdb.id = bugdb_comments.bug
+ GROUP BY bugdb_comments.reporter_name
+ ORDER BY count DESC
+ ";
+
+ //@todo add error handling
+ $rows = $dbh->prepare($query)->execute(array())->fetchAll(MDB2_FETCHMODE_ASSOC);
+ if (!$rows) {
+ echo 'The fail train has arrived.';
+ exit;
+ }
+
+ echo serialize($rows);
+
+} else {
+
+ echo "Unknown action";
+
+}
Property changes on: web/php-bugs/trunk/www/api.php
___________________________________________________________________
Added: svn:keywords
+ Id Rev Revision Date LastChangedDate LastChangedRevision Author LastChangedBy HeadURL URL
Added: svn:eol-style
+ native