Skip to content

Commit

Permalink
Ensure PiwikTracker and MatomoTracker are both available
Browse files Browse the repository at this point in the history
  • Loading branch information
sgiehl committed Jan 13, 2020
1 parent 64248e1 commit 0c73a80
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
9 changes: 9 additions & 0 deletions MatomoTracker.php
Original file line number Diff line number Diff line change
Expand Up @@ -2050,3 +2050,12 @@ function Matomo_getUrlTrackGoal($idSite, $idGoal, $revenue = 0.0)

return $tracker->getUrlTrackGoal($idGoal, $revenue);
}

/**
* Ensure PiwikTracker class is available as well
*
* @deprecated
*/
if (!class_exists('\PiwikTracker')) {
include_once('./PiwikTracker.php');
}
4 changes: 3 additions & 1 deletion PiwikTracker.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
* @package MatomoTracker
*/

include_once('./MatomoTracker.php');
if (!class_exists('\MatomoTracker')) {
include_once('./MatomoTracker.php');
}

/**
* Helper function to quickly generate the URL to track a page view.
Expand Down

3 comments on commit 0c73a80

@eiland-asbl
Copy link

Choose a reason for hiding this comment

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

is it me or does this relative path creates Warning: include_once(./PiwikTracker.php): failed to open stream: No such file or directory in /include/matomo-php-tracker-master/MatomoTracker.php on line 2061

@tsteur
Copy link
Member

@tsteur tsteur commented on 0c73a80 May 31, 2020

Choose a reason for hiding this comment

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

This should work @wikimas . Does the file exist when you check manually on the file system?

@tsteur
Copy link
Member

@tsteur tsteur commented on 0c73a80 Jun 2, 2020

Choose a reason for hiding this comment

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

I'm actually getting the same error @sgiehl Any thoughts?

WARNING [2020-06-02 01:04:45] 92702   /vendor/matomo/matomo-php-tracker/MatomoTracker.php(2113): Warning - include_once(./PiwikTracker.php): failed to open stream: No such file or directory - Matomo 4.0.0-b2 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
WARNING [2020-06-02 01:04:45] 92702  vendor/matomo/matomo-php-tracker/MatomoTracker.php(2113): Warning - include_once(): Failed opening './PiwikTracker.php' for inclusion (include_path=vendor/pear/archive_tar:/Users/thomassteur/Development/piwik/vendor/pear/console_getopt:vendor/pear/pear-core-minimal/src:vendor/pear/pear_exception:.:/usr/local/Cellar/php/7.4.2/share/php/pear') - Matomo 4.0.0-b2 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)

Both tracker file itself exist. That's in Matomo 4 when I trigger archiving. (probably in one plugin we're using the tracker)

Please sign in to comment.