From 3916ca43a5beed801d4e12c705b7562be7d292f7 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Sat, 4 Mar 2017 11:33:30 +1100 Subject: [PATCH] Further Install errors following testing locally --- Civi/Install/Requirements.php | 11 +++++++++-- install/civicrm.php | 16 ++++++++++++++-- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/Civi/Install/Requirements.php b/Civi/Install/Requirements.php index 420b0eb40a..ad0848e80b 100644 --- a/Civi/Install/Requirements.php +++ b/Civi/Install/Requirements.php @@ -108,8 +108,15 @@ class Requirements { * @return object mysqli connection */ protected function connect($db_config) { - $conn = @mysqli_connect($db_config['host'], $db_config['username'], $db_config['password'], $db_config['database'], isset($db_config['port']) ? $db_config['port'] : NULL); - return $donn; + $host = NULL; + if (!empty($db_config['host'])) { + $host = $db_config['host']; + } + elseif (!empty($db_config['server'])) { + $host = $db_config['server']; + } + $conn = @mysqli_connect($host, $db_config['username'], $db_config['password'], $db_config['database'], !empty($db_config['port']) ? $db_config['port'] : NULL); + return $conn; } /** diff --git a/install/civicrm.php b/install/civicrm.php index c724722714..50e4271081 100644 --- a/install/civicrm.php +++ b/install/civicrm.php @@ -97,8 +97,13 @@ function civicrm_main(&$config) { civicrm_setup($files_dirname); } - $dsn = "mysql://{$config['mysql']['username']}:{$config['mysql']['password']}@{$config['mysql']['server']}/{$config['mysql']['database']}?new_link=true"; + $parts = explode(':', $config['mysql']['server']); + if (empty($parts[1])) { + $parts[1] = 3306; + } + $config['mysql']['server'] = implode(':', $parts); + $dsn = "mysql://{$config['mysql']['username']}:{$config['mysql']['password']}@{$config['mysql']['server']}/{$config['mysql']['database']}?new_link=true"; civicrm_source($dsn, $sqlPath . DIRECTORY_SEPARATOR . 'civicrm.mysql'); if (!empty($config['loadGenerated'])) { @@ -224,7 +229,14 @@ function civicrm_config(&$config) { $params['baseURL'] = isset($config['base_url']) ? $config['base_url'] : civicrm_cms_base(); if ($installType == 'drupal' && defined('VERSION')) { - if (version_compare(VERSION, '7.0-rc1') >= 0) { + if (version_compare(VERSION, '8.0') >= 0) { + $params['cms'] = 'Drupal'; + $params['CMSdbUser'] = addslashes($config['drupal']['username']); + $params['CMSdbPass'] = addslashes($config['drupal']['password']); + $params['CMSdbHost'] = $config['drupal']['host'] . ":" . !empty($config['drupal']['port']) ? $config['drupal']['port'] : "3306"; + $params['CMSdbName'] = addslashes($config['drupal']['database']); + } + elseif (version_compare(VERSION, '7.0-rc1') >= 0) { $params['cms'] = 'Drupal'; $params['CMSdbUser'] = addslashes($config['drupal']['username']); $params['CMSdbPass'] = addslashes($config['drupal']['password']); -- 2.25.1