From 69a65613e645cbd153221ca1bbdd5d9d0e2b08b4 Mon Sep 17 00:00:00 2001 From: Stefan Giehl Date: Tue, 28 Apr 2020 07:27:16 +0200 Subject: Removes deprecated event Live.getAllVisitorDetails (#15866) --- CHANGELOG.md | 1 + plugins/ExampleTracker/ExampleTracker.php | 15 --------------- plugins/ExampleTracker/VisitorDetails.php | 5 +++++ plugins/Live/Visitor.php | 21 --------------------- 4 files changed, 6 insertions(+), 36 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ad3b403640..8322e43485 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,6 +52,7 @@ The Product Changelog at **[matomo.org/changelog](https://matomo.org/changelog)* * The method `Dimension::addSegment()` has been removed. See new implementation of `DimensionSegmentFactory::createSegment` for a replacement * The signature of the event `Segment.addSegments` has been changed. It now has one parameter `SegmentsList $list`, which allows adding new segments to the list * The json2 API format is now removed, and the json renderer now behaves as the json2 renderer did. This means when `format=json` is used, arrays like `['a' => 0, 'b' => 1]` will be rendered in JSON as `{"a":0,"b":1}` instead of `[{"a":0,"b":1}]`. +* The event `Live.getAllVisitorDetails` has been removed. Use a `VisitorDetails` class instead (see Live plugin). ## Matomo 3.13.5 diff --git a/plugins/ExampleTracker/ExampleTracker.php b/plugins/ExampleTracker/ExampleTracker.php index e449dc42e1..959a5018c0 100644 --- a/plugins/ExampleTracker/ExampleTracker.php +++ b/plugins/ExampleTracker/ExampleTracker.php @@ -8,25 +8,10 @@ */ namespace Piwik\Plugins\ExampleTracker; -use Piwik\Common; -use Piwik\Plugins\Live\Visitor; - class ExampleTracker extends \Piwik\Plugin { - public function registerEvents() - { - return [ - 'Live.getAllVisitorDetails' => 'getAllVisitorDetails', - ]; - } - public function isTrackerPlugin() { return true; } - - public function getAllVisitorDetails(&$visitor, $visitorRawData) - { - $visitor['myCustomVisitParam'] = isset($visitorRawData['example_visit_dimension']) ? $visitorRawData['example_visit_dimension'] : 'no-value'; - } } diff --git a/plugins/ExampleTracker/VisitorDetails.php b/plugins/ExampleTracker/VisitorDetails.php index 2b8a2531ea..403f7f0bba 100644 --- a/plugins/ExampleTracker/VisitorDetails.php +++ b/plugins/ExampleTracker/VisitorDetails.php @@ -14,6 +14,11 @@ use Piwik\View; class VisitorDetails extends VisitorDetailsAbstract { + public function extendVisitorDetails(&$visitor) + { + $visitor['myCustomVisitParam'] = isset($this->details['example_visit_dimension']) ? $this->details['example_visit_dimension'] : 'no-value'; + } + public function renderIcons($visitorDetails) { if (empty($visitorDetails['myCustomVisitParam'])) { diff --git a/plugins/Live/Visitor.php b/plugins/Live/Visitor.php index 8892ab94b7..9267b80d73 100644 --- a/plugins/Live/Visitor.php +++ b/plugins/Live/Visitor.php @@ -39,27 +39,6 @@ class Visitor implements VisitorInterface $instance->extendVisitorDetails($visitor); } - /** - * This event can be used to add any details to a visitor. The visitor's details are for instance used in - * API requests like 'Live.getVisitorProfile' and 'Live.getLastVisitDetails'. This can be useful for instance - * in case your plugin defines any visit dimensions and you want to add the value of your dimension to a user. - * It can be also useful if you want to enrich a visitor with custom fields based on other fields or if you - * want to change or remove any fields from the user. - * - * **Example** - * - * Piwik::addAction('Live.getAllVisitorDetails', function (&visitor, $details) { - * $visitor['userPoints'] = $details['actions'] + $details['events'] + $details['searches']; - * unset($visitor['anyFieldYouWantToRemove']); - * }); - * - * @param array &visitor You can add or remove fields to the visitor array and it will reflected in the API output - * @param array $details The details array contains all visit dimensions (columns of log_visit table) - * - * @deprecated will be removed in Piwik 4 - */ - Piwik::postEvent('Live.getAllVisitorDetails', array(&$visitor, $this->details)); - return $visitor; } -- cgit v1.2.3