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()
Calls individual bootstrap phases.
Parameters
$phase: The domain bootstrap phase to call.
Return value
Returns TRUE if the bootstrap phase was successful and FALSE otherwise.
1 call to _domain_bootstrap()
- domain_bootstrap in ./
domain.bootstrap.inc - Domain module bootstrap: calls all bootstrap phases.
File
- ./
domain.bootstrap.inc, line 93 - Domain bootstrap file.
Code
function _domain_bootstrap($phase) {
global $_domain;
switch ($phase) {
case DOMAIN_BOOTSTRAP_INIT:
// Make sure database is loaded.
// The new update handler causes problems here, so we account for it.
// Same with drush or other CLI resources. It turns out that the
// drupal_is_cli() function is not consistent for php and drush scripts,
// so instead, we check to see if the database driver has been loaded.
// See http://drupal.org/node/1342740 for the latest background.
$new_phase = FALSE;
// If running from drush or update.php, we act differently.
if (function_exists('drush_verify_cli') || function_exists('update_prepare_d7_bootstrap')) {
$new_phase = TRUE;
}
drupal_bootstrap(DRUPAL_BOOTSTRAP_DATABASE, $new_phase);
// If the Domain Access module has been disabled, stop loading.
$table = domain_get_primary_table('system');
$check = (bool) db_query("SELECT status FROM {$table} WHERE name = 'domain' AND type = 'module'")
->fetchField();
if (empty($check)) {
return NULL;
}
// Load bootstrap modules registered by Domain Access.
_domain_bootstrap_modules_load();
// If essential core module file has not been loaded, bootstrap fails.
if (!function_exists('domain_load')) {
return FALSE;
}
break;
case DOMAIN_BOOTSTRAP_NAME_RESOLVE:
// Get the domain_id of the request.
$_domain = domain_resolve_host();
// If we don't have a valid domain id now, we can't really go on, bootstrap fails.
if (empty($_domain) || !is_numeric($_domain['domain_id'])) {
return FALSE;
}
break;
case DOMAIN_BOOTSTRAP_FULL:
// Grant access to all affiliates. See http://drupal.org/node/770650
$_domain['site_grant'] = DOMAIN_SITE_GRANT;
// Load all bootstrap processes registered with the module.
_domain_bootstrap_invoke_all('full', $_domain);
break;
}
return TRUE;
}