private function connect_to_existing_db()
{
if ($config = $this->get_config_file()) {
$config = preg_replace('/<\\?php(.*)\\?' . '>/ims', '$1', $config);
// Update the db_connection from the config that is about to be written:
eval($config);
/* Attempt to connect to the database host */
try {
DB::connect();
return true;
} catch (\PDOException $e) {
$this->theme->assign('form_errors', array('db_user' => _t('Problem connecting to supplied database credentials')));
return false;
}
}
// If we couldn't create the config from the template, return an error
return false;
}