diff options
Diffstat (limited to 'includes/common.inc')
-rw-r--r-- | includes/common.inc | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/includes/common.inc b/includes/common.inc index 83da25e2b..ebc8c1c07 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -766,8 +766,6 @@ function drupal_access_denied() { * A string containing the response body that was received. */ function drupal_http_request($url, array $options = array()) { - global $db_prefix; - $result = new stdClass(); // Parse the URL and make sure we can handle the schema. @@ -867,8 +865,9 @@ function drupal_http_request($url, array $options = array()) { // user-agent is used to ensure that multiple testing sessions running at the // same time won't interfere with each other as they would if the database // prefix were stored statically in a file or database variable. - if (is_string($db_prefix) && preg_match("/simpletest\d+/", $db_prefix, $matches)) { - $options['headers']['User-Agent'] = drupal_generate_test_ua($matches[0]); + $test_info = &$GLOBALS['drupal_test_info']; + if (!empty($test_info['test_run_id'])) { + $options['headers']['User-Agent'] = drupal_generate_test_ua($test_info['test_run_id']); } $request = $options['method'] . ' ' . $path . " HTTP/1.0\r\n"; @@ -4505,13 +4504,15 @@ function _drupal_bootstrap_full() { module_load_all(); // Make sure all stream wrappers are registered. file_get_stream_wrappers(); - if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'simpletest') !== FALSE) { - // Valid SimpleTest user-agent, log fatal errors to test specific file - // directory. The user-agent is validated in DRUPAL_BOOTSTRAP_DATABASE - // phase so as long as it is a SimpleTest user-agent it is valid. + + $test_info = &$GLOBALS['drupal_test_info']; + if (!empty($test_info['in_child_site'])) { + // Running inside the simpletest child site, log fatal errors to test + // specific file directory. ini_set('log_errors', 1); ini_set('error_log', file_directory_path() . '/error.log'); } + // Initialize $_GET['q'] prior to invoking hook_init(). drupal_path_initialize(); // Set a custom theme for the current page, if there is one. We need to run |