Ticket #1169 (new Bug)

Opened 2 years ago

Last modified 2 months ago

Implement and document hooks priority

Reported by: matt Owned by:
Priority: major Milestone: Feature requests
Component: Core Keywords:
Cc: Sensitive: no

Description

See use case of plugin #1168

Hooks should be executed in a certain order, so that some plugins modify the data and other can access the recorded data. In some cases, it is not possible to add new hooks as a given data point (eg. the user IP) can be modified by several hooks.

The hook registration should maybe be a function call rather than the current array format. This function would have a priority parameter that would define, from 1 to 100, the priority at which the function should be called. For example, plugins that modify the data and needs to access its raw state, they would set priority=1. Plugins that record the data would set 100. Hooks that modify the value after basic filters would set priority=50.

The range could maybe be from 1 to 10. I am not sure of any code standard regarding this pattern? Also, this is similar to filter priority in wordpress hooks.

Change History

Changed 19 months ago by matt

  • milestone changed from 2 - Piwik 0.8 - A Web Analytics platform to Features requests - after Piwik 1.0

Changed 2 months ago by matt

(In [5474]) Refs #1169

  • A good example of why we need event priority/ordering so that a plugin can execute first or last or anytime, for a given hook.

Imagegraph was missing a few plugin images because it was executed before the Goals plugin added additional ecommerce reports.

  • Adding debug define to force scheduled tasks to run
Note: See TracTickets for help on using tickets.