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

in cache buster only look at activated plugins, not loaded plugins #16880

Merged
merged 1 commit into from May 27, 2021

Conversation

tsteur
Copy link
Member

@tsteur tsteur commented Dec 3, 2020

Description:

This might fix #16672 . We could see if it then happens again. There's probably not much point in writing a test for it because it wouldn't really test the real scenario I suppose. Generally the thought is cache buster should only include active plugins, not loaded plugins. Maybe tag manager was loaded for this user but not activated.

Review

  • Functional review done
  • Usability review done (is anything maybe unclear or think about anything that would cause people to reach out to support)
  • Security review done see checklist
  • Code review done
  • Tests were added if useful/possible
  • Reviewed for breaking changes
  • Developer changelog updated if needed
  • Documentation added if needed
  • Existing documentation updated if needed

@tsteur tsteur added not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. Needs Review PRs that need a code review labels Dec 3, 2020
@tsteur tsteur added this to the 4.2.0 milestone Dec 3, 2020
@mattab mattab modified the milestones: 4.4.0, 4.3.0 May 26, 2021
sort($plugins);

$pluginsInfo = '';
foreach ($plugins as $pluginName) {
$plugin = Manager::getInstance()->getLoadedPlugin($pluginName);
$pluginsInfo .= $plugin->getPluginName() . $plugin->getVersion() . ',';
if ($manager->isPluginLoaded($pluginName)) {
Copy link
Member

Choose a reason for hiding this comment

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

Should we do this check here? If a plugin is in the activated plugins list, but for some reason isn't loaded, shouldn't the cache buster stay the same? I think we'd only change it if a plugin is activated or deactivated, not if a plugin isn't loaded for some reason.

Copy link
Member Author

Choose a reason for hiding this comment

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

@diosmosis I'm not 100% sure but here's my thought. The asset manager posts an event to get all JS or CSS files. The event dispatcher in https://github.com/matomo-org/matomo/blob/4.3.1/core/EventDispatcher.php#L97 uses getPluginsLoadedAndActivated() and events will be only posted to plugins that are active and loaded.

Meaning the hash would need to change if suddenly a plugin is loaded that wasn't loaded before because the JS/CSS would change too. I'm assuming a plugin may be activated but not loaded if it's missing from the filesystem (eg temporarily). Maybe there are also other reasons like when we unload a plugin in WhiteLabel etc.

I would probably keep the check but not 100% sure if it the thinking makes sense

Copy link
Member

Choose a reason for hiding this comment

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

I see, no your logic makes sense. The plugins used are the ones that are specifically used to generate the JS/CSS, and there can be a discrepancy with the list of activated plugins and list of loaded plugins.

@diosmosis diosmosis merged commit 441f22f into 4.x-dev May 27, 2021
@diosmosis diosmosis deleted the cachebusterfix branch May 27, 2021 04:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

In Tag Manager, Manage Containers page is blank
3 participants