You are here

function drupal_save_session in Memcache Storage 7

Determines whether to save session data of the current request.

This function allows the caller to temporarily disable writing of session data, should the request end while performing potentially dangerous operations, such as manipulating the global $user object. See http://drupal.org/node/218104 for usage.

Parameters

$status: Disables writing of session data when FALSE, (re-)enables writing when TRUE.

Return value

FALSE if writing session data has been disabled. Otherwise, TRUE.

5 calls to drupal_save_session()
drupal_session_commit in includes/session.inc
Commits the current session, if necessary.
drupal_session_destroy_uid in includes/session.inc
Ends a specific user's session(s).
drupal_session_regenerate in includes/session.inc
Called when an anonymous user becomes authenticated or vice-versa.
_drupal_session_destroy in includes/session.inc
Session handler assigned by session_set_save_handler().
_drupal_session_write in includes/session.inc
Writes an entire session to the memcached.

File

includes/session.inc, line 533
User session handling functions.

Code

function drupal_save_session($status = NULL) {

  // PHP session ID, session, and cookie handling happens in the global scope.
  // This value has to persist across calls to drupal_static_reset(), since a
  // potentially wrong or disallowed session would be written otherwise.
  static $save_session = TRUE;
  if (isset($status)) {
    $save_session = $status;
  }
  return $save_session;
}