From a7f1cc26d3a7f4f67a86f5c6d240676e14cf318a Mon Sep 17 00:00:00 2001 From: Andrey Borysenko Date: Tue, 15 Feb 2022 01:12:54 +0200 Subject: [PATCH] Revert Python version check --- lib/Service/UtilsService.php | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/lib/Service/UtilsService.php b/lib/Service/UtilsService.php index 2e027162..022e5cea 100644 --- a/lib/Service/UtilsService.php +++ b/lib/Service/UtilsService.php @@ -162,15 +162,29 @@ public function getPythonVersion(): array { /** * Check if installed Python version compatible with MediaDC application * - * @return bool $isCompatible + * @return array $result */ - public function isPythonCompatible() { + public function isPythonCompatible(): array { $pythonVersion = $this->getPythonVersion(); if (!$pythonVersion['success']) { $this->logger->error('[' . self::class . '] getPythonVersion: ' . json_encode($pythonVersion)); return ['success' => false, 'result_code' => $pythonVersion['result_code']]; } - return ['success' => intval(join("", explode(".", $pythonVersion['matches']))) >= 3680]; + $pythonVersionDigits = explode(".", $pythonVersion['matches']); + if ((int)$pythonVersionDigits[0] >= 3) { + if ((int)$pythonVersionDigits[1] < 6) { + return ['success' => false, 'result_code' => $pythonVersion['result_code']]; + } + if ((int)$pythonVersionDigits[1] > 6) { + return ['success' => true, 'result_code' => $pythonVersion['result_code']]; + } else if ((int)$pythonVersionDigits[1] === 6 && (int)$pythonVersionDigits[2] >= 8) { + return ['success' => true, 'result_code' => $pythonVersion['result_code']]; + } + if ((int)$pythonVersionDigits[2] >= 0) { + return ['success' => true, 'result_code' => $pythonVersion['result_code']]; + } + } + return ['success' => false, 'result_code' => $pythonVersion['result_code']]; } public function getCustomAppsDirectory() {