@diosmosis opened this Pull Request on March 22nd 2021 Member

Description:

Fixes #17366

Review

  • [ ] Functional review done
  • [ ] Potential edge cases thought about (behavior of the code with strange input, with strange internal state or possible interactions with other Matomo subsystems)
  • [ ] 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
@flamisz commented on March 22nd 2021 Contributor

Do we want to change the default settings in the global.ini.php. Currently, it is last6.

What about the other files where we use this setting? We still check for substr in plugins/CustomReports/Controller.php or plugins/CustomReports/Widgets/GetManageReports.php.

if (isset($general['rearchive_reports_in_past_last_n_months'])) {
    $reArchiveLastN = (int) substr($general['rearchive_reports_in_past_last_n_months'], 4);
}
@diosmosis commented on March 22nd 2021 Member

Do we want to change the default settings in the global.ini.php. Currently, it is last6.

this is up to @tsteur

We still check for substr in plugins/CustomReports/Controller.php or plugins/CustomReports/Widgets/GetManageReports.php.

A PR exists for those now.

@tsteur commented on March 22nd 2021 Member

Either last6 or 6 is fine regarding the default setting. No preference.

@diosmosis commented on March 22nd 2021 Member

thanks for the quick review @flamisz :+1:

@nelhefni commented on March 23rd 2021

@diosmosis thanks for the fix! This should help to fix this issue: https://forum.matomo.org/t/new-funnel-triggers-past-report-generation/41152/4
Before your fix, rearchive_reports_in_past_last_n_months = 0 would throw an exception, because empty(0) is true, meaninggetEarliestDateToRearchive() was returning null instead of the current month, leading to an issue in the calling method.

That being said, there is still a problem. If I set rearchive_reports_in_past_last_n_months = 0 I would expect no past report to be generated when I update a Funnel, but because of setDay(1) we will always re-generate report since the first day of the current month.
https://github.com/matomo-org/matomo/blob/4.x-dev/core/Archive/ArchiveInvalidator.php#L806

@diosmosis commented on March 23rd 2021 Member

good catch @nelhefni, i'll fix this today

This Pull Request was closed on March 23rd 2021
Powered by GitHub Issue Mirror