}
}
-// Set the locale (required by CRM_Core_Config)
+// Set the CMS
// This is mostly sympbolic, since nothing we do during the install
// really requires CIVICRM_UF to be defined.
$installTypeToUF = array(
$uf = (isset($installTypeToUF[$installType]) ? $installTypeToUF[$installType] : 'Drupal');
define('CIVICRM_UF', $uf);
+// Set the Locale (required by CRM_Core_Config)
global $tsLocale;
$tsLocale = 'en_US';
* This is exactly the same as mysqli_connect(), except that it accepts
* the port as part of the `$host`.
*
- * @param $host
- * @param $username
- * @param $password
+ * @param string $host
+ * Ex: 'localhost', 'localhost:3307', '127.0.0.1:3307', '[::1]', '[::1]:3307'.
+ * @param string $username
+ * @param string $password
* @param string $database
* @return \mysqli
*/
protected function connect($host, $username, $password, $database = '') {
$hostParts = explode(':', $host);
- if (count($hostParts) > 1) {
- list ($host, $port) = $hostParts;
+ if (count($hostParts) > 1 && strrpos($host, ']') !== strlen($host) - 1) {
+ $port = array_pop($hostParts);
+ $host = implode(':', $hostParts);
}
else {
- $port = '';
+ $port = NULL;
}
$conn = @mysqli_connect($host, $username, $password, $database, $port);
return $conn;
ts("MySQL support not included in PHP."),
));
+ // Check for XML support
+ $this->requireFunction('simplexml_load_file', array(
+ ts("PHP Configuration"),
+ ts("SimpleXML support"),
+ ts("SimpleXML support not included in PHP."),
+ ));
+
// Check for JSON support
$this->requireFunction('json_encode', array(
ts("PHP Configuration"),
// now enable civicrm module.
module_enable(array('civicrm', 'civicrmtheme'));
+ // SystemInstallEvent will be called from here with the first call of CRM_Core_Config,
+ // which calls Core_BAO_ConfigSetting::applyLocale(), who will default to calling
+ // Civi::settings()->get('lcMessages');
+ // Therefore, we need to pass the seedLanguage before that.
+ global $civicrm_setting;
+ $civicrm_setting['domain']['lcMessages'] = $config['seedLanguage'];
+
// clear block, page, theme, and hook caches
drupal_flush_all_caches();
$GLOBALS['user'] = $original_user;
drupal_save_session(TRUE);
- //change the default language to one chosen
- if (isset($config['seedLanguage']) && $config['seedLanguage'] != 'en_US') {
- civicrm_api3('Setting', 'create', array(
- 'domain_id' => 'current_domain',
- 'lcMessages' => $config['seedLanguage'],
- )
- );
- }
-
$output .= '</ul>';
$output .= '</div>';
$output .= '</body>';