From 2e3c10466e70a9a40aaf7215a6c3f1ec4e31d4cd Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Fri, 26 Oct 2012 07:15:42 -0400
Subject: [PATCH] Better handling of missing Mysqli library during
 installation.

---
 .../src/VuFind/Controller/InstallController.php  | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/module/VuFind/src/VuFind/Controller/InstallController.php b/module/VuFind/src/VuFind/Controller/InstallController.php
index a40e0e4c06e..70fd24b7701 100644
--- a/module/VuFind/src/VuFind/Controller/InstallController.php
+++ b/module/VuFind/src/VuFind/Controller/InstallController.php
@@ -321,9 +321,19 @@ class InstallController extends AbstractBase
                 $connection = 'mysql://' . $view->dbrootuser . ':'
                     . $this->params()->fromPost('dbrootpass') . '@'
                     . $view->dbhost;
-                $db = AdapterFactory::getAdapterFromConnectionString(
-                    $connection . '/mysql'
-                );
+                try {
+                    $db = AdapterFactory::getAdapterFromConnectionString(
+                        $connection . '/mysql'
+                    );
+                } catch (\Exception $e) {
+                    $this->flashMessenger()->setNamespace('error')
+                        ->addMessage(
+                            'Problem initializing database adapter; '
+                            . 'check for missing Mysqli library.  Details: '
+                            . $e->getMessage()
+                        );
+                    return $view;
+                }
                 try {
                     // Get SQL together
                     $query = 'CREATE DATABASE ' . $view->dbname;
-- 
GitLab