summaryrefslogtreecommitdiff
path: root/install.php
diff options
context:
space:
mode:
authorNeil Drumm <drumm@3064.no-reply.drupal.org>2006-10-04 07:10:23 +0000
committerNeil Drumm <drumm@3064.no-reply.drupal.org>2006-10-04 07:10:23 +0000
commit7851004a1e7ae808f4879d3570617c4a5a62b6ee (patch)
treed67059527b9ce17fde008f7dec76a71728f4f1f5 /install.php
parent03be9b6f324dc99b4f3123c702859b0d6f50c092 (diff)
downloadbrdo-7851004a1e7ae808f4879d3570617c4a5a62b6ee.tar.gz
brdo-7851004a1e7ae808f4879d3570617c4a5a62b6ee.tar.bz2
#81218 by chx. Allow install.php to act on array db urls and prefixes.
Diffstat (limited to 'install.php')
-rw-r--r--install.php9
1 files changed, 5 insertions, 4 deletions
diff --git a/install.php b/install.php
index 73e166231..a688c1564 100644
--- a/install.php
+++ b/install.php
@@ -106,7 +106,7 @@ function install_verify_settings() {
// We need this because we want to run form_get_errors.
include_once './includes/form.inc';
- $url = parse_url($db_url);
+ $url = parse_url(is_array($db_url) ? $db_url['default'] : $db_url);
$db_user = urldecode($url['user']);
$db_pass = urldecode($url['pass']);
$db_host = urldecode($url['host']);
@@ -128,7 +128,7 @@ function install_verify_settings() {
function install_change_settings($profile = 'default', $install_locale = '') {
global $db_url, $db_type, $db_prefix;
- $url = parse_url($db_url);
+ $url = parse_url(is_array($db_url) ? $db_url['default'] : $db_url);
$db_user = urldecode($url['user']);
$db_pass = urldecode($url['pass']);
$db_host = urldecode($url['host']);
@@ -304,7 +304,7 @@ function _install_settings_form_validate($db_prefix, $db_type, $db_user, $db_pas
}
// Verify database prefix
- if (!empty($db_prefix) && preg_match('/[^A-Za-z0-9_]/', $db_prefix)) {
+ if (!empty($db_prefix) && is_string($db_prefix) && preg_match('/[^A-Za-z0-9_]/', $db_prefix)) {
form_set_error('db_prefix', st('The database prefix you have entered, %db_prefix, is invalid. The database prefix can only contain alphanumeric characters and underscores.', array('%db_prefix' => $db_prefix)), 'error');
}
@@ -314,7 +314,8 @@ function _install_settings_form_validate($db_prefix, $db_type, $db_user, $db_pas
// Check database type
if (!isset($form)) {
- $db_type = substr($db_url, 0, strpos($db_url, '://'));
+ $_db_url = is_array($db_url) ? $db_url['default'] : $db_url;
+ $db_type = substr($_db_url, 0, strpos($_db_url, '://'));
}
$databases = drupal_detect_database_types();
if (!in_array($db_type, $databases)) {