Log in with username/password: lyceum/lyceum

Changeset 1273

Show
Ignore:
Timestamp:
11/24/07 16:35:01 (11 months ago)
Author:
jjb
Message:

#885, #729

  • Sessions last for 10 years, and sessions are not "garbage collected" for 10 years.
  • The user may specify a custom path for session data to be stored
  • The user may turn on the experimental DB session storage system

There is a jumble of mediocre documentation about the various dimensions in php sessions-- the consensus seems to be that session data might be "garbage collected" before the session data expires. I cannot imagine what "garbage collection" could possibly mean in this case-- in call other cases in computer science it means data that the program is absolutely certain is not being used by some part of the system. Here it seems to be a simplistic notion of time-based expiration.

Theses were helpful:
http://www.captain.at/howto-php-sessions.php
http://www.php.net/manual/en/ref.session.php#68537

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.0/src/config/wp-config-sample.php

    r1272 r1273  
    2222define('MAINDOMAIN', 'blogs.example.com'); 
    2323define('DEFAULTBLOG', false); 
     24 
     25// Sessions 
     26// 
     27// It is highly recommended that you set your own session path, so that other php applications 
     28// on your server (including possibly those from other users on shared hosting) do not prematurely 
     29// clear your session data. You must ensure that this directory exists and is writable  
     30// by the webserver. Here are two recommended paths for *nix and Windows:  
     31//   define('SESSIONPATH', '/tmp/blogs.example.com');   // *nix 
     32//   define('SESSIONPATH', '\\TEMP\blogs.example.com'); // Windows 
     33// 
     34// Database sessions will be fully supported in Lyceum 1.1 and are currently experimental 
     35//   define('DBSESSIONS', true); 
    2436 
    2537//you probably want to leave these as they are 
  • branches/1.0/src/lib/session.php

    r430 r1273  
    11<?php 
    22 
    3 /*session_set_save_handler('_open', 
    4                          '_close', 
    5                          '_read', 
    6                          '_write', 
    7                          '_destroy', 
    8                          '_clean');*/ 
     3if (defined('DBSESSIONS')) 
     4   session_set_save_handler( '_open', 
     5                             '_close', 
     6                             '_read', 
     7                             '_write', 
     8                             '_destroy', 
     9                             '_clean' ); 
    910 
    1011function _open() 
  • branches/1.0/src/lyceum/wp-settings.php

    r1271 r1273  
    262262register_shutdown_function('shutdown_action_hook'); 
    263263 
    264 session_set_cookie_params ( 1209600, '/', '.'.MAINDOMAIN ); // Two weeks 
     264if (defined('SESSIONPATH')) 
     265   ini_set('session.save_path', SESSIONPATH); 
     266 
     267$timeout = 315569260;  // 315569260 seconds = 10 years 
     268ini_set('session.gc_maxlifetime', $timeout); 
     269session_set_cookie_params( $timeout, '/', '.'.MAINDOMAIN ); 
    265270session_start(); 
    266271 
Log in with username/password: lyceum/lyceum