You are here

public function DeployRemoteCcAuthenticatorSession::logOut in Deploy - Content Staging 7.3

Logout of the target environment.

Parameters

object $response: The response object from the initial login request.

string $token: The token that created during login.

1 call to DeployRemoteCcAuthenticatorSession::logOut()
DeployRemoteCcAuthenticatorSession::deploy in modules/deploy_remote_cc/plugins/DeployRemoteCcAuthenticatorSession.inc
Initiates an authenticated deployment.

File

modules/deploy_remote_cc/plugins/DeployRemoteCcAuthenticatorSession.inc, line 185

Class

DeployRemoteCcAuthenticatorSession
Authenticator for Cache clear service.

Code

public function logOut($response, $token) {
  $logout_url = $this->service->config['url'] . '/user/logout';

  // We only need to log out if we logged in and got a session cookie.
  if (!empty($this->service->config['headers']['Cookie'])) {

    // Log out, since we are done now.
    $options = array(
      'method' => 'POST',
      'headers' => array(
        'Cookie' => $response->headers['set-cookie'],
        'X-CSRF-Token' => $token,
      ),
      'context' => $this->context,
    );
    $response = drupal_http_request($logout_url, $options);
    if ($this->config['debug']) {
      watchdog('deploy', 'Logout response: <pre>@response</pre>', array(
        '@response' => print_r($response, TRUE),
      ), WATCHDOG_DEBUG);
    }
  }
}