diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index e1c15fe..25dc9aa 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -517,11 +517,7 @@ function find_conf_path($http_host, $script_name, $require_settings = TRUE) { function config_get_config_directory($type = CONFIG_ACTIVE_DIRECTORY) { global $config_directories; - if ($test_prefix = drupal_valid_test_ua()) { - // @see Drupal\simpletest\WebTestBase::setUp() - $path = conf_path() . '/files/simpletest/' . substr($test_prefix, 10) . '/config_' . $type; - } - elseif (!empty($config_directories[$type])) { + if (!empty($config_directories[$type])) { // Allow a configuration directory path to be outside of webroot. if (empty($config_directories[$type]['absolute'])) { $path = conf_path() . '/files/' . $config_directories[$type]['path']; @@ -2596,8 +2592,8 @@ function drupal_valid_test_ua($new_prefix = NULL) { return $test_prefix; } - if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match("/^(simpletest\d+);(.+);(.+);(.+)$/", $_SERVER['HTTP_USER_AGENT'], $matches)) { - list(, $prefix, $time, $salt, $hmac) = $matches; + if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match("/^(simpletest\d+);(.+);(.+);(.+)([YN])$/", $_SERVER['HTTP_USER_AGENT'], $matches)) { + list(, $prefix, $time, $salt, $hmac, $config) = $matches; $check_string = $prefix . ';' . $time . ';' . $salt; // We use the salt from settings.php to make the HMAC key, since // the database is not yet initialized and we can't access any Drupal variables. @@ -2608,6 +2604,11 @@ function drupal_valid_test_ua($new_prefix = NULL) { // and the HMAC must match. if ($time_diff >= 0 && $time_diff <= 5 && $hmac == drupal_hmac_base64($check_string, $key)) { $test_prefix = $prefix; + if ($config === 'Y') { + foreach (array(CONFIG_ACTIVE_DIRECTORY, CONFIG_STAGING_DIRECTORY) as $type) { + $GLOBALS['config_directories'][$type] = array('path' => 'simpletest/' . substr($test_prefix, 10) . '/config_' . $type); + } + } return $test_prefix; } } @@ -2619,7 +2620,7 @@ function drupal_valid_test_ua($new_prefix = NULL) { /** * Generates a user agent string with a HMAC and timestamp for simpletest. */ -function drupal_generate_test_ua($prefix) { +function drupal_generate_test_ua($prefix, $config = 'Y') { global $drupal_hash_salt; static $key; @@ -2632,7 +2633,7 @@ function drupal_generate_test_ua($prefix) { // Generate a moderately secure HMAC based on the database credentials. $salt = uniqid('', TRUE); $check_string = $prefix . ';' . time() . ';' . $salt; - return $check_string . ';' . drupal_hmac_base64($check_string, $key); + return $check_string . ';' . drupal_hmac_base64($check_string, $key) . $config; } /**