Added SQLite check

This commit is contained in:
Marc Ole Bulling 2020-04-28 10:24:11 +02:00
parent 86b7cfed29
commit 05dcd5aec0
No known key found for this signature in database
GPG Key ID: C126AFC2A47B06FF

View File

@ -3,11 +3,14 @@
class ERequirementNotMet extends Exception { } class ERequirementNotMet extends Exception { }
const REQUIRED_PHP_EXTENSIONS = array('fileinfo', 'pdo_sqlite', 'gd'); const REQUIRED_PHP_EXTENSIONS = array('fileinfo', 'pdo_sqlite', 'gd');
const REQUIRED_SQLITE_VERSION_INT = "3008003"; //3.8.3 - this value will be checked
const REQUIRED_SQLITE_VERSION_STRING = "3.8.3"; //This value is just for error output, no check is done
class PrerequisiteChecker class PrerequisiteChecker
{ {
public function checkRequirements() public function checkRequirements()
{ {
self::checkForSqliteVersion();
self::checkForConfigFile(); self::checkForConfigFile();
self::checkForConfigDistFile(); self::checkForConfigDistFile();
self::checkForComposer(); self::checkForComposer();
@ -50,4 +53,14 @@ class PrerequisiteChecker
} }
} }
} }
private function checkForSqliteVersion()
{
$sqliteVersion = SQLite3::version()["versionNumber"];
if ($sqliteVersion < REQUIRED_SQLITE_VERSION_INT)
{
throw new ERequirementNotMet('SQLite ' . REQUIRED_SQLITE_VERSION_STRING . ' is required, however you are running ' . SQLite3::version()["versionString"]);
}
}
} }