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

check plugin exists in the filesystem on plugin activate command #17772

Merged
merged 4 commits into from Jul 19, 2021

Conversation

diosmosis
Copy link
Member

Description:

If a plugin doesn't have a Plugin class, the plugin manager just uses new Plugin($pluginName). Calling getMissingDependencies() immediately after triggers the plugin install code path, which adds the nonexistent plugin to the INI config. Now we check and provide a clear error message in the commands, and make sure we only try to load plugins that exist in the filesystem.

Fixes #17770

Review

  • Functional review done
  • Potential edge cases thought about (behavior of the code with strange input, with strange internal state or possible interactions with other Matomo subsystems)
  • Usability review done (is anything maybe unclear or think about anything that would cause people to reach out to support)
  • Security review done see checklist
  • Code review done
  • Tests were added if useful/possible
  • Reviewed for breaking changes
  • Developer changelog updated if needed
  • Documentation added if needed
  • Existing documentation updated if needed

@diosmosis diosmosis added not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. Needs Review PRs that need a code review labels Jul 14, 2021
@diosmosis diosmosis added this to the 4.4.0 milestone Jul 14, 2021
core/Plugin/Manager.php Outdated Show resolved Hide resolved
Comment on lines 41 to 44
if (!$pluginManager->isPluginInFilesystem($plugin)) {
$output->writeln("<error>Cannot find plugin files for $plugin.</error>");
continue;
}
Copy link
Member

Choose a reason for hiding this comment

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

Does that check make sense here?
If a plugin name is provided that was never installed (is not included in plugin list in config.ini.php), the method will already fail with already deactivated. If it was installed, but only removed from file system it might make sense to allow a deactivation so it gets removed from the plugin list in config.ini.php and it's no longer tried to load it anymore.

Copy link
Member Author

Choose a reason for hiding this comment

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

👍 makes sense to me

@diosmosis
Copy link
Member Author

@sgiehl updated

@diosmosis diosmosis changed the title check plugin is activated/deactivated in plugin check plugin exists in the filesystem on plugin activate command Jul 18, 2021
@sgiehl sgiehl merged commit f44f11a into 4.x-dev Jul 19, 2021
@sgiehl sgiehl deleted the 17770-check-plugin-exists branch July 19, 2021 07:57
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
3 participants