php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56518 Package statistics per category show 1 random release only
Submitted: 2005-08-31 14:28 UTC Modified: 2006-10-18 15:28 UTC
From: pear dot nosey at veggerby dot dk Assigned: cellog (profile)
Status: Closed Package: PECL website (PECL)
PHP Version: Irrelevant OS: irrelevant
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: pear dot nosey at veggerby dot dk
New email:
PHP Version: OS:

 

 [2005-08-31 14:28 UTC] pear dot nosey at veggerby dot dk
Description:
------------
On the package statistics page, when selecting a category, fx. HTTP (http://pear.php.net/package-stats.php?cid=11&pid=&rid=). HTTP_Upload shows with 36.000+ downloads, while it on the statitics page for the package shows 72.000+ downloads.

The downloads it seems are only show for 1 relase of the package (and a random it seems for HTTP_Upload it seems to be version 0.8.1)

Test script:
---------------
Without having done a deep review of the code, it seems to be a problem with the SQL for the 'cid' case - it does not sum over the dl_number.

I think this ought to fix it:

Index: package-stats.php
===================================================================
RCS file: /repository/pearweb/public_html/package-stats.php,v
retrieving revision 1.69
diff -u -r1.69 package-stats.php
--- package-stats.php	1 Jun 2005 14:04:49 -0000	1.69
+++ package-stats.php	31 Aug 2005 18:19:06 -0000
@@ -317,10 +317,10 @@
 	$total_categories  = $dbh->getOne(sprintf("SELECT COUNT(*) FROM categories WHERE parent = %d", $_GET['cid']));
 
 	// Query to get package list from package_stats_table
-	$query = sprintf("SELECT ps.dl_number, ps.package, ps.release, ps.pid, ps.rid, ps.cid 
-	                  FROM package_stats ps, packages p 
-	                  WHERE p.package_type = 'pear' AND p.id = ps.pid AND
-	                  p.category = %s GROUP BY ps.pid ORDER BY ps.dl_number DESC",
+	$query = sprintf("SELECT sum(ps.dl_number) as dl_number, ps.package, ps.pid, ps.rid, ps.cid 
+                      FROM package_stats ps, packages p
+                      WHERE p.id = ps.pid AND p.package_type = 'pear' AND
+                      p.category = %s GROUP BY ps.pid ORDER BY dl_number DESC",
                      $_GET['cid']
                      );
 


Expected result:
----------------
The sum of _all_ releases of the package.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-10-18 15:28 UTC] cellog@php.net
This bug has been fixed in CVS.

If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET).

If this was a problem with the pear.php.net website, the change should be live shortly.

Otherwise, the fix will appear in the package's next release.

Thank you for the report and for helping us make PEAR better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 12:01:28 2024 UTC