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

Allow opt-in for sending anonymous data #30

Merged
merged 4 commits into from
Dec 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ language: php
sudo: false
dist: trusty
php:
- 7.3
- 7.2
- 7.1
- nightly

Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
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
Expand Up @@ -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
{
Expand Down Expand Up @@ -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:');
Expand Down