This commit is contained in:
@@ -26,6 +26,13 @@
|
|||||||
options: ''
|
options: ''
|
||||||
type: boolean
|
type: boolean
|
||||||
description: 'Include beta and other pre-release versions when checking for a new version'
|
description: 'Include beta and other pre-release versions when checking for a new version'
|
||||||
|
- key: general.telemetry
|
||||||
|
name: 'Send telemetry to phpVMS'
|
||||||
|
group: general
|
||||||
|
value: true
|
||||||
|
options: ''
|
||||||
|
type: boolean
|
||||||
|
description: 'Send some data (php version, mysql version) to phpVMS. See AnalyticsSvc code for details'
|
||||||
- key: units.distance
|
- key: units.distance
|
||||||
name: 'Distance Units'
|
name: 'Distance Units'
|
||||||
group: units
|
group: units
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ namespace App\Services;
|
|||||||
|
|
||||||
use App\Contracts\Service;
|
use App\Contracts\Service;
|
||||||
use App\Models\Enums\AnalyticsDimensions;
|
use App\Models\Enums\AnalyticsDimensions;
|
||||||
|
use Exception;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Irazasyed\LaravelGAMP\Facades\GAMP;
|
use Irazasyed\LaravelGAMP\Facades\GAMP;
|
||||||
@@ -12,30 +13,50 @@ use PDO;
|
|||||||
class AnalyticsService extends Service
|
class AnalyticsService extends Service
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Send out some stats about the install
|
* Create a GAMP instance with a random ID
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
private function getGAMPInstance()
|
||||||
|
{
|
||||||
|
return GAMP::setClientId(uniqid('', true));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send out some stats about the install, like the PHP and DB versions
|
||||||
*/
|
*/
|
||||||
public function sendInstall()
|
public function sendInstall()
|
||||||
{
|
{
|
||||||
if (config('app.analytics') === false) {
|
if (setting('general.telemetry') === false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// some analytics
|
// Generate a random client ID
|
||||||
$gamp = GAMP::setClientId(uniqid('', true));
|
$gamp = $this->getGAMPInstance();
|
||||||
|
|
||||||
$gamp->setDocumentPath('/install');
|
$gamp->setDocumentPath('/install');
|
||||||
|
|
||||||
$gamp->setCustomDimension(PHP_VERSION, AnalyticsDimensions::PHP_VERSION);
|
// Send the PHP version
|
||||||
|
$gamp->setCustomDimension(PHP_VERSION, AnalyticsDimensions::PHPVMS_VERSION);
|
||||||
|
|
||||||
// figure out database version
|
// Figure out the database version
|
||||||
$pdo = DB::connection()->getPdo();
|
$pdo = DB::connection()->getPdo();
|
||||||
$gamp->setCustomDimension(
|
$gamp->setCustomDimension(
|
||||||
strtolower($pdo->getAttribute(PDO::ATTR_SERVER_VERSION)),
|
strtolower($pdo->getAttribute(PDO::ATTR_SERVER_VERSION)),
|
||||||
AnalyticsDimensions::DATABASE_VERSION
|
AnalyticsDimensions::DATABASE_VERSION
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Send the PHPVMS Version
|
||||||
|
$versionSvc = app(VersionService::class);
|
||||||
|
$gamp->setCustomDimension(
|
||||||
|
$versionSvc->getCurrentVersion(false),
|
||||||
|
AnalyticsDimensions::PHP_VERSION
|
||||||
|
);
|
||||||
|
|
||||||
|
// Send that an install was done
|
||||||
try {
|
try {
|
||||||
$gamp->sendPageview();
|
$gamp->sendPageview();
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
Log::error($e->getMessage());
|
Log::error($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-1
@@ -43,7 +43,7 @@ if (!function_exists('get_truth_state')) {
|
|||||||
$state = strtolower($state);
|
$state = strtolower($state);
|
||||||
}
|
}
|
||||||
|
|
||||||
return \in_array($state, $enabledStates, false);
|
return in_array($state, $enabledStates, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,6 +148,18 @@ if (!function_exists('setting')) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Shortcut for retrieving a setting value
|
||||||
|
*/
|
||||||
|
if (!function_exists('setting_save')) {
|
||||||
|
function setting_save($key, $value)
|
||||||
|
{
|
||||||
|
$settingRepo = app('setting');
|
||||||
|
$settingRepo->save($key, $value);
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Wrap the asset URL in the publicBaseUrl that's been
|
* Wrap the asset URL in the publicBaseUrl that's been
|
||||||
* set
|
* set
|
||||||
|
|||||||
@@ -17,10 +17,6 @@ return [
|
|||||||
'locale' => env('APP_LOCALE', 'en'),
|
'locale' => env('APP_LOCALE', 'en'),
|
||||||
'fallback_locale' => 'en',
|
'fallback_locale' => 'en',
|
||||||
|
|
||||||
// This sends install and vaCentral specific information to help with
|
|
||||||
// optimizations and figuring out where slowdowns might be happening
|
|
||||||
'analytics' => true,
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Anything below here won't need changing and could break things
|
// Anything below here won't need changing and could break things
|
||||||
//
|
//
|
||||||
|
|||||||
+4
-4
@@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'tracking_id' => 'UA-100567975-1',
|
'tracking_id' => 'UA-100567975-4',
|
||||||
'protocol_version' => 1,
|
'protocol_version' => 1,
|
||||||
'is_ssl' => false,
|
'is_ssl' => true,
|
||||||
'is_disabled' => false,
|
'is_disabled' => false,
|
||||||
'anonymize_ip' => false,
|
'anonymize_ip' => true,
|
||||||
'async_requests' => false,
|
'async_requests' => true,
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -330,9 +330,13 @@ class InstallerController extends Controller
|
|||||||
$user = $this->userService->createUser($user, ['admin']);
|
$user = $this->userService->createUser($user, ['admin']);
|
||||||
Log::info('User registered: ', $user->toArray());
|
Log::info('User registered: ', $user->toArray());
|
||||||
|
|
||||||
// Set the intial admin e-mail address
|
// Set the initial admin e-mail address
|
||||||
setting('general.admin_email', $user->email);
|
setting_save('general.admin_email', $user->email);
|
||||||
|
|
||||||
|
// Save telemetry setting
|
||||||
|
setting_save('general.telemetry', get_truth_state($request->get('telemetry')));
|
||||||
|
|
||||||
|
// Try sending telemetry info
|
||||||
$this->analyticsSvc->sendInstall();
|
$this->analyticsSvc->sendInstall();
|
||||||
|
|
||||||
return view('installer::install/steps/step3a-completed', []);
|
return view('installer::install/steps/step3a-completed', []);
|
||||||
|
|||||||
@@ -81,27 +81,25 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
{{--
|
<tr>
|
||||||
<tr>
|
<td colspan="2"><h4>Options</h4></td>
|
||||||
<td colspan="2"><h4>Options</h4></td>
|
</tr>
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><p>Analytics</p></td>
|
<td><p>Analytics</p></td>
|
||||||
<td>
|
<td>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
{{ Form::hidden('analytics', 0) }}
|
{{ Form::hidden('telemetry', 0) }}
|
||||||
{{ Form::checkbox('analytics', 1, true, ['class' => 'form-control']) }}
|
{{ Form::checkbox('telemetry', 1, true, ['class' => 'form-control']) }}
|
||||||
<br />
|
<br />
|
||||||
<p>
|
<p>
|
||||||
Allows collection of analytics. They won't identify you, and helps us to track
|
Allows collection of analytics. They won't identify you, and helps us to track
|
||||||
the PHP and database versions that are used, and help to figure out problems
|
the PHP and database versions that are used, and help to figure out problems
|
||||||
and slowdowns when vaCentral integration is enabled.
|
and slowdowns when vaCentral integration is enabled.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
--}}
|
|
||||||
</table>
|
</table>
|
||||||
<div id="dbtest"></div>
|
<div id="dbtest"></div>
|
||||||
<p style="text-align: right">
|
<p style="text-align: right">
|
||||||
|
|||||||
Reference in New Issue
Block a user