function domain_conf_domain_bootstrap_full in Domain Access 7.2
Same name and namespace in other branches
- 6.2 domain_conf/domain_conf.module \domain_conf_domain_bootstrap_full()
- 7.3 domain_conf/domain_conf.module \domain_conf_domain_bootstrap_full()
Implements hook_domain_bootstrap_full().
File
- domain_conf/
domain_conf.module, line 18 - Domain manager configuration options.
Code
function domain_conf_domain_bootstrap_full($domain) {
static $check;
// If running domain_set_domain(), we have issues with the variables
// from the primary domain, which need to be loaded from cache.
// @link http://drupal.org/node/412156
if ($check) {
$_domain = domain_get_domain();
if ($domain['domain_id'] == 0 && $check != $_domain['domain_id']) {
_domain_conf_load_primary(TRUE);
}
}
// Flag that we have already loaded.
$check = $domain['domain_id'];
$data = db_query("SELECT settings FROM {domain_conf} WHERE domain_id = :domain_id", array(
':domain_id' => $domain['domain_id'],
))
->fetchField();
if (!empty($data)) {
global $conf;
$settings = domain_unserialize($data);
// Overwrite the $conf variables.
foreach ($settings as $key => $value) {
if ($value === 'domain-conf-ignore') {
continue;
}
// Language handling is a special case.
if ($key == 'language_default') {
$table = domain_get_primary_table('system');
$language = (bool) db_query("SELECT status FROM {$table} WHERE name = 'locale' AND type = 'module'")
->fetchField();
if ($language) {
$table = domain_get_primary_table('languages');
$temp = db_query("SELECT * FROM {$table} WHERE language = :language", array(
':language' => $value,
))
->fetchObject();
if (!empty($temp)) {
$value = $temp;
$GLOBALS['language'] = $temp;
$conf[$key] = $value;
}
// Ensure we store the default language in case of reset.
// See domain_conf_js_maintain().
$table = domain_get_primary_table('variable');
$result = db_query("SELECT value FROM {$table} WHERE name = :name", array(
':name' => $key,
))
->fetchField();
if (!empty($result)) {
domain_conf_default_language(unserialize($result));
}
}
}
else {
$conf[$key] = $value;
}
}
}
}