Add telemetry to get insight into updates

This commit is contained in:
James Cole
2020-08-28 21:03:23 +02:00
parent 70f3d13626
commit 56ea680e46

View File

@@ -61,9 +61,9 @@ class UpdateController extends Controller
/**
* Show page with update options.
*
* @throws NotFoundExceptionInterface
* @throws ContainerExceptionInterface
* @return Factory|View
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function index()
{
@@ -100,6 +100,11 @@ class UpdateController extends Controller
$checkForUpdates = (int) $request->get('check_for_updates');
$channel = $request->get('update_channel');
$channel = in_array($channel, ['stable', 'beta', 'alpha'], true) ? $channel : 'stable';
// store as telemetry
app('telemetry')->feature('admin.update.channel', $channel);
app('telemetry')->feature('admin.update.permission', (string) $checkForUpdates);
app('fireflyconfig')->set('permission_update_check', $checkForUpdates);
app('fireflyconfig')->set('last_update_check', time());
app('fireflyconfig')->set('update_channel', $channel);