Skip to content

Add a downloads count column to the list of available custom modules#57

Merged
Jefferson49 merged 4 commits into
Jefferson49:mainfrom
gmarcon:downloads-count
May 30, 2026
Merged

Add a downloads count column to the list of available custom modules#57
Jefferson49 merged 4 commits into
Jefferson49:mainfrom
gmarcon:downloads-count

Conversation

@gmarcon

@gmarcon gmarcon commented May 28, 2026

Copy link
Copy Markdown
Contributor

This is proposal to address #55:

  • retrieves the downloads count with github API (max number of downloades of the last three releases to normalize data / account for new releases)
  • caches the data using module settings
  • shows the download count in the table (sortable)

Screenshot:
Image

@Jefferson49

Copy link
Copy Markdown
Owner

Thanks for this additional contribution. This looks very promising!

I guess you also changed a file in my common library, which is placed in the /vendor folder. Those files are not included in the pull request, because they have the character of a library.

Can you send me the following modified file (e.g. as an attachement):
/modules_v4/custom_module_manager/vendor/jefferson49/webtrees-common/Helpers/GithubService.php

Or you could create a pull request for the file in the repository of my common library: GithubService

@Jefferson49

Copy link
Copy Markdown
Owner

Only thing I am wondering is at what time to update the download count, because calling the GitHub API for 80 modules is a little bit time consuming:

  • It's great that you already included a cache concept with 24 hours (By the way, we could also use the webtrees cache system)
  • Maybe, we could extend the cache period, for example to 1 week
  • We could update the download count only if the user presses the "Check now" button
  • We could could let the user decide with a setting in the control panel

@gmarcon

gmarcon commented May 29, 2026

Copy link
Copy Markdown
Contributor Author

Thank you for your review and feedback, very much appreciated!

I updated the pull request with the following changes:

  • now the standard webtrees caching for downloads count is used, as you correctly suggested
  • as downloads count is done for all 80 modules, while the forced release check ("check now") was done only for the usually much fewer installed modules, there is a separate trigger for downloads count
  • while retrieving the downloads count, we can also retrieve and cache the latest version (comes "for free" in the same call) so that we have the latest version also for modules that have not been installed (probably not particularly useful but why throw away this information)
  • the cache has no TTL , it is expired manually when a new "fetch all" is triggered

Additionally I made a separate pull request Jefferson49/webtrees-common#3 for the webtrees-common with the GitHub API integration, that was missing as you correcly pointed out.

This works only for modules using GitHub for releases and adding separate assets for the releases (for instance it does not work with Vesta modules or the faces module).

Here a screenshot of how the custom module manager page looks like with this proposal:
2026-05-29 21_42_14-WDADesktopService

@Jefferson49 Jefferson49 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked in local branch

@Jefferson49
Jefferson49 marked this pull request as ready for review May 30, 2026 11:57
@Jefferson49
Jefferson49 merged commit b101509 into Jefferson49:main May 30, 2026
@Jefferson49

Copy link
Copy Markdown
Owner

I merged the PR and consolidated some of the code. I decided to set the cache TTL to 30 days for the download counts. I also integrated the behavior of the buttons "check now" and "Fetch all" in the "check now" button, because the GitHub API calls will retrieve both (version and download counts) at the same time anyway.

In my test installations, it works pretty well now.

Currently, I am working on some other topics. I guess I will publish a new version in about one week.

@gmarcon

gmarcon commented May 31, 2026

Copy link
Copy Markdown
Contributor Author

Thank you for the update and for incorporating this enhancement. I appreciate the valuable discussion we had, particularly your suggestion to rely on the downloads count as a proxy for popularity instead of monitoring active modules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants