Skip to content
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

Move methods away from Live controller #12406

Merged
merged 3 commits into from Feb 26, 2018
Merged

Move methods away from Live controller #12406

merged 3 commits into from Feb 26, 2018

Conversation

sgiehl
Copy link
Member

@sgiehl sgiehl commented Jan 6, 2018

fixes #12394

@sgiehl sgiehl added Needs Review PRs that need a code review not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. labels Jan 6, 2018
@sgiehl sgiehl added this to the 3.3.0 milestone Jan 6, 2018
@sgiehl sgiehl requested a review from tsteur January 7, 2018 20:17
* @return ProfileSummaryAbstract[]
* @throws \Exception
*/
public static function getAllProfileSummaryInstances()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally this would be moved into a class named eg LiveProvider or ProfileProvider + not be static to be consistent with core. Also applies to getAllProfileSummaryClasses .

The plugin class itself should have only a few lines of code related to events/hooks...

@@ -114,4 +122,91 @@ public function renderVisitorIcons(&$renderedDetails, $visitorDetails)
$renderedDetails .= $instance->renderIcons($visitorDetails);
}
}

public static function getSegmentWithVisitorId()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this could be moved into a different class outside the Plugin class?

Also is the cache needed here or can we maybe use transient cache so it will be also invalidated between tests etc?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure where it would be useful to move that method to.

I guess the cache is there to prevent Request::processRequest('Live.getMostRecentVisitorId') being called multiple times with different results. Guess using transient cache should be fine as well...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Be very useful to add this as a comment 👍 as we will otherwise eventually introduce a bug here when someone removes the caches (it looks like it isn't needed.)

@sgiehl
Copy link
Member Author

sgiehl commented Feb 26, 2018

@tsteur would you have some time for another review on this? Would be good to merge some more of the open PRs

@tsteur
Copy link
Member

tsteur commented Feb 26, 2018

Just tested and worked. Be good to add the other comment, otherwise good to merge.

@sgiehl
Copy link
Member Author

sgiehl commented Feb 26, 2018

Ok. I've added the comment. Will now wait for the tests before merging...

@sgiehl sgiehl modified the milestones: 3.4.0, 3.3.1 Feb 26, 2018
@sgiehl sgiehl merged commit 9ff807e into 3.x-dev Feb 26, 2018
@sgiehl sgiehl deleted the livecleanup branch February 26, 2018 19:07
InfinityVoid pushed a commit to InfinityVoid/matomo that referenced this pull request Oct 11, 2018
* move methods away from Live controller

* Add new class ProfileSummaryProvider

* use transient cache instead of static variable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move public static functions out of Live controller
2 participants