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

When generating a plugin we should require at least the developer's Piwik version #6149

Closed
tsteur opened this issue Sep 7, 2014 · 4 comments
Assignees
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Milestone

Comments

@tsteur
Copy link
Member

tsteur commented Sep 7, 2014

When a developer generates a plugin we assume the plugin is compatible with Piwik 2.0.0 and later as we do not specify the requires property in plugin.json file.

I assume a developer is usually using the latest version from Git or one of the latest two Piwik versions. It is very unlikely that a plugin developer will also install Piwik 2.0.0 version of the plugin and test it with that version. Since we added many new plugin and theme API's since 2.0.0 it is not very likely that the plugin will be actually compatible with older versions of Piwik. I doubt any developer would read all of our guides and notice somewhere that he should set the required Piwik version in plugin.json manually. Even if one does it can be hard to find out what the minimum version is he has to require since he might use different API's.

So when creating a new plugin we should require at least the Piwik version a developer currently uses as we can assume it will work at least with this version.

When generating a component the templates often require a new version as well but they do not update the required Piwik version. Imagine you generate a plugin in Piwik 2.4.0 and the required Piwik version would be Piwik 2.4.0. Later you are creating a menu using generate:menu in Piwik 2.5.0. The menu template we will create for the developer will only work on Piwik 2.5.0 or later as we added the new API there. This will unavoidably lead to an error on Piwik 2.4.* installations which a developer cannot notice since he is using Piwik 2.5.0 meanwhile. So a generated component should update the required Piwik version if needed and inform the user about this. Either upfront before generating the component by asking for confirmation or afterwards. I'd say afterwards is enough.

This is already a rather critical problem for the platform now. I just wanted to update the complex and confusing controller example which uses for instance the View class and the mysterious setBasicVariablesView() method instead of the new easy renderTemplate() method but noticed this would only work on latest Piwik versions. Also if a user generates a Menu, a Report, a Task, a Widget this plugin will fail on older versions already. Probably this is already the case for some plugins on the Marketplace!

@tsteur tsteur added the Bug For errors / faults / flaws / inconsistencies etc. label Sep 7, 2014
@tsteur tsteur added this to the Piwik 2.7.0 milestone Sep 7, 2014
tsteur added a commit that referenced this issue Sep 7, 2014
…in. Still todo: update plugin.json when generating a component. Also improved the controller example/template
@piwik-travis-automation piwik-travis-automation modified the milestones: Piwik 2.8.0, Piwik 2.7.0 Sep 9, 2014
@tsteur
Copy link
Member Author

tsteur commented Sep 23, 2014

I was working on updating the required Piwik version in plugin.json when a developer generates a new component. Noticed it is even more complex than I thought since we'd also have to consider if for instance already a Piwik version "<=2.6.0" is defined and then someone creates a controller which requires ">=2.7.0" we end up having a problem. We'd have to cancel the generation and show a message "Incompatible versions ..." but we could not tell what exactly is incompatible which is kinda annoying.

Problem is also that we have to maintain the minimum required Piwik version for each generator manually. As soon as we change something in an API that is used by an example plugin we'd have to remember to change the required version again in the generator. Don't think this will work.

So far I think the only practical solution is to always require at least the developers Piwik version when generating a new component via the console as we can assume it works on his instance and because of backwards compatibility should work on other instances as well. Nice benefit is it can motivate users to upgrade their Piwik instance when they see an interesting plugin requires a newer Piwik version.

If already a required Piwik version is defined starting with "<", "<=" or "==" and the current version does not match we will trigger an error like "Cannot generate component, required Piwik version is not compatible. To fix ..."

@tsteur
Copy link
Member Author

tsteur commented Sep 23, 2014

A downside is, if different developers are working on a plugin, and they develop using different Piwik versions, one of them might not be able to generate anything anymore. Imagine "Piwik >=2.5.0 is required". Developer A generates new component and it increases required Piwik version to "Piwik >=2.6.0". Developer B using Piwik 2.5.0 will no longer be able to use this plugin or to generate a component for it. This can be good and bad. They would manually have to change the required Piwik version again. It might make sense to output an "information" about the changed Piwik version if we do so

tsteur added a commit that referenced this issue Sep 23, 2014
…ik version and perform a check to make sure this component will be compatible with the current required Piwik version
@tsteur
Copy link
Member Author

tsteur commented Sep 23, 2014

If someone does not want to increase the Piwik version after generating a component, the person will have to revert the change manually after generating the component.

@tsteur tsteur modified the milestones: Piwik 2.7.0, Piwik 2.8.0 Sep 23, 2014
@tsteur tsteur closed this as completed Sep 23, 2014
@mattab
Copy link
Member

mattab commented Sep 23, 2014

Nice benefit is it can motivate users to upgrade their Piwik instance when they see an interesting plugin requires a newer Piwik version.

+1, looks good to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Projects
None yet
Development

No branches or pull requests

3 participants