function domain_bootstrap in Domain Access 7.2
Same name and namespace in other branches
- 6.2 domain.bootstrap.inc \domain_bootstrap()
- 7.3 domain.bootstrap.inc \domain_bootstrap()
Domain module bootstrap: calls all bootstrap phases.
Effectively, we add our own bootstrap phase to Drupal core. This allows us to do selective configuration changes before Drupal has a chance to react. For example, the Domain Conf module allows page caching to be set to "on" for example.com but "off" for no-cache.example.com.
The big issues here are command-line interactions, which are slightly different; and the fact that drupal_settings_initialize() is needed to properly hit the page cache.
The initial check for GLOBALS['base_root'] lets us know that we have already run the normal configuration routine and are now free to alter settings per-domain.
Note that this problem is largely caused by the need to jump ahead in drupal_bootstrap() in order to have database functions available.
1 call to domain_bootstrap()
File
- ./
domain.bootstrap.inc, line 55 - Domain bootstrap file.
Code
function domain_bootstrap() {
global $_domain;
// Initialize our global variable.
$_domain = array();
// Ensure that core globals are loaded so that we don't break page caching.
// See http://drupal.org/node/1046844 and http://drupal.org/node/1189916.
if (!isset($GLOBALS['base_root'])) {
domain_settings_initialize();
}
$phases = array(
DOMAIN_BOOTSTRAP_INIT,
DOMAIN_BOOTSTRAP_NAME_RESOLVE,
DOMAIN_BOOTSTRAP_FULL,
);
foreach ($phases as $phase) {
// We return NULL if the domain module is not enabled. This prevents
// load errors during module enable / disable.
$error = _domain_bootstrap($phase);
if ($error === NULL) {
$_domain['error'] = -1;
break;
}
elseif ($error === FALSE) {
// watchdog() is not available here, and there may be other logging.
// So we have to write an error message global variable and pick them up
// in settings,inc.
$_domain['error'] = $phase;
break;
}
}
}