diff options
author | Stefan Giehl <stefan@piwik.org> | 2017-09-22 15:51:07 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-22 15:51:07 +0300 |
commit | a496005c7e79637daa379b61c2f03c1d1c99a18c (patch) | |
tree | a838a679279b863c683b87e3094a1973d7b32432 /plugins | |
parent | 7fb75c0e29c4523af6d81e8a4e92b0d4addc6bfd (diff) |
Make visitor profile wellformed XML (#12100)
* Make visitor profile wellformed XML
* update test files
Diffstat (limited to 'plugins')
3 files changed, 40 insertions, 9 deletions
diff --git a/plugins/Actions/VisitorDetails.php b/plugins/Actions/VisitorDetails.php index becb6cdaf7..1781593451 100644 --- a/plugins/Actions/VisitorDetails.php +++ b/plugins/Actions/VisitorDetails.php @@ -265,7 +265,14 @@ class VisitorDetails extends VisitorDetailsAbstract public function finalizeProfile($visits, &$profile) { arsort($this->visitedPageUrls); - $profile['visitedPages'] = $this->visitedPageUrls; + $profile['visitedPages'] = []; + + foreach ($this->visitedPageUrls as $visitedPageUrl => $count) { + $profile['visitedPages'][] = [ + 'url' => $visitedPageUrl, + 'count' => $count + ]; + } $this->handleSiteSearches($profile); $this->handleAveragePageGenerationTime($profile); diff --git a/plugins/Live/tests/System/expected/test___Live.getVisitorProfile.xml b/plugins/Live/tests/System/expected/test___Live.getVisitorProfile.xml index 94b05f931a..878232f0c4 100644 --- a/plugins/Live/tests/System/expected/test___Live.getVisitorProfile.xml +++ b/plugins/Live/tests/System/expected/test___Live.getVisitorProfile.xml @@ -1192,10 +1192,22 @@ </lastVisit> <visitsAggregated>10</visitsAggregated> <visitedPages> - <row key="http://example.org/my/dir/page0">8</row> - <row key="http://example.org/my/dir/page1">8</row> - <row key="http://example.org/my/dir/page2">8</row> - <row key="http://example.org/my/dir/page3">7</row> + <row> + <url>http://example.org/my/dir/page0</url> + <count>8</count> + </row> + <row> + <url>http://example.org/my/dir/page1</url> + <count>8</count> + </row> + <row> + <url>http://example.org/my/dir/page2</url> + <count>8</count> + </row> + <row> + <url>http://example.org/my/dir/page3</url> + <count>7</count> + </row> </visitedPages> <devices> <Unknown> diff --git a/plugins/Live/tests/System/expected/test_higherLimit__Live.getVisitorProfile.xml b/plugins/Live/tests/System/expected/test_higherLimit__Live.getVisitorProfile.xml index 481470e978..4071574fdc 100644 --- a/plugins/Live/tests/System/expected/test_higherLimit__Live.getVisitorProfile.xml +++ b/plugins/Live/tests/System/expected/test_higherLimit__Live.getVisitorProfile.xml @@ -2342,10 +2342,22 @@ </lastVisit> <visitsAggregated>20</visitsAggregated> <visitedPages> - <row key="http://example.org/my/dir/page0">8</row> - <row key="http://example.org/my/dir/page1">8</row> - <row key="http://example.org/my/dir/page2">8</row> - <row key="http://example.org/my/dir/page3">7</row> + <row> + <url>http://example.org/my/dir/page0</url> + <count>8</count> + </row> + <row> + <url>http://example.org/my/dir/page1</url> + <count>8</count> + </row> + <row> + <url>http://example.org/my/dir/page2</url> + <count>8</count> + </row> + <row> + <url>http://example.org/my/dir/page3</url> + <count>7</count> + </row> </visitedPages> <devices> <Unknown> |