Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create plugin.json files if needed for plugins moved from core to marketplace #16323

Merged
merged 4 commits into from Sep 2, 2020

Conversation

tsteur
Copy link
Member

@tsteur tsteur commented Aug 19, 2020

While doing our testing when updating from Matomo core 3.14.0 or older Matomo won't update the Provider and custom variables plugin. There's no real possible workaround because we can't change the update process so figured the best and only workaround be to continue shipping the plugins for a while with Matomo see matomo-org/matomo-package#112 . The plugins won't be updated because Matomo thinks the plugins are bundled with core in https://github.com/matomo-org/matomo/blob/3.14.1-b1/plugins/Marketplace/Api/Client.php#L170 (could think about removing that check in the future however would make the post request a lot larger and put bit more load on the marketplace potentially but nothing serious I suppose)

When people then upgrade from older Matomo versions to a newer Matomo 4.X version without the Provider and Custom Variables plugin, this change will make sure that the marketplace will look for updates and find them. By adding the plugin.json the plugins will be no longer bogus.

What is still a problem is that when updating from a version before Matomo core 3.14.1 is that the 2 plugins will be deactivated. There's no real workaround since we can't know whether they were activated previously. What happens is that a user eg updates from Matomo 3.10 to Matomo 4.8 (the 2 plugins are no longer shipped with Matomo):

  • Matomo then updates the core
  • because it thinks the plugins belong to core it won't look for an update
  • after the files were updated it realises the 2 plugins aren't compatible and therefore deactivates them
  • during the migration we then create the plugin.json files
  • afterwards Matomo will show the user the available updates
  • however the plugin stays still deactivated and user needs to activate it. (because we can't know whether they were activated previously).

Without this change Matomo would never even show there is an update for the plugins available.

@@ -168,6 +169,8 @@ public function oneClickUpdatePartTwo()
try {

if (Marketplace::isMarketplaceEnabled()) {
Updates_4_0_0_b1::ensureCorePluginsThatWereMovedToMarketplaceCanBeUpdated();
Copy link
Member Author

Choose a reason for hiding this comment

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

when updating from 3.14.1 to 4.X then this method would be executed... we'll create the needed plugin.json files shortly before checking for updates so the plugins won't be marked as "bogus"


// eg the case when not updating from most recent Matomo 3.X and when not using the UI updater
// afterwards the should receive a notification that the plugins are outdated
self::ensureCorePluginsThatWereMovedToMarketplaceCanBeUpdated();
Copy link
Member Author

Choose a reason for hiding this comment

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

This logic runs for people that upgrade from 3.14.0 and older because there the oneClickUpdatePartTwo wouldn't be executed as it either didn't exist yet or it wasn't working.
This logic runs also for people who update on the command line.

We then create the files during the update step so at least people will be made aware there's an update available on the marketplace.

@tsteur tsteur marked this pull request as draft August 19, 2020 01:55
@tsteur tsteur marked this pull request as ready for review August 20, 2020 00:22
@tsteur tsteur changed the title Create plugin files on demand if needed Create plugin.json files if needed for plugins moved from core to marketplace Aug 20, 2020
tsteur added a commit to matomo-org/matomo-package that referenced this pull request Aug 20, 2020
For say 6 months or 1 year we should include Provider and Custom Variables plugin still in Matomo 4.X so there are no complications when upgrading. We won't enable them though by default. Once most users have updated to Matomo 4 (in 6 months or 1 year), we could stop shipping it with the release. 

For people that update from the most recent 3.14.1 version it will update the plugins through the marketplace anyway. For other users updating from an older version it will show an update is available because of matomo-org/matomo#16323 but the plugins will be deactivated by core when updating and the admin has to activate them again.

I reckon it be good to still ship it with Matomo at least for a few months simply to prevent possible issues where the plugins would be otherwise deactivated or not updated.

Refs
@tsteur tsteur added this to the 4.0.0 milestone Aug 20, 2020
@tsteur tsteur added Needs Review PRs that need a code review not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. labels Aug 20, 2020
@diosmosis diosmosis merged commit 67d3486 into 4.x-dev Sep 2, 2020
@diosmosis diosmosis deleted the plugincheck branch September 2, 2020 02:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants