From 8fddda7e492fbf5e944749e97158b9a71d1ce658 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Wed, 3 Feb 2021 17:54:41 +0100 Subject: [PATCH 1/6] introduce analytics to installtion --- app/tasks/install.php | 8 +- composer.json | 7 +- composer.lock | 213 ++++++++++++++++++++++++++---------------- 3 files changed, 142 insertions(+), 86 deletions(-) diff --git a/app/tasks/install.php b/app/tasks/install.php index f855a086c..5b8aaf825 100644 --- a/app/tasks/install.php +++ b/app/tasks/install.php @@ -4,6 +4,7 @@ global $cli; use Appwrite\Docker\Compose; use Appwrite\Docker\Env; +use Utopia\Analytics\GoogleAnalytics; use Utopia\CLI\Console; use Utopia\Config\Config; use Utopia\View; @@ -28,6 +29,7 @@ $cli * 5. Run docker-compose up -d - DONE * 6. Run data migration */ + $ga = new GoogleAnalytics('UA-188864507-1', uniqid('installation')); $config = Config::getParam('variables'); $path = '/usr/src/code/appwrite'; $defaultHTTPPort = '80'; @@ -160,10 +162,12 @@ $cli $exit = Console::execute("${env} docker-compose -f {$path}/docker-compose.yml up -d --remove-orphans --renew-anon-volumes", '', $stdout, $stderr); if ($exit !== 0) { - Console::error("Failed to install Appwrite dockers"); + Console::error('Failed to install Appwrite dockers'); Console::error($stderr); Console::exit($exit); + $ga->createEvent('installations', 'failure'); } else { - Console::success("Appwrite installed successfully"); + Console::success('Appwrite installed successfully'); + $ga->createEvent('installations', 'successful'); } }); \ No newline at end of file diff --git a/composer.json b/composer.json index 4529d1460..ccd6bda6b 100644 --- a/composer.json +++ b/composer.json @@ -58,15 +58,20 @@ "adhocore/jwt": "1.1.0" }, "require-dev": { - "swoole/ide-helper": "4.5.5", "appwrite/sdk-generator": "0.4.5", + "utopia-php/analytics": "dev-main", "phpunit/phpunit": "9.4.2", + "swoole/ide-helper": "4.5.5", "vimeo/psalm": "4.1.1" }, "repositories": [ { "type": "git", "url": "https://github.com/appwrite/sdk-generator" + }, + { + "type": "git", + "url": "https://github.com/utopia-php/analytics" } ], "provide": { diff --git a/composer.lock b/composer.lock index 460862d07..513c47809 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "be6adbd12397d629ee420d11eed43b1f", + "content-hash": "f5cdf753129a505c5fe488d222f66723", "packages": [ { "name": "adhocore/jwt", @@ -3072,12 +3072,12 @@ "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0" + "reference": "6759f2268deb9f329812679e9dcb2d0083b2a30b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", - "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6759f2268deb9f329812679e9dcb2d0083b2a30b", + "reference": "6759f2268deb9f329812679e9dcb2d0083b2a30b", "shasum": "" }, "require": { @@ -3112,9 +3112,9 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.4.0" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.x" }, - "time": "2020-09-17T18:55:26+00:00" + "time": "2021-02-02T21:09:27+00:00" }, { "name": "phpspec/prophecy", @@ -3266,12 +3266,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "42c07f0e3553df5bf56a079957a52e9353625058" + "reference": "7643948b9b254d2c1406437070c53489ca858632" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/42c07f0e3553df5bf56a079957a52e9353625058", - "reference": "42c07f0e3553df5bf56a079957a52e9353625058", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/7643948b9b254d2c1406437070c53489ca858632", + "reference": "7643948b9b254d2c1406437070c53489ca858632", "shasum": "" }, "require": { @@ -3319,7 +3319,7 @@ "type": "github" } ], - "time": "2021-01-27T12:51:34+00:00" + "time": "2021-01-31T06:06:23+00:00" }, { "name": "phpunit/php-invoker", @@ -3327,12 +3327,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-invoker.git", - "reference": "3a913dc74b32a7646a5fb3cfb72f6ace01fabd01" + "reference": "8ddb05c30eb42ee9342a711ff490436db0f42aad" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/3a913dc74b32a7646a5fb3cfb72f6ace01fabd01", - "reference": "3a913dc74b32a7646a5fb3cfb72f6ace01fabd01", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/8ddb05c30eb42ee9342a711ff490436db0f42aad", + "reference": "8ddb05c30eb42ee9342a711ff490436db0f42aad", "shasum": "" }, "require": { @@ -3383,7 +3383,7 @@ "type": "github" } ], - "time": "2021-01-27T12:51:43+00:00" + "time": "2021-01-31T06:06:31+00:00" }, { "name": "phpunit/php-text-template", @@ -3391,12 +3391,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "f2e1a43551a53861fd0d000518f8db3818b82655" + "reference": "eace5f89cab382a6908f404ca2ea757e644047ab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/f2e1a43551a53861fd0d000518f8db3818b82655", - "reference": "f2e1a43551a53861fd0d000518f8db3818b82655", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/eace5f89cab382a6908f404ca2ea757e644047ab", + "reference": "eace5f89cab382a6908f404ca2ea757e644047ab", "shasum": "" }, "require": { @@ -3443,7 +3443,7 @@ "type": "github" } ], - "time": "2021-01-27T12:52:18+00:00" + "time": "2021-01-31T06:07:05+00:00" }, { "name": "phpunit/php-timer", @@ -3451,12 +3451,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "ca89d7aa771d3c7a095ec2bac5b70489a6d15638" + "reference": "c2c32bcece727700ce67b2c4fa5b5231c03d1232" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/ca89d7aa771d3c7a095ec2bac5b70489a6d15638", - "reference": "ca89d7aa771d3c7a095ec2bac5b70489a6d15638", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/c2c32bcece727700ce67b2c4fa5b5231c03d1232", + "reference": "c2c32bcece727700ce67b2c4fa5b5231c03d1232", "shasum": "" }, "require": { @@ -3503,7 +3503,7 @@ "type": "github" } ], - "time": "2021-01-27T12:51:51+00:00" + "time": "2021-01-31T06:06:40+00:00" }, { "name": "phpunit/phpunit", @@ -3668,12 +3668,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "66398c0b5074897805514249878d592f9ada37c5" + "reference": "852907f9ef27ea08ad4135614a9fbd2f70c91ed1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/66398c0b5074897805514249878d592f9ada37c5", - "reference": "66398c0b5074897805514249878d592f9ada37c5", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/852907f9ef27ea08ad4135614a9fbd2f70c91ed1", + "reference": "852907f9ef27ea08ad4135614a9fbd2f70c91ed1", "shasum": "" }, "require": { @@ -3717,7 +3717,7 @@ "type": "github" } ], - "time": "2021-01-27T12:52:48+00:00" + "time": "2021-01-31T06:07:32+00:00" }, { "name": "sebastian/code-unit", @@ -3781,12 +3781,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "8be6fadd1eb9f4bcee0e823a0f392d641e00e3d9" + "reference": "bae9e6f9fc00aa95c1971a52f819b08494a394f0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/8be6fadd1eb9f4bcee0e823a0f392d641e00e3d9", - "reference": "8be6fadd1eb9f4bcee0e823a0f392d641e00e3d9", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/bae9e6f9fc00aa95c1971a52f819b08494a394f0", + "reference": "bae9e6f9fc00aa95c1971a52f819b08494a394f0", "shasum": "" }, "require": { @@ -3829,7 +3829,7 @@ "type": "github" } ], - "time": "2021-01-27T12:50:24+00:00" + "time": "2021-01-31T06:05:15+00:00" }, { "name": "sebastian/comparator", @@ -3837,12 +3837,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "5a39e6c8994048403e326298f0b1bda7eb1ea127" + "reference": "d529bf5bc5746f6c59a1defc17c3725b5374c750" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5a39e6c8994048403e326298f0b1bda7eb1ea127", - "reference": "5a39e6c8994048403e326298f0b1bda7eb1ea127", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/d529bf5bc5746f6c59a1defc17c3725b5374c750", + "reference": "d529bf5bc5746f6c59a1defc17c3725b5374c750", "shasum": "" }, "require": { @@ -3904,7 +3904,7 @@ "type": "github" } ], - "time": "2021-01-27T14:14:42+00:00" + "time": "2021-01-31T06:05:24+00:00" }, { "name": "sebastian/complexity", @@ -3912,12 +3912,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "653277be0c4044b0a32ee3e799b3b0c6945aa7f8" + "reference": "1e51f588b0bf9783d80e952339a1f057f530f3ac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/653277be0c4044b0a32ee3e799b3b0c6945aa7f8", - "reference": "653277be0c4044b0a32ee3e799b3b0c6945aa7f8", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/1e51f588b0bf9783d80e952339a1f057f530f3ac", + "reference": "1e51f588b0bf9783d80e952339a1f057f530f3ac", "shasum": "" }, "require": { @@ -3962,7 +3962,7 @@ "type": "github" } ], - "time": "2021-01-27T12:52:27+00:00" + "time": "2021-01-31T06:07:14+00:00" }, { "name": "sebastian/diff", @@ -3970,12 +3970,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "9d7fb8ba123928945b9727a3e02501645955f61f" + "reference": "492912a4b41de6a0127ebcd2f766b7d7f10f574c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/9d7fb8ba123928945b9727a3e02501645955f61f", - "reference": "9d7fb8ba123928945b9727a3e02501645955f61f", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/492912a4b41de6a0127ebcd2f766b7d7f10f574c", + "reference": "492912a4b41de6a0127ebcd2f766b7d7f10f574c", "shasum": "" }, "require": { @@ -4029,7 +4029,7 @@ "type": "github" } ], - "time": "2021-01-27T12:50:42+00:00" + "time": "2021-01-31T06:05:32+00:00" }, { "name": "sebastian/environment", @@ -4037,12 +4037,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "27e27e02ab122412b7ff9c847445e21ecfcc5c68" + "reference": "36ffd0fc651961e864d955e6fd71ef03c367abae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/27e27e02ab122412b7ff9c847445e21ecfcc5c68", - "reference": "27e27e02ab122412b7ff9c847445e21ecfcc5c68", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/36ffd0fc651961e864d955e6fd71ef03c367abae", + "reference": "36ffd0fc651961e864d955e6fd71ef03c367abae", "shasum": "" }, "require": { @@ -4093,7 +4093,7 @@ "type": "github" } ], - "time": "2021-01-27T12:50:50+00:00" + "time": "2021-01-31T06:05:40+00:00" }, { "name": "sebastian/exporter", @@ -4101,12 +4101,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "4b97f87ebe0e759d27a96e5cfcb15193fdcc1000" + "reference": "61024af3555edd28c0e2df7ae6a72bb24b1c3f88" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/4b97f87ebe0e759d27a96e5cfcb15193fdcc1000", - "reference": "4b97f87ebe0e759d27a96e5cfcb15193fdcc1000", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/61024af3555edd28c0e2df7ae6a72bb24b1c3f88", + "reference": "61024af3555edd28c0e2df7ae6a72bb24b1c3f88", "shasum": "" }, "require": { @@ -4171,7 +4171,7 @@ "type": "github" } ], - "time": "2021-01-27T12:50:59+00:00" + "time": "2021-01-31T06:05:49+00:00" }, { "name": "sebastian/global-state", @@ -4179,12 +4179,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "ae53ac14d8df978ebc06a0382997257a2268dc2c" + "reference": "ebe2eda599117719755417db6552cf3e6cea68a3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/ae53ac14d8df978ebc06a0382997257a2268dc2c", - "reference": "ae53ac14d8df978ebc06a0382997257a2268dc2c", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/ebe2eda599117719755417db6552cf3e6cea68a3", + "reference": "ebe2eda599117719755417db6552cf3e6cea68a3", "shasum": "" }, "require": { @@ -4236,7 +4236,7 @@ "type": "github" } ], - "time": "2021-01-27T12:51:08+00:00" + "time": "2021-01-31T06:05:57+00:00" }, { "name": "sebastian/lines-of-code", @@ -4244,12 +4244,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "3b537e8cf7d5d40c5937cb238dd86e9849058978" + "reference": "a58591ee219008ebc039a6ef1a1ad5ebd7aa5094" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/3b537e8cf7d5d40c5937cb238dd86e9849058978", - "reference": "3b537e8cf7d5d40c5937cb238dd86e9849058978", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/a58591ee219008ebc039a6ef1a1ad5ebd7aa5094", + "reference": "a58591ee219008ebc039a6ef1a1ad5ebd7aa5094", "shasum": "" }, "require": { @@ -4294,7 +4294,7 @@ "type": "github" } ], - "time": "2021-01-27T12:52:38+00:00" + "time": "2021-01-31T06:07:23+00:00" }, { "name": "sebastian/object-enumerator", @@ -4302,12 +4302,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "f8f7c1ff5e66b5c9145df7329b3bc54844138e21" + "reference": "c3392f76c657681a2fde9073a47d26190580acee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/f8f7c1ff5e66b5c9145df7329b3bc54844138e21", - "reference": "f8f7c1ff5e66b5c9145df7329b3bc54844138e21", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/c3392f76c657681a2fde9073a47d26190580acee", + "reference": "c3392f76c657681a2fde9073a47d26190580acee", "shasum": "" }, "require": { @@ -4352,7 +4352,7 @@ "type": "github" } ], - "time": "2021-01-27T12:51:16+00:00" + "time": "2021-01-31T06:06:06+00:00" }, { "name": "sebastian/object-reflector", @@ -4360,12 +4360,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "dbea5f76fb03ccf212b0fc88fb8f2ad256f4f000" + "reference": "0b1e3b35407041b8f28c2d8b9f3d792720c81c23" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/dbea5f76fb03ccf212b0fc88fb8f2ad256f4f000", - "reference": "dbea5f76fb03ccf212b0fc88fb8f2ad256f4f000", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/0b1e3b35407041b8f28c2d8b9f3d792720c81c23", + "reference": "0b1e3b35407041b8f28c2d8b9f3d792720c81c23", "shasum": "" }, "require": { @@ -4408,7 +4408,7 @@ "type": "github" } ], - "time": "2021-01-27T12:51:25+00:00" + "time": "2021-01-31T06:06:15+00:00" }, { "name": "sebastian/recursion-context", @@ -4416,12 +4416,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "4181599c8f7b66401bf827a3e7e6da85a2303524" + "reference": "5df92f91b2cc5f733bb1d2df3eb81013a2bf69c6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/4181599c8f7b66401bf827a3e7e6da85a2303524", - "reference": "4181599c8f7b66401bf827a3e7e6da85a2303524", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5df92f91b2cc5f733bb1d2df3eb81013a2bf69c6", + "reference": "5df92f91b2cc5f733bb1d2df3eb81013a2bf69c6", "shasum": "" }, "require": { @@ -4472,7 +4472,7 @@ "type": "github" } ], - "time": "2021-01-27T12:52:00+00:00" + "time": "2021-01-31T06:06:48+00:00" }, { "name": "sebastian/resource-operations", @@ -4536,12 +4536,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "1c469702730295ddaf484d6fddb3b42a1354cd5c" + "reference": "6751662dde805fb5e46e05d3133a89e056796404" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/1c469702730295ddaf484d6fddb3b42a1354cd5c", - "reference": "1c469702730295ddaf484d6fddb3b42a1354cd5c", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/6751662dde805fb5e46e05d3133a89e056796404", + "reference": "6751662dde805fb5e46e05d3133a89e056796404", "shasum": "" }, "require": { @@ -4585,7 +4585,7 @@ "type": "github" } ], - "time": "2021-01-27T12:52:09+00:00" + "time": "2021-01-31T06:06:56+00:00" }, { "name": "sebastian/version", @@ -4685,12 +4685,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "a056a527ed72d089185d505882b66f3676e22439" + "reference": "56d4c04ca6069c93857c7335a626dbe747fa82d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/a056a527ed72d089185d505882b66f3676e22439", - "reference": "a056a527ed72d089185d505882b66f3676e22439", + "url": "https://api.github.com/repos/symfony/console/zipball/56d4c04ca6069c93857c7335a626dbe747fa82d4", + "reference": "56d4c04ca6069c93857c7335a626dbe747fa82d4", "shasum": "" }, "require": { @@ -4775,7 +4775,7 @@ "type": "tidelift" } ], - "time": "2021-01-27T09:05:46+00:00" + "time": "2021-01-28T22:09:26+00:00" }, { "name": "symfony/polyfill-ctype", @@ -5489,12 +5489,12 @@ "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "1a0162a612658790cb1f7b468c7698a7ee58001a" + "reference": "5a60e72afa8511b63217d27bef3f4b7f074e20e1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/1a0162a612658790cb1f7b468c7698a7ee58001a", - "reference": "1a0162a612658790cb1f7b468c7698a7ee58001a", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/5a60e72afa8511b63217d27bef3f4b7f074e20e1", + "reference": "5a60e72afa8511b63217d27bef3f4b7f074e20e1", "shasum": "" }, "require": { @@ -5560,7 +5560,52 @@ "type": "tidelift" } ], - "time": "2021-01-14T07:57:35+00:00" + "time": "2021-02-02T15:25:09+00:00" + }, + { + "name": "utopia-php/analytics", + "version": "dev-main", + "source": { + "type": "git", + "url": "https://github.com/utopia-php/analytics", + "reference": "f1eb26f14af1146c698678b4f30cefe15b3006e2" + }, + "require": { + "php": ">=7.4" + }, + "require-dev": { + "phpunit/phpunit": "^9.3", + "vimeo/psalm": "4.0.1" + }, + "default-branch": true, + "type": "library", + "autoload": { + "psr-4": { + "Utopia\\Analytics\\": "src/Analytics" + } + }, + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Eldad Fux", + "email": "eldad@appwrite.io" + }, + { + "name": "Torsten Dittmann", + "email": "torsten@appwrite.io" + } + ], + "description": "A simple library to track events & users.", + "keywords": [ + "analytics", + "framework", + "php", + "upf", + "utopia" + ], + "time": "2021-02-03T13:51:30+00:00" }, { "name": "vimeo/psalm", @@ -5780,7 +5825,9 @@ ], "aliases": [], "minimum-stability": "dev", - "stability-flags": [], + "stability-flags": { + "utopia-php/analytics": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { From 0cf42ebad0d1a530503237a49098bc5ac8f97c35 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Thu, 4 Feb 2021 09:20:47 +0100 Subject: [PATCH 2/6] fix analytics property and events --- app/tasks/install.php | 6 +-- composer.json | 6 +-- composer.lock | 106 +++++++++++++++++++++++------------------- 3 files changed, 61 insertions(+), 57 deletions(-) diff --git a/app/tasks/install.php b/app/tasks/install.php index 5b8aaf825..bc262937c 100644 --- a/app/tasks/install.php +++ b/app/tasks/install.php @@ -29,7 +29,7 @@ $cli * 5. Run docker-compose up -d - DONE * 6. Run data migration */ - $ga = new GoogleAnalytics('UA-188864507-1', uniqid('installation')); + $analytics = new GoogleAnalytics('UA-26264668-9', uniqid('installation')); $config = Config::getParam('variables'); $path = '/usr/src/code/appwrite'; $defaultHTTPPort = '80'; @@ -165,9 +165,9 @@ $cli Console::error('Failed to install Appwrite dockers'); Console::error($stderr); Console::exit($exit); - $ga->createEvent('installations', 'failure'); + $analytics->createEvent('install/server', 'install', APP_VERSION_STABLE.' Install Server failed'); } else { Console::success('Appwrite installed successfully'); - $ga->createEvent('installations', 'successful'); + $analytics->createEvent('install/server', 'install', APP_VERSION_STABLE.' Install Server successfully'); } }); \ No newline at end of file diff --git a/composer.json b/composer.json index ccd6bda6b..43776eece 100644 --- a/composer.json +++ b/composer.json @@ -36,6 +36,7 @@ "utopia-php/framework": "0.10.0", "utopia-php/abuse": "0.3.*", + "utopia-php/analytics": "0.1.*", "utopia-php/audit": "0.5.*", "utopia-php/cache": "0.2.*", "utopia-php/cli": "0.9.0", @@ -59,7 +60,6 @@ }, "require-dev": { "appwrite/sdk-generator": "0.4.5", - "utopia-php/analytics": "dev-main", "phpunit/phpunit": "9.4.2", "swoole/ide-helper": "4.5.5", "vimeo/psalm": "4.1.1" @@ -68,10 +68,6 @@ { "type": "git", "url": "https://github.com/appwrite/sdk-generator" - }, - { - "type": "git", - "url": "https://github.com/utopia-php/analytics" } ], "provide": { diff --git a/composer.lock b/composer.lock index 513c47809..2b4a9b11d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f5cdf753129a505c5fe488d222f66723", + "content-hash": "4b4d5ae4c4601730a0bfb1be3faed144", "packages": [ { "name": "adhocore/jwt", @@ -1227,6 +1227,61 @@ }, "time": "2020-12-21T17:28:03+00:00" }, + { + "name": "utopia-php/analytics", + "version": "0.1.0", + "source": { + "type": "git", + "url": "https://github.com/utopia-php/analytics.git", + "reference": "a1f2a1672a927bef8cd4d9b47e5cfbc856a3c72f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/utopia-php/analytics/zipball/a1f2a1672a927bef8cd4d9b47e5cfbc856a3c72f", + "reference": "a1f2a1672a927bef8cd4d9b47e5cfbc856a3c72f", + "shasum": "" + }, + "require": { + "php": ">=7.4" + }, + "require-dev": { + "phpunit/phpunit": "^9.3", + "vimeo/psalm": "4.0.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "Utopia\\Analytics\\": "src/Analytics" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Eldad Fux", + "email": "eldad@appwrite.io" + }, + { + "name": "Torsten Dittmann", + "email": "torsten@appwrite.io" + } + ], + "description": "A simple library to track events & users.", + "keywords": [ + "analytics", + "framework", + "php", + "upf", + "utopia" + ], + "support": { + "issues": "https://github.com/utopia-php/analytics/issues", + "source": "https://github.com/utopia-php/analytics/tree/0.1.0" + }, + "time": "2021-02-03T17:07:09+00:00" + }, { "name": "utopia-php/audit", "version": "0.5.1", @@ -5562,51 +5617,6 @@ ], "time": "2021-02-02T15:25:09+00:00" }, - { - "name": "utopia-php/analytics", - "version": "dev-main", - "source": { - "type": "git", - "url": "https://github.com/utopia-php/analytics", - "reference": "f1eb26f14af1146c698678b4f30cefe15b3006e2" - }, - "require": { - "php": ">=7.4" - }, - "require-dev": { - "phpunit/phpunit": "^9.3", - "vimeo/psalm": "4.0.1" - }, - "default-branch": true, - "type": "library", - "autoload": { - "psr-4": { - "Utopia\\Analytics\\": "src/Analytics" - } - }, - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Eldad Fux", - "email": "eldad@appwrite.io" - }, - { - "name": "Torsten Dittmann", - "email": "torsten@appwrite.io" - } - ], - "description": "A simple library to track events & users.", - "keywords": [ - "analytics", - "framework", - "php", - "upf", - "utopia" - ], - "time": "2021-02-03T13:51:30+00:00" - }, { "name": "vimeo/psalm", "version": "4.1.1", @@ -5825,9 +5835,7 @@ ], "aliases": [], "minimum-stability": "dev", - "stability-flags": { - "utopia-php/analytics": 20 - }, + "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": { From e23828777fca2a38bc0552aa485f08106cba4e18 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Thu, 4 Feb 2021 10:26:58 +0100 Subject: [PATCH 3/6] add client id to analytics --- app/tasks/install.php | 30 +++++++++++++++++++++++------- composer.lock | 12 ++++++------ 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/app/tasks/install.php b/app/tasks/install.php index bc262937c..ac7e45cfc 100644 --- a/app/tasks/install.php +++ b/app/tasks/install.php @@ -29,13 +29,23 @@ $cli * 5. Run docker-compose up -d - DONE * 6. Run data migration */ - $analytics = new GoogleAnalytics('UA-26264668-9', uniqid('installation')); + $config = Config::getParam('variables'); $path = '/usr/src/code/appwrite'; $defaultHTTPPort = '80'; $defaultHTTPSPort = '443'; $vars = []; + /** + * Generates an anonymous hash value based on following informations: + * - Host's machine name + * - Host's local IP adress + * + * This value allows us to collect information without invading the privacy of our users. + */ + $cid = GoogleAnalytics::getUniqueByHostname(); + $analytics = new GoogleAnalytics('UA-26264668-9', $cid); + foreach($config as $category) { foreach($category['variables'] ?? [] as $var) { $vars[] = $var; @@ -138,12 +148,16 @@ $cli ; if(!file_put_contents($path.'/docker-compose.yml', $templateForCompose->render(false))) { - Console::error('Failed to save Docker Compose file'); + $message = 'Failed to save Docker Compose file'; + $analytics->createEvent('install/server', 'install', APP_VERSION_STABLE.' - '.$message, 0); + Console::error($message); Console::exit(1); } if(!file_put_contents($path.'/.env', $templateForEnv->render(false))) { - Console::error('Failed to save environment variables file'); + $message = 'Failed to save environment variables file'; + $analytics->createEvent('install/server', 'install', APP_VERSION_STABLE.' - '.$message, 0); + Console::error($message); Console::exit(1); } @@ -162,12 +176,14 @@ $cli $exit = Console::execute("${env} docker-compose -f {$path}/docker-compose.yml up -d --remove-orphans --renew-anon-volumes", '', $stdout, $stderr); if ($exit !== 0) { - Console::error('Failed to install Appwrite dockers'); + $message = 'Failed to install Appwrite dockers'; + $analytics->createEvent('install/server', 'install', APP_VERSION_STABLE.' - '.$message, 0); + Console::error($message); Console::error($stderr); Console::exit($exit); - $analytics->createEvent('install/server', 'install', APP_VERSION_STABLE.' Install Server failed'); } else { - Console::success('Appwrite installed successfully'); - $analytics->createEvent('install/server', 'install', APP_VERSION_STABLE.' Install Server successfully'); + $message = 'Appwrite installed successfully'; + $analytics->createEvent('install/server', 'install', APP_VERSION_STABLE.' - '.$message, 1); + Console::success($message); } }); \ No newline at end of file diff --git a/composer.lock b/composer.lock index 2b4a9b11d..4da0e3a87 100644 --- a/composer.lock +++ b/composer.lock @@ -1229,16 +1229,16 @@ }, { "name": "utopia-php/analytics", - "version": "0.1.0", + "version": "0.1.1", "source": { "type": "git", "url": "https://github.com/utopia-php/analytics.git", - "reference": "a1f2a1672a927bef8cd4d9b47e5cfbc856a3c72f" + "reference": "5e9ce43523b19ae71973567f219275f97bbec5d9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/analytics/zipball/a1f2a1672a927bef8cd4d9b47e5cfbc856a3c72f", - "reference": "a1f2a1672a927bef8cd4d9b47e5cfbc856a3c72f", + "url": "https://api.github.com/repos/utopia-php/analytics/zipball/5e9ce43523b19ae71973567f219275f97bbec5d9", + "reference": "5e9ce43523b19ae71973567f219275f97bbec5d9", "shasum": "" }, "require": { @@ -1278,9 +1278,9 @@ ], "support": { "issues": "https://github.com/utopia-php/analytics/issues", - "source": "https://github.com/utopia-php/analytics/tree/0.1.0" + "source": "https://github.com/utopia-php/analytics/tree/0.1.1" }, - "time": "2021-02-03T17:07:09+00:00" + "time": "2021-02-04T09:14:43+00:00" }, { "name": "utopia-php/audit", From f244eaf1086c3a11d492a421b64397fe6ce7a763 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Thu, 4 Feb 2021 11:33:32 +0100 Subject: [PATCH 4/6] revert to random cid for analytics --- app/tasks/install.php | 10 +++------- composer.lock | 14 +++++++------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/app/tasks/install.php b/app/tasks/install.php index ac7e45cfc..2c9ccab56 100644 --- a/app/tasks/install.php +++ b/app/tasks/install.php @@ -37,14 +37,10 @@ $cli $vars = []; /** - * Generates an anonymous hash value based on following informations: - * - Host's machine name - * - Host's local IP adress - * - * This value allows us to collect information without invading the privacy of our users. + * We are using a random value every execution for identification. + * This allows us to collect information without invading the privacy of our users. */ - $cid = GoogleAnalytics::getUniqueByHostname(); - $analytics = new GoogleAnalytics('UA-26264668-9', $cid); + $analytics = new GoogleAnalytics('UA-26264668-9', uniqid('server.', true)); foreach($config as $category) { foreach($category['variables'] ?? [] as $var) { diff --git a/composer.lock b/composer.lock index 4da0e3a87..af7575100 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "4b4d5ae4c4601730a0bfb1be3faed144", + "content-hash": "e7b1732817d699748e3bbf4f6c7e4fb0", "packages": [ { "name": "adhocore/jwt", @@ -1229,16 +1229,16 @@ }, { "name": "utopia-php/analytics", - "version": "0.1.1", + "version": "0.1.0", "source": { "type": "git", "url": "https://github.com/utopia-php/analytics.git", - "reference": "5e9ce43523b19ae71973567f219275f97bbec5d9" + "reference": "a1f2a1672a927bef8cd4d9b47e5cfbc856a3c72f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/analytics/zipball/5e9ce43523b19ae71973567f219275f97bbec5d9", - "reference": "5e9ce43523b19ae71973567f219275f97bbec5d9", + "url": "https://api.github.com/repos/utopia-php/analytics/zipball/a1f2a1672a927bef8cd4d9b47e5cfbc856a3c72f", + "reference": "a1f2a1672a927bef8cd4d9b47e5cfbc856a3c72f", "shasum": "" }, "require": { @@ -1278,9 +1278,9 @@ ], "support": { "issues": "https://github.com/utopia-php/analytics/issues", - "source": "https://github.com/utopia-php/analytics/tree/0.1.1" + "source": "https://github.com/utopia-php/analytics/tree/0.1.0" }, - "time": "2021-02-04T09:14:43+00:00" + "time": "2021-02-03T17:07:09+00:00" }, { "name": "utopia-php/audit", From 2b9c3966d96b1f2aae73527cc64491a57d0871a6 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Thu, 4 Feb 2021 11:35:51 +0100 Subject: [PATCH 5/6] remove change whitespace --- app/tasks/install.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/tasks/install.php b/app/tasks/install.php index 2c9ccab56..e74a41a6b 100644 --- a/app/tasks/install.php +++ b/app/tasks/install.php @@ -29,7 +29,6 @@ $cli * 5. Run docker-compose up -d - DONE * 6. Run data migration */ - $config = Config::getParam('variables'); $path = '/usr/src/code/appwrite'; $defaultHTTPPort = '80'; From bf980d50f7e8916a24dd5c413ed14321af1df420 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Thu, 4 Feb 2021 11:51:19 +0100 Subject: [PATCH 6/6] remove value from analytics events --- app/tasks/install.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/tasks/install.php b/app/tasks/install.php index e74a41a6b..39ed29a5b 100644 --- a/app/tasks/install.php +++ b/app/tasks/install.php @@ -144,14 +144,14 @@ $cli if(!file_put_contents($path.'/docker-compose.yml', $templateForCompose->render(false))) { $message = 'Failed to save Docker Compose file'; - $analytics->createEvent('install/server', 'install', APP_VERSION_STABLE.' - '.$message, 0); + $analytics->createEvent('install/server', 'install', APP_VERSION_STABLE.' - '.$message); Console::error($message); Console::exit(1); } if(!file_put_contents($path.'/.env', $templateForEnv->render(false))) { $message = 'Failed to save environment variables file'; - $analytics->createEvent('install/server', 'install', APP_VERSION_STABLE.' - '.$message, 0); + $analytics->createEvent('install/server', 'install', APP_VERSION_STABLE.' - '.$message); Console::error($message); Console::exit(1); } @@ -172,13 +172,13 @@ $cli if ($exit !== 0) { $message = 'Failed to install Appwrite dockers'; - $analytics->createEvent('install/server', 'install', APP_VERSION_STABLE.' - '.$message, 0); + $analytics->createEvent('install/server', 'install', APP_VERSION_STABLE.' - '.$message); Console::error($message); Console::error($stderr); Console::exit($exit); } else { $message = 'Appwrite installed successfully'; - $analytics->createEvent('install/server', 'install', APP_VERSION_STABLE.' - '.$message, 1); + $analytics->createEvent('install/server', 'install', APP_VERSION_STABLE.' - '.$message); Console::success($message); } }); \ No newline at end of file