1
0
Fork 0
mirror of synced 2024-06-22 04:30:29 +12:00

add client id to analytics

This commit is contained in:
Torsten Dittmann 2021-02-04 10:26:58 +01:00
parent 0cf42ebad0
commit e23828777f
2 changed files with 29 additions and 13 deletions

View file

@ -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);
}
});

12
composer.lock generated
View file

@ -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",