diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index d58779d..9e4f25d 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -701,7 +701,8 @@ function drupal_generate_test_ua($prefix) { if (!isset($key) || $last_prefix != $prefix) { $last_prefix = $prefix; $test_db = new TestDatabase($prefix); - $key_file = DRUPAL_ROOT . '/' . $test_db->getTestSitePath() . '/.htkey'; + $key_file_directory = DRUPAL_ROOT . '/' . $test_db->getTestSitePath(); + $key_file = $key_file_directory . '/.htkey'; // When issuing an outbound HTTP client request from within an inbound test // request, then the outbound request has to use the same User-Agent header // as the inbound request. A newly generated private key for the same test @@ -717,6 +718,7 @@ function drupal_generate_test_ua($prefix) { else { // Generate and save a new hash salt for a test run. // Consumed by drupal_valid_test_ua() before settings.php is loaded. + file_exists($key_file_directory) ? chmod($key_file_directory, 0775) : mkdir($key_file_directory, 0755); $private_key = Crypt::randomBytesBase64(55); file_put_contents($key_file, $private_key); }