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
Add idSegments as SQL comment in segment archiving SQL #8809
Conversation
@@ -49,6 +49,11 @@ public function __construct($string) | |||
$this->tree = $this->parseTree(); | |||
} | |||
|
|||
public function getSegmentString() |
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 there be maybe a better name instead of ...String
? It's not important is it's not API though so can be ignored. Also not sure what to use instead. getSegmentExpression
could be misleading possibly.
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 change it to getSegmentDefinition()
.
Left a few comments maybe you can have a look if something needs to be done or not |
c969c79
to
4032c6c
Compare
Noticed there's an integration test failing: https://travis-ci.org/piwik/piwik/jobs/81498450#L703 |
…s matching the segment being archiving in a comment in SQL. Includes addition of SegmentEditor::getSegmentsToAutoArchive() API method which caches the result so each individual aggregation query doesn't trigger an SQL query.
4032c6c
to
7013b23
Compare
…. Instead use new service-layer class that is not accessible from API and does not do access checking.
7013b23
to
055481d
Compare
Ready for review and/or merge. |
$segmentEditorApi->add('segment 3', 'visitCount<2', 1, $autoArchive = true); | ||
$segmentEditorApi->add('segment 4', 'visitCount<2', 2, $autoArchive = true); | ||
|
||
// test that segments w/ auto archive == false aren't included |
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.
segments w/ auto archive === false should also be included, since it's useful to know those segment IDs...
optional: display trigger = archive
in the comment when core:archive
triggered the query
…ny matching stored segment ID, even if not set to auto-archive and also decorate w/ special message if the SQL was triggered by core:archive.
@mattab Ready for another review. |
Add idSegments as SQL comment in segment archiving SQL
👍 |
This PR adds a comment like
/* idSegments = [1, 2, 3] */
to all segment archiving SQL, if the requested segment matches the definition of a stored segment.The addition is made non-intrusively by decorating LogQueryBuilder, instead of referencing SegmentEditor in core. This change should function, even if the SegmentEditor plugin is disabled.
Fixes #8752
Additional Changes
TODO