Skip to content
Permalink
Browse files

Friendly error when mPDO error occurs on installation of Opencart.

  • Loading branch information...
tijme committed Jul 9, 2015
1 parent 64d143b commit 06f28dca66fb55f33a2c1753cfdec1e345348e4f
Showing with 7 additions and 1 deletion.
  1. +6 −0 upload/install/controller/step_3.php
  2. +1 −1 upload/system/library/db/mpdo.php
@@ -271,6 +271,12 @@ private function validate() {
} else {
$mysql->close();
}
} elseif ($this->request->post['db_driver'] == 'mpdo') {
try {
new \DB\mPDO($this->request->post['db_hostname'], $this->request->post['db_username'], $this->request->post['db_password'], $this->request->post['db_database'], $this->request->post['db_port']);
} catch(Exception $e) {
$this->error['warning'] = $e->getMessage();
}
}
if (!$this->request->post['username']) {
@@ -8,7 +8,7 @@ public function __construct($hostname, $username, $password, $database, $port =
try {
$this->pdo = new \PDO("mysql:host=" . $hostname . ";port=" . $port . ";dbname=" . $database, $username, $password, array(\PDO::ATTR_PERSISTENT => true));
} catch(\PDOException $e) {
trigger_error('Error: Could not make a database link ( ' . $e->getMessage() . '). Error Code : ' . $e->getCode() . ' <br />');
throw new \Exception('Unknown database \'' . $database . '\'');
exit();
}

0 comments on commit 06f28dc

Please sign in to comment.
You can’t perform that action at this time.