matomo-org / matomo

Empowering People Ethically with the leading open source alternative to Google Analytics that gives you full control over your data. Matomo lets you easily collect data from websites & apps and visualise this data and extract insights. Privacy is built-in. Liberating Web Analytics. Star us on Github? +1. And we love Pull Requests!
https://matomo.org/
GNU General Public License v3.0
19.66k stars 2.62k forks source link

Do not use a plugin unless it is actually installed #9216

Open tsteur opened 8 years ago

tsteur commented 8 years ago

See https://github.com/piwik/piwik/issues/9201#issue-116481202

We should only use components, events, ... of a plugin when it is actually installed to prevent random errors. The installation of a plugin may take a while (between a few ms and up to days). Only once the plugin is actually loaded, activated and installed we should use it.

For example plugins won't be installed during tracker mode but if we use them there already even though they are not installed yet it will very likely break tracking. Also for non-tracker plugins it can prevent errors.

I tried to implement it recently but failed. Only hours afterwards I noticed the tests fail because we always assume plugins are uninstalled in TestConfig. While it's not hard to implement ignoring events, API methods and components of uninstalled plugins, making the tests work will be quite a bit of work from the looks.

Eg we need to add more plugins to the PluginsInstalled list in global.ini.php. Otherwise ./console won't show any commands. We need to add at least CoreConsole and TestRunner. Once this is done we will need to move some tests from Unit to Integration since they were placed in the wrong category. Once unit tests succeed the actual work begins as many tests only do ->loadPlugin('API') but it's not done by that. We also need to install them etc.

mattab commented 8 years ago

@tsteur which milestone do you think we should schedule for? is it easy to change or rather non trivial?

tsteur commented 8 years ago

It is trivial to implement and to make it kinda work for normal use but tests require lots of work. I don't think we can break much there but would rather target 3.X