Navigation Menu

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

Use custom namespace for plugins? #6643

Closed
mnapoli opened this issue Nov 11, 2014 · 4 comments
Closed

Use custom namespace for plugins? #6643

mnapoli opened this issue Nov 11, 2014 · 4 comments
Labels
c: Platform For Matomo platform changes that aren't impacting any of our APIs but improve the core itself. Task Indicates an issue is neither a feature nor a bug and it's purely a "technical" change. wontfix If you can reproduce this issue, please reopen the issue or create a new one describing it.
Milestone

Comments

@mnapoli
Copy link
Contributor

mnapoli commented Nov 11, 2014

Currently plugins are expected to by in the Piwik\Plugin namespace.

This is not really ideal as it defeats the purpose of namespaces:

  • risk of clashes/conflicts between different vendors releasing a similar plugin
  • no separation of code between vendors/projects

It would be better if, for example, Piwik PRO plugins were in a PiwikPro namespace (or similar).

Do you agree with this? And if so, how can we do it?

It seems related to the constraint that plugins must be in the plugins/ directory, and the whole "install plugins with Composer" topic.

@mnapoli mnapoli added the c: Platform For Matomo platform changes that aren't impacting any of our APIs but improve the core itself. label Nov 11, 2014
@diosmosis
Copy link
Member

There's a lot (or maybe just some) code that depends on plugins being in Piwik\Plugins. For example, the name of a plugin is obtained from the namespace by looking for Piwik\Plugins{Name}. Maybe DI can be used (ie, Plugin objects are added to DI, and these objects are used to determine all needed info). So we don't have to care about what namespace or folder they're in?

@mnapoli
Copy link
Contributor Author

mnapoli commented Nov 12, 2014

Maybe DI can be used (ie, Plugin objects are added to DI, and these objects are used to determine all needed info).

Ideally yes! In the config there's a list of installed plugins. I guess that means that we can use it for finding plugins instead of relying on the naming. Then later we might move that list into the DI configuration.

@diosmosis
Copy link
Member

Ok, for the 'get plugin name from namespace' issue, we could do something like:

foreach ($pluginsLoadedAndActivated as $plugin) {
    if ($plugin->getNamespace() == $namespaceWereLookingFor) {
        return $plugin;
    }
}

Not sure what other parts of Piwik depend on the plugin namespace.

@mattab
Copy link
Member

mattab commented Nov 12, 2014

I'm not sure there are enough benefits for the cost involved of changing it. Moving to mid term. let me know if you disagree and think this is more important

@mattab mattab added this to the Mid term milestone Nov 12, 2014
@mattab mattab added the Task Indicates an issue is neither a feature nor a bug and it's purely a "technical" change. label Dec 1, 2014
@mattab mattab closed this as completed May 6, 2016
@mattab mattab added the wontfix If you can reproduce this issue, please reopen the issue or create a new one describing it. label May 6, 2016
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. Task Indicates an issue is neither a feature nor a bug and it's purely a "technical" change. wontfix If you can reproduce this issue, please reopen the issue or create a new one describing it.
Projects
None yet
Development

No branches or pull requests

3 participants