Domain Access - settings.php Undefined Index: default
Submitted by alan on Mon, 08/23/2010 - 11:19
One of my test domains was reporting and undefined index at the top of every page:
Notice: Undefined index: default in C:\wamp\www\drupal-6.16\sites\all\modules\domain\domain.bootstrap.inc on line 242
The Drupal forums didn't offer any help for this specific item, so I looked at the exact code in question:
function domain_get_primary_table($table) {
global $db_prefix;
if (is_string($db_prefix)) {
$table = $db_prefix . $table;
}
else if (is_array($db_prefix)) {
$table = $db_prefix['default'] . $table;
}
return db_escape_table($table);
}
global $db_prefix;
if (is_string($db_prefix)) {
$table = $db_prefix . $table;
}
else if (is_array($db_prefix)) {
$table = $db_prefix['default'] . $table;
}
return db_escape_table($table);
}
This function loads specific tables from the setting.php file when an array of table prefixes has been specified. Usually, this takes the following form:
$db_prefix = array(
'url_alias' => 'some_domain'
};
'url_alias' => 'some_domain'
};
My shared content project has all the shared content in a single table, so unique prefixing doesn't work. I had code like this in my settings.php file that was causing the original error and it took only a little detective work to root out the problem!