Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Coming from #32124: Enable download statistics.
We currently track download stats in the project_release table. We should make this data visible on the project pages.
The way the reported installs is done is in drupalorg_project module, so I assume that needs to happen here too. :)
Comments
Comment #1
webchickHere's the project usage hunk of drupalorg_project:
Comment #2
webchickAnd here's the relevant functions from project_usage module:
Comment #3
webchickAnd the downloads are stored in the project_release_file table:
Comment #4
dwwI don't think this should be done until the plumbing that's populating {project_release_file}.downloads isn't held together with duct tape and bailing wire. ;) Did fixing that ever happen? Looking at #32124: Enable download statistics it doesn't seem so...
Also, presumably on the project page we'd want total downloads across all files of all releases for that project? That's not exactly a trivial query to run on every project page load. So, we should either:
A) Pre-compute these totals in bdragon's scripts via mongo and populate another {project_release_project_download} table (or something) - effectively denormalize it for this.
B) Do the expensive query on demand, but cache it into {cache} or {cache_project_release} or something.
Either of those solutions seems more appropriate to handle over at #32124 (or yet another split-off issue) not here, but I wanted to raise the point to further support "postponed" as the currently-appropriate status here. ;)
Cheers,
-Derek
Comment #5
webchickFollowed up at #32124-33: Enable download statistics
Comment #6
webchickOne other caveat is that the download tracking only goes back as far as January 2009. We should make sure to note that next to the count.
Comment #7
sunComment #8
drummComment #9
dwwCool, nice to see progress here, thanks!
However, http://drupalcode.org/project/infrastructure.git/blob/HEAD:/live/process... from #32124: Enable download statistics doesn't handle the project-wide totals I talked about in #4 (quick skim seems to indicate we're computing them in mongo, but not saving them to the SQL DB so we can use them), nor is there any support in project_release to save those numbers. So, either we need to reopen #32124 or we need a new issue for this one to move forward. Pre-computing those totals would also help project_solr when indexing project nodes so we could have filters/sorts based on them at /project/modules and friends.
Thanks,
-Derek
Comment #10
drummIf we want a simple number for the front of the project page,
SELECT sum(downloads) FROM project_release_nodes prn INNER JOIN project_release_file prf ON prf.nid = prn.nid WHERE prn.pid = 3060;
says 7,613,248. Explain doesn't look too bad:
Comment #11
drumm(Didn't mean to un-postpone, just had the values from an old comment.)
I'm not sure that doing the query on the fly for project and release pages will be all that bad. We shouldn't expose that as a filter for views or anything, but we can stuff the number in Solr and let it sort.
Comment #12
dwwGreat, even better!
In that case, see also:
#1488984: Put download totals into the solr docs for projects (and releases)
#1488986: Expose sort (and maybe filter) for download counts on project solr browsing pages
Thanks,
-Derek
Comment #13
drummhttp://drupalcode.org/project/drupalorg.git/commit/2aa2d45
Comment #14
drummDeployed.
Comment #15
juan_g CreditAttribution: juan_g commentedReally really useful, together with usage stats. And download count is working nicely for distributions as well. Thank you!