From 94cfe5555516a37416796a7ac32945f23528c20e Mon Sep 17 00:00:00 2001 From: Darko Gjorgjijoski Date: Sat, 13 Jul 2024 15:18:10 +0200 Subject: [PATCH] Add sqlite3 validation --- app/Space/EnvironmentManager.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/Space/EnvironmentManager.php b/app/Space/EnvironmentManager.php index 981b0b67..6bfc4164 100755 --- a/app/Space/EnvironmentManager.php +++ b/app/Space/EnvironmentManager.php @@ -120,6 +120,20 @@ class EnvironmentManager $dbEnv['DB_PASSWORD'] = $request->get('database_password'); } } else { + // Laravel 11 requires SQLite at least v3.35.0 + // https://laravel.com/docs/11.x/database#introduction + if (extension_loaded('sqlite3') && class_exists('\SQLite3') && method_exists('\SQLite3', 'version')) { + $version = \SQLite3::version(); + if (!empty($version['versionString']) && version_compare($version['versionString'], '3.35.0', '<')) { + return [ + 'error_message' => sprintf('The minimum SQLite version is %s. Your current SQLite version is %s which is not supported. Please upgrade SQLite and retry.', '3.35.0', $version['versionString']), + ]; + } + } else { + return [ + 'error_message' => sprintf('SQLite3 is not present. Please install SQLite >=%s and retry.', '3.35.0'), + ]; + } $dbEnv['DB_DATABASE'] = $request->get('database_name'); if (!empty($dbEnv['DB_DATABASE'])) { $sqlite_path = $dbEnv['DB_DATABASE'];