Skip to content
This repository has been archived by the owner on Mar 18, 2022. It is now read-only.

Commit

Permalink
Merge pull request #30 from roots/countly-integration
Browse files Browse the repository at this point in the history
Allow opt-in for sending anonymous data
retlehs authored Dec 28, 2018

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents b5f9b2f + e6c30d6 commit 60c329d
Showing 4 changed files with 214 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -2,6 +2,8 @@ language: php
sudo: false
dist: trusty
php:
- 7.3
- 7.2
- 7.1
- nightly

5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -34,10 +34,11 @@
"require": {
"illuminate/console": "~5.6",
"illuminate/filesystem": "~5.6",
"symfony/process": "~3.3"
"symfony/process": "~3.3",
"ramsey/uuid": "^3.8"
},
"require-dev": {
"squizlabs/php_codesniffer": "~3.0"
"squizlabs/php_codesniffer": "~3.3.1"
},
"scripts": {
"test": [
199 changes: 192 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 17 additions & 1 deletion src/Console/Commands/PresetCommand.php
Original file line number Diff line number Diff line change
@@ -15,6 +15,7 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Ramsey\Uuid\Uuid;

class PresetCommand extends Command
{
@@ -64,7 +65,22 @@ protected function execute(InputInterface $input, OutputInterface $output)
return;
}
$preset->handle();
$this->info('Done.');
$this->info(' Done.');

// phpcs:disable
if ($this->confirm("Send anonymous usage data? \n<comment> We are only sending your framework selection and OS</comment>\n\n")) {
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => 'https://stats.roots.io/i?device_id='.Uuid::uuid4().'&app_key=fd022e092a7ff07e996ca3cec86847bf1baf0879&begin_session=1&events=[{"key":"framework_selected","count":1,"segmentation":{"framework":"'.$this->argument('framework').'"}}]&metrics={"_os":"'.PHP_OS.'","_browser":"null","_browser_version":"0","_device":"null"}&end_session=1&session_duration=30',
CURLOPT_USERAGENT => 'sage-installer-composer'
]);

$resp = curl_exec($curl);
curl_close($curl);
}
// phpcs:enable

$this->comment('Please run `yarn && yarn build` to compile your fresh scaffolding.');
$this->comment('');
$this->comment('Help support our open-source development efforts by contributing to Sage via Patreon:');

0 comments on commit 60c329d

Please sign in to comment.