diff --git a/includes/common.inc b/includes/common.inc index c97704c..98b0c04 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -225,6 +225,15 @@ function drupal_get_profile() { if (isset($install_state['parameters']['profile'])) { $profile = $install_state['parameters']['profile']; } + // If this function is called before the bootstrap variables phase we need to + // fetch the value directly from the db. + elseif ( + drupal_get_bootstrap_phase() < DRUPAL_BOOTSTRAP_VARIABLES && + drupal_get_bootstrap_phase() >= DRUPAL_BOOTSTRAP_DATABASE + ) { + $result = db_query("SELECT value FROM {variable} WHERE name = 'install_profile'")->fetchField(); + $profile = $result ? unserialize($result) : 'standard'; + } else { $profile = variable_get('install_profile', 'standard'); }