From 4d7d394f2732ff08a3bd33d9b392e95a693af1ce Mon Sep 17 00:00:00 2001 From: exaby73 Date: Thu, 13 Feb 2025 16:02:55 +0530 Subject: [PATCH 1/4] chore: Opt out of Bolt analytics --- src/Bolt/ProtocolFactory.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Bolt/ProtocolFactory.php b/src/Bolt/ProtocolFactory.php index 4f9294ba..16617846 100644 --- a/src/Bolt/ProtocolFactory.php +++ b/src/Bolt/ProtocolFactory.php @@ -32,6 +32,8 @@ class ProtocolFactory */ public function createProtocol(IConnection $connection, AuthenticateInterface $auth, string $userAgent): array { + putenv('BOLT_ANALYTICS_OPTOUT=1'); + $bolt = new Bolt($connection); $bolt->setProtocolVersions(5.4, 5.3, 5, 4.4); From 0593baa2b1bf3c3e066e5a0525d34d1627909ecf Mon Sep 17 00:00:00 2001 From: exaby73 Date: Tue, 18 Feb 2025 12:51:57 +0530 Subject: [PATCH 2/4] fix: Only opt out if user has not set BOLT_ANALYTICS_OPTOUT --- src/Bolt/ProtocolFactory.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Bolt/ProtocolFactory.php b/src/Bolt/ProtocolFactory.php index 16617846..72e421ff 100644 --- a/src/Bolt/ProtocolFactory.php +++ b/src/Bolt/ProtocolFactory.php @@ -32,7 +32,11 @@ class ProtocolFactory */ public function createProtocol(IConnection $connection, AuthenticateInterface $auth, string $userAgent): array { - putenv('BOLT_ANALYTICS_OPTOUT=1'); + $boltOptoutEnv = getenv('BOLT_ANALYTICS_OPTOUT'); + /** @psalm-suppress RiskyTruthyFalsyComparison */ + if (empty($boltOptoutEnv)) { + putenv('BOLT_ANALYTICS_OPTOUT=1'); + } $bolt = new Bolt($connection); $bolt->setProtocolVersions(5.4, 5.3, 5, 4.4); From 58d2feccc6e51977958116337b61b3c9ff08d180 Mon Sep 17 00:00:00 2001 From: Nabeel Parkar Date: Sat, 22 Feb 2025 11:31:56 +0530 Subject: [PATCH 3/4] fix: Compare env to false instead of using empty --- src/Bolt/ProtocolFactory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bolt/ProtocolFactory.php b/src/Bolt/ProtocolFactory.php index 72e421ff..58ce4e72 100644 --- a/src/Bolt/ProtocolFactory.php +++ b/src/Bolt/ProtocolFactory.php @@ -34,7 +34,7 @@ public function createProtocol(IConnection $connection, AuthenticateInterface $a { $boltOptoutEnv = getenv('BOLT_ANALYTICS_OPTOUT'); /** @psalm-suppress RiskyTruthyFalsyComparison */ - if (empty($boltOptoutEnv)) { + if ($boltOptoutEnv === false) { putenv('BOLT_ANALYTICS_OPTOUT=1'); } From 1e9aacf51e1c98285be718ab8f4b30ac7ac6b06e Mon Sep 17 00:00:00 2001 From: Nabeel Parkar Date: Sat, 22 Feb 2025 11:33:02 +0530 Subject: [PATCH 4/4] chore: Remove unnecessary psalm suppress --- src/Bolt/ProtocolFactory.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Bolt/ProtocolFactory.php b/src/Bolt/ProtocolFactory.php index 58ce4e72..8d425adc 100644 --- a/src/Bolt/ProtocolFactory.php +++ b/src/Bolt/ProtocolFactory.php @@ -33,7 +33,6 @@ class ProtocolFactory public function createProtocol(IConnection $connection, AuthenticateInterface $auth, string $userAgent): array { $boltOptoutEnv = getenv('BOLT_ANALYTICS_OPTOUT'); - /** @psalm-suppress RiskyTruthyFalsyComparison */ if ($boltOptoutEnv === false) { putenv('BOLT_ANALYTICS_OPTOUT=1'); }