function drupal_save_session

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.

17 calls to drupal_save_session()
ArgumentDefaultTest::test_plugin_argument_default_current_user in drupal/core/modules/views/lib/Drupal/views/Tests/User/ArgumentDefaultTest.php
DrupalDateTimeTest::testDateTimezone in drupal/core/modules/system/lib/Drupal/system/Tests/Datetime/DrupalDateTimeTest.php
Test that DrupalDateTime can detect the right timezone to use. Test with a variety of less commonly used timezone names to help ensure that the system timezone will be different than the stated timezones.
drupal_cron_run in drupal/core/includes/common.inc
Executes a cron run when called.
drupal_session_commit in drupal/core/includes/session.inc
Commits the current session, if necessary.
drupal_session_destroy_uid in drupal/core/includes/session.inc
Ends a specific user's session(s).

... See full list

File

drupal/core/includes/session.inc, line 521
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;
}