Skip to content

Commit

Permalink
Merge branch '5.0.x-dev' into 5.x-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
mneudert committed Mar 8, 2024
2 parents c79e041 + 7b5e5f9 commit 5f6b344
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
script: |
core.setFailed('Release password didn\'t match.')
- name: "Check if user is allowed"
if: ${{ github.actor != 'mattab' && github.actor != 'tsteur' && github.actor != 'sgiehl' && github.actor != 'bx80' && github.actor != 'michalkleiner' && github.actor != 'caddoo'}}
if: ${{ github.actor != 'mattab' && github.actor != 'tsteur' && github.actor != 'sgiehl' && github.actor != 'mneudert' && github.actor != 'michalkleiner' && github.actor != 'caddoo'}}
uses: actions/github-script@v6
with:
script: |
Expand Down
2 changes: 1 addition & 1 deletion core/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ final class Version
* The current Matomo version.
* @var string
*/
const VERSION = '5.0.2';
const VERSION = '5.0.3';

const MAJOR_VERSION = 5;

Expand Down
12 changes: 7 additions & 5 deletions core/Visualization/Sparkline.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,15 +221,17 @@ private function setSparklineColors($sparkline, $seriesIndex)

public function render()
{
if (empty($this->sparkline->getSeriesCount())) {
if (!$this->sparkline instanceof \Davaxi\Sparkline) {
return;
}

if (0 === $this->sparkline->getSeriesCount()) {
// ensure to have at least one series & point in sparkline to avoid possible php notices/errors
// a sparkline will then be displayed with a zero line
$this->sparkline->addSeries([0]);
}

if ($this->sparkline instanceof \Davaxi\Sparkline) {
$this->sparkline->display();
$this->sparkline->destroy();
}
$this->sparkline->display();
$this->sparkline->destroy();
}
}
30 changes: 26 additions & 4 deletions plugins/Live/VisitorDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@

class VisitorDetails extends VisitorDetailsAbstract
{
/**
* @var array<int, array<string>>
*/
private $cachedAdditionalSiteUrls = [];

public function extendVisitorDetails(&$visitor)
{
$idSite = $this->getIdSite();
Expand Down Expand Up @@ -99,16 +104,16 @@ public function renderAction($action, $previousAction, $visitorDetails)
return;
}

$sitesModel = new \Piwik\Plugins\SitesManager\Model();

if (isset($action['type']) && in_array($action['type'], ['outlink', 'download']) && isset($action['url'])) {
$action['url'] = html_entity_decode($action['url'], ENT_QUOTES, "UTF-8");
}

$idSite = $this->getIdSite();

$view = new View($template);
$view->sendHeadersWhenRendering = false;
$view->mainUrl = trim(Site::getMainUrlFor($this->getIdSite()));
$view->additionalUrls = $sitesModel->getAliasSiteUrlsFromId($this->getIdSite());
$view->mainUrl = trim(Site::getMainUrlFor($idSite));
$view->additionalUrls = $this->getAdditionalUrlsForSite($idSite);
$view->action = $action;
$view->previousAction = $previousAction;
$view->visitInfo = $visitorDetails;
Expand Down Expand Up @@ -309,4 +314,21 @@ public static function getReferrerSummaryForVisit($visit)

return $visit->getColumn('referrerName');
}

/**
* @return array<int, array<string>>
*/
private function getAdditionalUrlsForSite(int $idSite): array
{
if (isset($this->cachedAdditionalSiteUrls[$idSite])) {
return $this->cachedAdditionalSiteUrls[$idSite];
}

$sitesModel = new \Piwik\Plugins\SitesManager\Model();
$additionalSiteUrls = $sitesModel->getAliasSiteUrlsFromId($idSite);

$this->cachedAdditionalSiteUrls[$idSite] = $additionalSiteUrls;

return $additionalSiteUrls;
}
}

0 comments on commit 5f6b344

Please sign in to comment.