mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 17:45:39 +00:00
* Added SQLite check * Moved check behind Extensions check * Changed to SqlitePDO
This commit is contained in:
parent
86b7cfed29
commit
a9dc5deaaa
@ -3,6 +3,7 @@
|
|||||||
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 = "3.8.3";
|
||||||
|
|
||||||
class PrerequisiteChecker
|
class PrerequisiteChecker
|
||||||
{
|
{
|
||||||
@ -12,6 +13,7 @@ class PrerequisiteChecker
|
|||||||
self::checkForConfigDistFile();
|
self::checkForConfigDistFile();
|
||||||
self::checkForComposer();
|
self::checkForComposer();
|
||||||
self::checkForPhpExtensions();
|
self::checkForPhpExtensions();
|
||||||
|
self::checkForSqliteVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -50,4 +52,21 @@ class PrerequisiteChecker
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function checkForSqliteVersion()
|
||||||
|
{
|
||||||
|
$sqliteVersion = self::getSqlVersionAsString();
|
||||||
|
if (version_compare($sqliteVersion, REQUIRED_SQLITE_VERSION, '<'))
|
||||||
|
{
|
||||||
|
throw new ERequirementNotMet('SQLite ' . REQUIRED_SQLITE_VERSION . ' is required, however you are running ' . $sqliteVersion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getSqlVersionAsString()
|
||||||
|
{
|
||||||
|
$dbh = new PDO('sqlite::memory:');
|
||||||
|
return $dbh->query('select sqlite_version()')->fetch()[0];
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user