Skip to content

Firefly III: a personal finances manager

Add telemetry to get insight into updates

James Cole56ea680e46be
diff --git a/app/Http/Controllers/Admin/UpdateController.php b/app/Http/Controllers/Admin/UpdateController.php
index f9c0b1d1e6..ac35327a2b 100644
--- a/app/Http/Controllers/Admin/UpdateController.php
+++ b/app/Http/Controllers/Admin/UpdateController.php
@@ -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);