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 PiwikTracker.php to own repository #6870

Closed
piotr-cz opened this issue Dec 17, 2014 · 12 comments
Closed

Move PiwikTracker.php to own repository #6870

piotr-cz opened this issue Dec 17, 2014 · 12 comments
Assignees
Labels
Task Indicates an issue is neither a feature nor a bug and it's purely a "technical" change.
Milestone

Comments

@piotr-cz
Copy link
Contributor

Move PiwikTracker.php to own repository and add dedicated composer.json file.

Benefit: Library will be available to download and integrate into projects using package manager (composer/packagist), just like other API tracking Clients are.

ATM if you are using composer you have to include whole Piwik but include just PiwikTracker.php or not use package manager and handle updates manually.

There are other benefits like dedicated test suite and better exposure to community,

@mnapoli
Copy link
Contributor

mnapoli commented Dec 17, 2014

Hi, have a look here: matomo-org/matomo-php-tracker#1

@mattab mattab added the Task Indicates an issue is neither a feature nor a bug and it's purely a "technical" change. label Dec 17, 2014
@mattab mattab added this to the Mid term milestone Dec 17, 2014
@piotr-cz
Copy link
Contributor Author

How could I miss that?
Should I close the issue since it's labelled now?

@mattab
Copy link
Member

mattab commented Dec 17, 2014

we can leave it opened, it was also duplicated in #327

@tsteur tsteur modified the milestones: Piwik 2.10.0 , Mid term Dec 18, 2014
@tsteur tsteur self-assigned this Dec 19, 2014
@tsteur tsteur closed this as completed Dec 19, 2014
@tsteur
Copy link
Member

tsteur commented Dec 19, 2014

It is included as a submodule to stay backwards compatible and to keep the libs/PiwikTracker path. We can have another branch in this repository for a refactoring and could include the refactoring branch at some point under vendor/... via composer. Just in case someone starts a refactoring

@johnmaguire
Copy link
Contributor

@tsteur What about committing a symlink from libs/PiwikTracker to the new location in vendor? Existing scripts would continue to work this way I believe.

@johnmaguire
Copy link
Contributor

However, that solution wouldn't support Windows (not sure if that's a target platform of Piwik or not.)

@tsteur
Copy link
Member

tsteur commented Dec 7, 2015

It is a target platform of Piwik

@johnmaguire
Copy link
Contributor

I don't want to beat a dead horse here, but I have one last proposed solution:

  1. libs/PiwikTracer.php -> <?php if (!class_exists('PiwikTracker.php')) require_once BASE_PATH . '/vendor/piwik/piwik-php-tracker/src/PiwikTracker.php';
  2. Add piwik/piwik-php-tracker to composer.json.

At that point, you could manage the tracker with composer with the rest of your dependencies, and existing code would continue to function correctly.

@johnmaguire
Copy link
Contributor

In fact, if you're planning to use the autoloading feature of composer with piwik/piwik-php-tracker, you would just needs libs/PiwikTracker.php to be an empty file to prevent errors.

@tsteur
Copy link
Member

tsteur commented Dec 7, 2015

If it works I would be totally okay with that solution :) Not sure if there would be any other downsides or disadvantages? We just need to make sure to not break BC in some way.

We'd probably need to adjust at least the Piwik build script eg here https://github.com/piwik/piwik-package/blob/master/scripts/build-package.sh#L19-L20

BTW: We would still have some submodules afterwards, eg log-analytics. But I think none of these submodules would be actually needed in order to use Piwik, only in specific cases. If we did this, one could setup a minimal Piwik by only using composer I reckon

@johnmaguire
Copy link
Contributor

Cool. :) I can't think of any major ones. The first approach (not having a blank file) is probably the safer solution -- if any other symbols are created inside the PiwikTracker.php file that the autoloader can't handle, they wouldn't be guaranteed to be in scope with the empty file / trust autoloader approach. But having the usual included file redirect to the one in vendor/ should function exactly as expected.

I'll implement this in the next couple days and play around with it a bit to make sure it works. On that note, I'll comment to hold off on merging the PR I submitted earlier today.

@tsteur
Copy link
Member

tsteur commented Dec 8, 2015

Sweet, thx for that. I will add a label work in progress to the PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Task Indicates an issue is neither a feature nor a bug and it's purely a "technical" change.
Projects
None yet
Development

No branches or pull requests

5 participants