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

Fixed issue #17421: When upgrading from LS3 to LS4 / 5, plugin Manager can't be used if non-compatible plugins are found #2004

Conversation

gabrieljenik
Copy link
Collaborator

No description provided.

…r can't be used if non-compatible plugins are found
@olleharstedt
Copy link
Collaborator

Also see this issue: https://bugs.limesurvey.org/view.php?id=17516

Copy link
Collaborator Author

@gabrieljenik gabrieljenik left a comment

Choose a reason for hiding this comment

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

application/controllers/admin/PluginManagerController.php Outdated Show resolved Hide resolved
@gabrieljenik
Copy link
Collaborator Author

To highlight: If plugin is missing or is not compatible, it will be uninstalled

@olleharstedt
Copy link
Collaborator

To highlight: If plugin is missing or is not compatible, it will be uninstalled

Right, but this procedure might need to happen after db update too, not only when entering the plugin manager.

…r can't be used if non-compatible plugins are found

- Create PluginCleaner
…r can't be used if non-compatible plugins are found

- Improve PluginCleaner
try {
$config = $this->getExtensionConfig();
return $config->isCompatible();
} catch (\Exception $ex) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Which exception are you catching here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Any exception from the getExtensionConfig or the isCompatible method.
Example: 'Missing configuration file for plugin %s, looked in location %s',

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hm, do we want to silence that? Try-catch usually makes better sense higher up in the stacktrace, e.g. in a controller or such.

Copy link
Collaborator

Choose a reason for hiding this comment

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

By returning false we lose important information.

Copy link
Collaborator Author

@gabrieljenik gabrieljenik Aug 24, 2021

Choose a reason for hiding this comment

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

There could be lot of malformations in config.xml files, missing config.xml files and even other situations not thought.
As so, any of those situations can be considered as a non compatibility.
By that is that we return false.

If not returning false, we should look up every usage of ->isCompatible() and add try/catch.
Still, not sure if that handling would be much different.

Maybe, to inform the error we could add an optional parameter with the exception caught? or add an attribute to store the nonCompatibleException

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can't really merge this since all information in the exception is gone. An alternative could be to return [false, $ex->getMessage()]. Not sure that's much different than just not catch it, tho. :)

…r can't be used if non-compatible plugins are found

- Fix error when plugin_type is invalid
- Don't set flash messages on PluginCleaner
- Add LSYii_Application::setFlashMessages() for convenience
…r can't be used if non-compatible plugins are found

- Add missing file
try {
$config = $this->getExtensionConfig();
return $config->isCompatible();
} catch (\Exception $ex) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can't really merge this since all information in the exception is gone. An alternative could be to return [false, $ex->getMessage()]. Not sure that's much different than just not catch it, tho. :)

@olleharstedt
Copy link
Collaborator

Ahmed argues that this fix is not needed, it's not an issue. Can you still reproduce it, @gabrieljenik? Without this fix.

@olleharstedt
Copy link
Collaborator

Sorry, I'll close this for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants