1 session.inc _backdrop_session_regenerate_existing()

Regenerates an existing session.

File

core/includes/session.inc, line 429
User session handling functions.

Code

function _backdrop_session_regenerate_existing() {
  global $user;
  // Preserve existing settings for the saving of sessions.
  $original_save_session_status = backdrop_save_session();
  // Turn off saving of sessions.
  backdrop_save_session(FALSE);
  session_write_close();
  backdrop_session_started(FALSE);
  // Preserve the user object, as starting a new session will reset it.
  $original_user = $user;
  session_id(backdrop_random_key());
  backdrop_session_start();
  $user = $original_user;
  // Restore the original settings for the saving of sessions.
  backdrop_save_session($original_save_session_status);
}