svn: /web/doc/trunk/scripts/ gen_doc_activity_email.php

[email protected] (Philip Olson)
Newsgroups php.doc.web
Message-ID <[email protected]>
philip                                   Wed, 13 Jul 2011 18:25:36 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=313212

Log:
Updated script to pass in (and use) # of days, meaning, it's not always weekly.

Changed paths:
    U   web/doc/trunk/scripts/gen_doc_activity_email.php

Modified: web/doc/trunk/scripts/gen_doc_activity_email.php
===================================================================
--- web/doc/trunk/scripts/gen_doc_activity_email.php	2011-07-13 17:31:02 UTC (rev 313211)
+++ web/doc/trunk/scripts/gen_doc_activity_email.php	2011-07-13 18:25:36 UTC (rev 313212)
@@ -24,7 +24,6 @@
 	  losers except for the documentation.
 Todo:
 	- Add SVN lines changed/added/deleted instead of # commits
-	- Research the bugs api and ensure it works
 	- Add other bug activities? So, not only bug->closed?
 	- Determine if posting statistics is wise (good or bad)
 */
@@ -105,7 +104,7 @@
 /**** Weekly closed bugs ****************************************************/
 /****************************************************************************/

-$rawbuginfo = file_get_contents('http://bugs.php.net/api.php?type=docs&action=closed&interval=week');
+$rawbuginfo = file_get_contents('http://bugs.php.net/api.php?type=docs&action=closed&interval=' . DAYS_LOOKUP);

 $text = '';
 if (!empty($rawbuginfo)) {
@@ -139,8 +138,10 @@
 $text   = '';
 if (is_readable($dbfile) && $db = sqlite_open($dbfile, 0666)) {

-	$sql = "SELECT who, count(*) as count FROM notes WHERE time > (strftime('%s', 'now')-604800) GROUP BY who ORDER BY count DESC";
+	$seconds = 86400*DAYS_LOOKUP;

+	$sql = "SELECT who, count(*) as count FROM notes WHERE time > (strftime('%s', 'now')-{$seconds}) GROUP BY who ORDER BY count DESC";
+
 	$res = sqlite_query($db, $sql);
 	if ($res) {

@@ -169,7 +170,7 @@
 $email_text = str_replace('DATES_ACTIVITY', "$time_past to $time_now", $email_text);

 if (!DEBUG_MODE) {
-	mail('[email protected]', 'The weekly PHP documentation activity report', $email_text, 'From: [email protected]', '[email protected]');
+	mail('[email protected]', 'The PHP documentation activity report', $email_text, 'From: [email protected]', '[email protected]');
 } else {
 	echo $email_text;
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.