Re: [PEAR-DEV] "Popular Packages"
[email protected] (Alexey Borzov) Tue, 01 Nov 2011 14:49:46 +0400
| Newsgroups | php.pear.dev,php.pear.webmaster |
|---|---|
| Message-ID | <[email protected]> |
Hi,
On 29.10.2011 14:23, Alexey Borzov wrote:
> I've looked up a query in pearweb and it looks legit:
In fact the query only initially looks legit...
> SELECT
> packages.name, releases.version, downloads, releasedate,
> downloads/(CEIL((unix_timestamp(NOW()) -
> unix_timestamp(releases.releasedate))/86400)) as releasenotes
...
> a.yearmonth = "' . date('Y-m-01 00:00:00', time()) . '"
> ORDER BY releasenotes DESC';
If one looks more closely, it takes downloads for a current month and then
divides them by the age of the package, so "* downloads per day" comment is
bogus for all releases except those done this month.
I traced the problem back to this commit:
https://github.com/pear/pearweb/commit/c22f9f34c5b78a5035a380b40b842f8d334edd3e
The notes there state
> + * Implement *much* better popular packages algorithm: only
> + count downloads per day for the current month. This gives
> + newer packages a fighting chance to be popular :)
I suspect the original intention was to divide by a min(package age in days,
current day of month), not by a package age.
BTW, if the query is fixed, File_Mogile 0.2.0 mentioned below will reign supreme
at the "Popular packages" list. It isn't on the first place because its 100K+
downloads-per-month are spread thin across its two-year age.
> Also WTF is File_Mogile? Does it really have 100K downloads a month or is this
> creative approach to foreign key constraints?
> http://pear.php.net/package-stats.php?pid=843&cid=9
>