partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

commit b3c727c420fe71b8ed14a941527ff2df43f9b131
parent bb03dff8d2360f2447b34286ebd02979fbeedeee
Author: Felicitus <felicitus@felicitus.org>
Date:   Thu, 22 Dec 2011 04:39:51 +0100

Pre-flight database connectivity check: Test if the PDO_* driver is installed

Diffstat:
Msrc/setup/tests/check-database-connectivity.php | 13+++++++++++++
1 file changed, 13 insertions(+), 0 deletions(-)

diff --git a/src/setup/tests/check-database-connectivity.php b/src/setup/tests/check-database-connectivity.php @@ -13,6 +13,19 @@ PartKeepr::initializeClassLoaders(); $config = new \Doctrine\DBAL\Configuration(); /** + * Test if the requested driver is available + */ + +$drivers = PDO::getAvailableDrivers(); + +$bDriverAvailable = false; + +if (!in_array($_REQUEST["driver"], $drivers)) { + echo json_encode(array("error" => true, "errormessage" => "The requested driver isn't installed as PHP pdo module. Please install the PDO driver for PHP.")); + exit; +} + +/** * Check which driver we are going to use, and set the connection parameters accordingly. */ try {