Fix for current year not processed for new custom reports #19569
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
Steps to recreate:
./console core:archive
period = year
- only the previous year is processed, not the current year.When archiving starts for a custom report, a check is done for any existing archives and if missing then invalidations are created for each period in the current year: days, weeks, months and year. These are created correctly with one invalidation for the current year (2022).
After processing each period the
core/CronArchive::repairInvalidationsIfNeeded
method is run to make sure any higher level invalidations exist (eg. if a week was just updated then make sure the higher level month and year are invalidated as those figures will have changed)This doesn't cause any problems for day periods as every processed day will be in the current year, months also never span years.
However if there is a week which spans the previous and current year (eg. Monday 2021-12-27 to Sunday 2022-01-02) then
repairInvalidationIfNeeded
will look for a year invalidation for 2021 (the week's start date year) and when it fails to find one it will replace the previously created 2022 year invalidation with a 2021 year invalidation.This results in no archive for the current year and an unnecessary archive for the previous year.
This PR adds a simple check to skip any attempt to repair a year validation if the week spans more than one year, a similar check already exists for weeks that span two months. (#16886 (comment))
As
repairInvalidationIfNeeded
is part of the main archiving process this issue likely affects all archiving and is not specific to Custom Reports.Ref L3-290
Also looks like it Fixes #18343
Review