Prepares the appropriate session for the release of Drupal being upgraded.
protected function prepareD8Session() {
// We need an IP when storing sessions
// so add a dummy request in the container.
$request = Request::create('http://example.com/');
$request->server
->set('REMOTE_ADDR', '3.3.3.3');
$this->container
->set('request', $request);
// Generate and set a D7-compatible session cookie.
$this
->curlInitialize();
$sid = Crypt::hashBase64(uniqid(mt_rand(), TRUE) . Crypt::randomBytes(55));
curl_setopt($this->curlHandle, CURLOPT_COOKIE, rawurlencode(session_name()) . '=' . rawurlencode($sid));
// Force our way into the session of the child site.
drupal_save_session(TRUE);
_drupal_session_write($sid, '');
drupal_save_session(FALSE);
}