From d87a87b93a56304de19f9e6d4525dc69828dc3cb Mon Sep 17 00:00:00 2001 From: WLTBAgent Date: Fri, 13 Feb 2026 17:49:44 +0000 Subject: [PATCH] Fix: Add PHP 7.4 compatibility - Changed PHP min-version from 8.0 to 7.4 in appinfo/info.xml - Replaced all str_contains() calls with strpos() !== false - GoogleAnalyticsService.php: 1 instance - LLMService.php: 6 instances - Verified no other PHP 8.0+ features in use - Plugin now compatible with PHP 7.4 and PHP 8.0+ --- analytics-hub/appinfo/info.xml | 2 +- .../lib/Service/GoogleAnalyticsService.php | 2 +- analytics-hub/lib/Service/LLMService.php | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/analytics-hub/appinfo/info.xml b/analytics-hub/appinfo/info.xml index f0338ea..fa2fe5c 100644 --- a/analytics-hub/appinfo/info.xml +++ b/analytics-hub/appinfo/info.xml @@ -22,7 +22,7 @@ integration - + Repair steps not needed diff --git a/analytics-hub/lib/Service/GoogleAnalyticsService.php b/analytics-hub/lib/Service/GoogleAnalyticsService.php index 65fe86d..589b4fb 100644 --- a/analytics-hub/lib/Service/GoogleAnalyticsService.php +++ b/analytics-hub/lib/Service/GoogleAnalyticsService.php @@ -176,7 +176,7 @@ class GoogleAnalyticsService { $this->logger->error("Token refresh failed: {$e->getMessage()}"); // Check if it's an expired token error - if (str_contains($e->getMessage(), 'invalid_grant')) { + if (strpos($e->getMessage(), 'invalid_grant') !== false) { throw new TokenExpiredException('Refresh token expired - re-run OAuth setup'); } diff --git a/analytics-hub/lib/Service/LLMService.php b/analytics-hub/lib/Service/LLMService.php index c18e57e..9f1f928 100644 --- a/analytics-hub/lib/Service/LLMService.php +++ b/analytics-hub/lib/Service/LLMService.php @@ -136,9 +136,9 @@ PROMPT; $errorMessage = $e->getMessage(); // Check for rate limit - if (str_contains($errorMessage, 'rate_limit') || - str_contains($errorMessage, '429') || - str_contains($errorMessage, 'too_many_requests')) { + if (strpos($errorMessage, 'rate_limit') !== false || + strpos($errorMessage, '429') !== false || + strpos($errorMessage, 'too_many_requests') !== false) { $this->logger->warning("Rate limited, waiting " . self::RATE_LIMIT_DELAY . "s"); @@ -151,9 +151,9 @@ PROMPT; } // Check for timeout - if (str_contains($errorMessage, 'timeout') || - str_contains($errorMessage, 'connection') || - str_contains($errorMessage, 'timed out')) { + if (strpos($errorMessage, 'timeout') !== false || + strpos($errorMessage, 'connection') !== false || + strpos($errorMessage, 'timed out') !== false) { if ($attempt < self::MAX_RETRIES - 1) { $this->logger->warning("Timeout, retrying..."); @@ -235,7 +235,7 @@ PROMPT; throw new \Exception('Response too short - likely error'); } - if (!str_contains($response, '# Weekly Analytics Snapshot')) { + if (strpos($response, '# Weekly Analytics Snapshot') === false) { throw new \Exception('Missing required format'); } }