logo       

cvs: pearweb /public_html package-stats-graph.php: msg#00037

php.pear.core

Subject: cvs: pearweb /public_html package-stats-graph.php

cellog Tue Oct 17 17:55:58 2006 UTC

Modified files:
/pearweb/public_html package-stats-graph.php
Log:
fix package statistics graph, and re-enable

# step 1 of enabling stats

http://cvs.php.net/viewvc.cgi/pearweb/public_html/package-stats-graph.php?r1=1.22&r2=1.23&diff_format=u
Index: pearweb/public_html/package-stats-graph.php
diff -u pearweb/public_html/package-stats-graph.php:1.22
pearweb/public_html/package-stats-graph.php:1.23
--- pearweb/public_html/package-stats-graph.php:1.22 Wed Dec 7 07:25:56 2005
+++ pearweb/public_html/package-stats-graph.php Tue Oct 17 17:55:58 2006
@@ -15,7 +15,7 @@
+----------------------------------------------------------------------+
| Authors: Richard Heyes <richard@xxxxxxx> |
+----------------------------------------------------------------------+
- $Id: package-stats-graph.php,v 1.22 2005/12/07 07:25:56 pajoye Exp $
+ $Id: package-stats-graph.php,v 1.23 2006/10/17 17:55:58 cellog Exp $
*/

/*
@@ -28,7 +28,6 @@
* o Multiple releases per graph, ie side by side
* bar chart.
*/
-exit();
include 'jpgraph/jpgraph.php';
include 'jpgraph/jpgraph_bar.php';

@@ -72,17 +71,17 @@
$y_axis[$key] = 0;
}

- $sql = sprintf('SELECT YEAR(d.dl_when) AS dyear,
- MONTH(d.dl_when) AS dmonth, COUNT(*) AS downloads
- FROM packages p, downloads d
- WHERE d.package = p.id
- AND d.dl_when > (now() - INTERVAL 1 YEAR)
- AND p.id = %s
- %s
- GROUP BY YEAR(d.dl_when), MONTH(d.dl_when)
- ORDER BY YEAR(d.dl_when) DESC, MONTH(d.dl_when) DESC',
+ $sql = sprintf("SELECT YEAR(yearmonth) AS dyear, MONTH(yearmonth) AS
dmonth, SUM(downloads) AS downloads
+ FROM aggregated_package_stats a, releases r
+ WHERE a.package_id = %s
+ AND r.id = a.release_id
+ AND r.package = a.package_id
+ AND yearmonth > (now() - INTERVAL 1 YEAR)
+ %s
+ GROUP BY dyear, dmonth
+ ORDER BY dyear DESC, dmonth DESC",
$_GET['pid'],
- $release_clause = $rid > 0 ? 'AND d.release = ' . $rid :
'');
+ $release_clause = $rid > 0 ? 'AND a.release_id = ' . $rid :
'');

if ($result = $dbh->query($sql)) {
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC)) {





<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise