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

Activating a plugin should fail when the plugin has missing dependencies #10401

Closed
wants to merge 14 commits into from

Conversation

mattab
Copy link
Member

@mattab mattab commented Aug 16, 2016

Bug: when using plugin:activate console command: without this patch it looks like the plugin:activate worked but it didn't

For example via plugin:activate console command.
without this patch it looks like the plugin:activate worked but it didn't
@mattab mattab added the Needs Review PRs that need a code review label Aug 16, 2016
@mattab mattab added this to the 3.0.0-b1 milestone Aug 16, 2016
* @param $plugin Plugin
* @throws \Exception
*/
private function throwIfPluginMissingDependencies($plugin)
Copy link
Member

Choose a reason for hiding this comment

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

Can you maybe move this method in another class and make it public so it can be tested? the string formatting part might be also useful for plugins/CorePluginsAdmin/templates/macros.twig and https://github.com/piwik/piwik/blob/2.16.2/core/Plugin/Manager.php#L831 where it should be actually deactivated the plugin even before we try to install I think

@mattab
Copy link
Member Author

mattab commented Aug 17, 2016

Added the text to the notification: reuse

The twig code now reuses the PHP logic

Added test for the new method


$causedBy = array();
foreach ($missingDependencies as $dependency) {
$causedBy[] = strtoupper($dependency['requirement']) . ' ' . $dependency['causedBy'];
Copy link
Member

Choose a reason for hiding this comment

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

I think this should be rather capitalize instead of strtoupper. There will be also plugin names etc. For PHP we have in the Marketplace a special if to convert it to upper case

Conflicts:
	libs/bower_components/jquery.scrollTo/README.md
	libs/bower_components/jquery.scrollTo/jquery.scrollTo.min.js
	libs/bower_components/jquery.scrollTo/scrollTo.jquery.json
	plugins/CorePluginsAdmin/lang/en.json
	plugins/CorePluginsAdmin/templates/macros.twig
@mattab
Copy link
Member Author

mattab commented Sep 23, 2016

Will re-create the PR clean, as I included submodules by mistake

@mattab mattab closed this Sep 23, 2016
@mattab mattab deleted the missingdeps_activate branch September 23, 2016 03:57
@mattab mattab added the duplicate For issues that already existed in our issue tracker and were reported previously. label Sep 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate For issues that already existed in our issue tracker and were reported previously. Needs Review PRs that need a code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants