@Simone and I have been working on the directory and the core integration plugin. We would like some feedback and advice on the best way to handle plugin/theme updates as it relates to plugins/themes that may be listed in both the WordPress repo and ClassicPress directory.
Simone’s initial approach to handling updates was to make Update URI
header required, which would contain the directory API endpoint with a slug:
Update URI: https://directory.classicpress.net/wp-json/wp/v2/plugins?byslug=classicpress-directory-integration
If a plugin is listed only in the CP directory, there is no problem. However, plugins/themes may be listed in WP repo. We want those plugins/themes to get listed in CP directory, so our users have access.
The problem is WP repo, like CP directory, doesn’t allow third-party Update URI
headers. So if we require it, plugins/themes would violate WP repo rules. Developers won’t maintain two separate versions of their plugins/themes, so we need a better way to handle updates without requiring Update URI
header.
The header was initially solving the problem of having plugins/themes listed in both places (WP/CP), so CP core knows where the updates are coming from. If a user installs a plugin from CP directory, but there is a plugin in WP repo with the same slug, where will the update come from? Where should it come from? And vice versa.
Simone mentioned that without using Update URI
, the core update code may need changes.
My only idea to try and solve this issue is to track the source of installation in the database and then check it during updates and handle updates correctly based on the source of the installation. But this does require core changes. Tracking the source of installation in the database will also allow us to add some sort of a visual identifier to plugins/themes to show the user where the item was installed from (a badge, a column with source, etc.). This is just an idea.
I think the most important things to keep in mind trying to solve this problem are:
- Ensure there are no conflicts between plugins/themes with the same slug if they are listed in both WP repo and CP directory
- We can’t require something that would prevent WP plugins/themes from being listed in CP directory
- Ensure the update process is seamless for the user
We would like some feedback on the best way to handle it.