You are here

function drupal_session_initialize in Session Proxy 7

Initializes the session handler.

File

./session.inc, line 34
User session proxy to an advanced component-based interface.

Code

function drupal_session_initialize() {
  if (!variable_get('session_storage_force_default', FALSE)) {
    $class = variable_get('session_storage_class', 'SessionProxy_Storage_Database');
    $backend = new SessionProxy_Backend_Default(new $class(variable_get('session_storage_options', array())));
  }
  else {
    $class = variable_get('session_backend_class', 'SessionProxy_Backend_Native');
    $backend = new $class();
  }
  SessionProxy_Helper::getInstance()
    ->setBackend($backend);

  // As of PHP 5.0.5 the write and close handlers are called after object
  // destruction and therefore cannot use objects or throw exceptions. The
  // object destructors can however use sessions.
  // See http://www.php.net/manual/en/function.session-set-save-handler.php
  drupal_register_shutdown_function('drupal_session_commit');
}