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
Allow plugin to decide about archiving without visits #10719
Conversation
e6a042a
to
9541a43
Compare
In #8631 (comment) I mention how nice it would be to have an |
Actually, is this method even needed or could it be solved with the event |
and I wonder if you maybe need an event in https://github.com/piwik/piwik/blob/3.x-dev/core/CronArchive.php#L820 ? |
Imho this doesn't replace kind of a This extension is somehow an improvement to I'll have a look at |
I understand. I wonder if we could then deprecate / remove the |
Thought about deprecating it, as well. But there are use cases like |
Had a short look at Maybe it's a bit late. Will have another look tomorrow... |
9541a43
to
ac77fce
Compare
ac77fce
to
3e8365a
Compare
@sgiehl assigning tentatively to 3.0.0-b4 - maybe we'll make progress by then |
3e8365a
to
2993d87
Compare
I had another look at that one. But I'm currently not sure if the implementation is the best now. Actually the "base" archiving for day period is running always, only archiving for segments will be executed only if there had been visits. Another solution that we maybe could discuss would be to always trigger archiving for everything in CronArchive and let the archiving process decide what to archive or not. |
2993d87
to
44e90ee
Compare
44e90ee
to
49ec4fc
Compare
49ec4fc
to
f822589
Compare
7813e32
to
be4b4c1
Compare
8ddc899
to
4c55659
Compare
@sgiehl should we create an issue for Piwik 4 to deprecate the event |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming it works (which I haven't tested), and after few comments here, looks good to me.
@@ -44,6 +44,7 @@ If the tracker is not initialised correctly, the browser console will display th | |||
* The creation of settings has slightly changed to improve performance. It is now possible to create new settings via the method `$this->makeSetting()` see `Piwik\Plugins\ExampleSettingsPlugin\SystemSettings` for an example. | |||
* It is no longer possible to define an introduction text for settings. | |||
* If requesting multipe periods for one report, the keys that define the range are no longer translated. For example before 3.0 an API response may contain: `<result date="From 2010-02-01 to 2010-02-07">` which is now `<result date="2010-02-01,2010-02-07">`. | |||
* The method `Piwik\Plugin\Archiver::shouldRunWithoutVisits()` has been added. It gives plugin archivers the possibility to decide whether to run if there weren't any visits by overwriting this method. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we maybe rename the method from shouldRunWithoutVisits
to shouldRunEvenWhenNoVisit
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor but would write it like By overwriting this method and returning true, a plugin archiver can force the archiving to run even when there was no visit for the website/date/period/segment combination (by default, archivers are skipped when there is no visit)
or so (and would use similar wording in the method documentation itself as well)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I'll change that
{ | ||
PluginsArchiver::$archivers['VisitsSummary'] = 'Piwik\Tests\Integration\ArchiveWithNoVisitsTest_MockArchiver'; | ||
|
||
ArchiveWithNoVisitsTest_MockArchiver::$runWithoutVisits = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's add the similar test case with runWithoutVisits = false so the different behavior can be seen
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's what a part of the test before is doing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok got it now, maybe for clarity you could split the other test in two? Since when we will deprecate the event we might remove the other test without seeing it was testing another useful case. LGTM otherwise 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've splitted the tests in 9681533
98bec9c
to
60f495e
Compare
60f495e
to
f4f7b76
Compare
@@ -44,6 +44,7 @@ If the tracker is not initialised correctly, the browser console will display th | |||
* The creation of settings has slightly changed to improve performance. It is now possible to create new settings via the method `$this->makeSetting()` see `Piwik\Plugins\ExampleSettingsPlugin\SystemSettings` for an example. | |||
* It is no longer possible to define an introduction text for settings. | |||
* If requesting multipe periods for one report, the keys that define the range are no longer translated. For example before 3.0 an API response may contain: `<result date="From 2010-02-01 to 2010-02-07">` which is now `<result date="2010-02-01,2010-02-07">`. | |||
* The method `Piwik\Plugin\Archiver::shouldRunEvenWhenNoVisits()` has been added. By overwriting this method and returning true, a plugin archiver can force the archiving to run even when there was no visit for the website/date/period/segment combination (by default, archivers are skipped when there is no visit). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll move this to the 3.0.1 section
At the moment no plugin archiver will be executed if there are no visits for the archived period.
In some cases it would be useful for plugins to be able to archive data even if there are no visits for the archived period.
(The existing possibility to force all archivers to run for a specific site if there are no visists might be a bit to "much" in some cases.)