From 216e922e2ae34c48e0e56d72cb13808e3158f511 Mon Sep 17 00:00:00 2001
From: John Maguire <contact@johnmaguire.me>
Date: Tue, 8 Dec 2015 21:33:05 -0500
Subject: [PATCH] Manage PiwikTracker through composer (closes #9349)

---
 .gitmodules                        |  4 ---
 composer.json                      |  3 +-
 composer.lock                      | 45 ++++++++++++++++++++++++++++--
 libs/PiwikTracker                  |  1 -
 libs/PiwikTracker/PiwikTracker.php | 15 ++++++++++
 5 files changed, 60 insertions(+), 8 deletions(-)
 delete mode 160000 libs/PiwikTracker
 create mode 100644 libs/PiwikTracker/PiwikTracker.php

diff --git a/.gitmodules b/.gitmodules
index 8a6eb61371..cd126ab986 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -53,10 +53,6 @@
 # Note: when you add a submodule that SHOULD be left in the packaged release such as the few submodules below,
 #       then you MUST add these submodules names in the SUBMODULES_PACKAGED_WITH_CORE variable in:
 #       https://github.com/piwik/piwik-package/blob/master/scripts/build-package.sh
-[submodule "libs/PiwikTracker"]
-    path = libs/PiwikTracker
-    url = https://github.com/piwik/piwik-php-tracker.git
-    branch = master
 [submodule "misc/log-analytics"]
     path = misc/log-analytics
     url = https://github.com/piwik/piwik-log-analytics.git
diff --git a/composer.json b/composer.json
index f6c0141296..e7cc14f778 100644
--- a/composer.json
+++ b/composer.json
@@ -55,7 +55,8 @@
         "pear/pear_exception": "~1.0.0",
         "piwik/referrer-spam-blacklist": "~1.0",
         "piwik/searchengine-and-social-list": "~1.0",
-        "tecnickcom/tcpdf": "~6.0"
+        "tecnickcom/tcpdf": "~6.0",
+        "piwik/piwik-php-tracker": "^1.0"
     },
     "require-dev": {
         "aws/aws-sdk-php": "2.7.1",
diff --git a/composer.lock b/composer.lock
index 4cab75c93d..263c85b4ab 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,8 +4,8 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
         "This file is @generated automatically"
     ],
-    "hash": "15e909bee11271e304ee16ad4f649eb3",
-    "content-hash": "cba24c49efb5efab04417cc3bd0fba18",
+    "hash": "09112ef01f28686b387148c407503c7c",
+    "content-hash": "ff9b83524f413ac80daad8eb47099042",
     "packages": [
         {
             "name": "container-interop/container-interop",
@@ -300,6 +300,7 @@
                 "phpdoc",
                 "reflection"
             ],
+            "abandoned": "php-di/phpdoc-reader",
             "time": "2014-08-21 08:20:45"
         },
         {
@@ -937,6 +938,46 @@
             ],
             "time": "2014-10-23 03:30:23"
         },
+        {
+            "name": "piwik/piwik-php-tracker",
+            "version": "1.0.1",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/piwik/piwik-php-tracker.git",
+                "reference": "ac3e26bb3e2c8a428ccbf6ca663c2ef37fa47a5e"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/piwik/piwik-php-tracker/zipball/ac3e26bb3e2c8a428ccbf6ca663c2ef37fa47a5e",
+                "reference": "ac3e26bb3e2c8a428ccbf6ca663c2ef37fa47a5e",
+                "shasum": ""
+            },
+            "type": "library",
+            "autoload": {
+                "classmap": [
+                    "."
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "BSD-2-Clause"
+            ],
+            "authors": [
+                {
+                    "name": "The Piwik Team",
+                    "email": "hello@piwik.org",
+                    "homepage": "http://piwik.org/the-piwik-team/"
+                }
+            ],
+            "description": "PHP Client for Piwik Analytics Tracking API",
+            "homepage": "http://piwik.org",
+            "keywords": [
+                "analytics",
+                "piwik",
+                "tracker"
+            ],
+            "time": "2015-11-11 02:55:37"
+        },
         {
             "name": "piwik/referrer-spam-blacklist",
             "version": "1.0.6",
diff --git a/libs/PiwikTracker b/libs/PiwikTracker
deleted file mode 160000
index ac3e26bb3e..0000000000
--- a/libs/PiwikTracker
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit ac3e26bb3e2c8a428ccbf6ca663c2ef37fa47a5e
diff --git a/libs/PiwikTracker/PiwikTracker.php b/libs/PiwikTracker/PiwikTracker.php
new file mode 100644
index 0000000000..834797a0de
--- /dev/null
+++ b/libs/PiwikTracker/PiwikTracker.php
@@ -0,0 +1,15 @@
+<?php
+/**
+ * Piwik - free/libre analytics platform
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ *
+ */
+
+// PiwikTracker.php is now managed by composer. To prevent breaking existing
+// code, this file has been left as a redirect to its new location in the
+// vendor directory.
+if (!class_exists('PiwikTracker')) {
+    require_once __DIR__ . '/../../vendor/piwik/piwik-php-tracker/PiwikTracker.php';
+}
-- 
GitLab