@tsteur opened this Pull Request on January 30th 2019 Member

Adjusted most usages except for LanguagesManager.getAvailableTranslationsInfo (or similar).

refs https://github.com/matomo-org/matomo/issues/12988

Basically, we already support a bootstrap.php in the root folder in which a user could place eg

$GLOBALS['MATOMO_PLUGIN_DIRS'] = array(
    array(
        'pluginsPathAbsolute' => realpath(PIWIK_INCLUDE_PATH . 'tests/resources/custompluginsdir'),
        'webrootDirRelativeToMatomo' => '../../resources/custompluginsdir'
    ),
);

to pick up plugins from other directories. Each dir should contain plugins... simple test works so far but need to check further.

Out of scope: Same plugin in multiple folders. No support for themes.

@tsteur commented on January 30th 2019 Member

Not sure how to best test this... I reckon we would need to place like a dummy plugin into a tests/resources folder and see if Matomo still works and picks it up? The problem is the functionality is used in many places... I assume when regular tests still work it is also a sign that everything seems to work nicely... to be seen.

@diosmosis commented on February 3rd 2019 Member

Not sure how to best test this... I reckon we would need to place like a dummy plugin into a tests/resources folder and see if Matomo still works and picks it up?

I think this works, the dummy plugin could be generated in UITestFixture. I think it would be good to make it a tracker plugin too and generate it before loading the OmniFixture dump. Then if the UI tests pass, we have a reasonable confirmation it works.

@diosmosis commented on February 4th 2019 Member

Any need to update the changelog for this?

@tsteur commented on February 5th 2019 Member

Any need to update the changelog for this?

I'll add one to let developers know to not hard code plugins directory 👍

I think this works, the dummy plugin could be generated in UITestFixture. I think it would be good to make it a tracker plugin too and generate it before loading the OmniFixture dump. Then if the UI tests pass, we have a reasonable confirmation it works.

Just wondering what plugins to add there or what functionality... guess will just pretty much copy the example plugins... was wondering if I should just move all example plugins in a custom directory... problem is there are some links pointing to those example directories and not sure where all those places are. also it is kind of nice to have the example plugins next to the other plugins.

note to myself: Need to check that classes with Piwik\Plugins\... can still be autoloaded correctly as some features rely on extracting the plugin name from the class name.

@diosmosis commented on February 5th 2019 Member

I was just thinking of creating a simple plugin to the custom directory. I don't think it needs to be that complex, since you're just changing plugin paths here. I wouldn't it to expect it to affect anything other than what plugins are loaded/recognized. I guess we could add a simple report/API method? Maybe not something that gets shown in the dashboard, since those already have so many widgets...

@diosmosis commented on February 5th 2019 Member

I'll add one to let developers know to not hard code plugins directory

Would it also be useful to mention the global & env var? This could be useful to some devs I think.

@tsteur commented on February 5th 2019 Member

Updated changelog and adding the tests... I'll simply add the directory always so it is implied in all tests...

The only problem I see so far are assets (JS/CSS)... so far we can only define a relative path, and it is assumed this relative path is located within the matomo directory.

It may be located outside the matomo directory though... for this I would kind of need to define like an array ('absolutePath' => '/....', 'webPath' => 'https://www.web.de...'). The problem with this might be that we can't simply put plugins in another directory but they need to be aware of this. Not sure yet...

eg Matomo runs under https://www.example.com/install/matomo/foo and plugin runs under https://www.example.com/install/plugins/... need to think more.

@tsteur commented on February 5th 2019 Member

fyi: configuration will need to be a bit more complex in some cases... eg we may require to define webrootDirectory etc. when plugins folder is outside matomo directory...

Powered by GitHub Issue Mirror