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

Show correct message why plugin was deactivated when it has a missing license #14378

Merged
merged 2 commits into from Apr 29, 2019

Conversation

tsteur
Copy link
Member

@tsteur tsteur commented Apr 28, 2019

… license

I was never able to reproduce this issue until I disabled development mode.
With the old code, when no valid license in the Marketplace was configured and development mode is disabled, it would show a message "Plugin XYZ could not be loaded" where it should have said "Plugin was not loaded because the license is missing".

This was regressed in https://github.com/matomo-org/matomo/blob/3.10.0-b1/core/Plugin/Manager.php#L1058-L1086 where we unloaded plugin when the license is missing, so that logic failed to determine that the plugin was activated. By looking at the config we can ensure to correctly detect if plugin is still activated or not and now shows correct message.

A test is not really easily possible to write as some logic is disabled for tests etc and might not be actually needed.

… license

I was never able to reproduce this issue until I disabled development mode. 
With the old code, when no valid license in the Marketplace was configured and development mode is disabled, it would show a message "Plugin XYZ could not be loaded" where it should have said "Plugin was not loaded because the license is missing".

This was regressed in https://github.com/matomo-org/matomo/blob/3.10.0-b1/core/Plugin/Manager.php#L1058-L1086 where we unloaded plugin when the license is missing, so that logic failed to determine that the plugin was activated. By looking at the config we can ensure to correctly detect if plugin is still activated or not and now shows correct message.

A test is not really easily possible to write as some logic is disabled for tests etc and might not be actually needed.
@tsteur tsteur added the Needs Review PRs that need a code review label Apr 28, 2019
@tsteur tsteur added this to the 3.10.0 milestone Apr 28, 2019
Copy link
Member

@diosmosis diosmosis left a comment

Choose a reason for hiding this comment

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

LGTM (left one small suggestion re method naming)


return $this->pluginManager->isPluginInstalled($pluginName);
}

protected function isPluginActivated($pluginName)
Copy link
Member

Choose a reason for hiding this comment

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

small suggestion: could rename the method to, eg, isPluginInActivatedPluginsList to differentiate from Manager::isPluginActivated.

@tsteur tsteur merged commit 181d22d into 3.x-dev Apr 29, 2019
@tsteur tsteur deleted the improvemissingpluginlicense branch April 29, 2019 20:25
@mattab mattab changed the title Show correct message why plugin was deactivated when it has a missing… Show correct message why plugin was deactivated when it has a missing license Jun 29, 2019
@mattab mattab added the c: Platform For Matomo platform changes that aren't impacting any of our APIs but improve the core itself. label Jun 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: Platform For Matomo platform changes that aren't impacting any of our APIs but improve the core itself. Needs Review PRs that need a code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants