Changeset 1902

Show
Ignore:
Timestamp:
02/02/2008 06:15:49 PM (11 months ago)
Author:
Shadowhand
Message:

Reworking how sessions are closed to be more flexible.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/system/libraries/Session.php

    r1891 r1902  
    8181 
    8282                        // Close the session just before sending the headers, so that 
    83                         // the session cookie can be written 
    84                         Event::add('system.send_headers', 'session_write_close'); 
     83                        // the session cookie(s) can be written. 
     84                        Event::add('system.send_headers', array($this, 'write_close')); 
    8585 
    8686                        // Singleton instance 
     
    276276 
    277277        /** 
     278         * Runs the system.session_write event, then calls session_write_close. 
     279         * 
     280         * @return void 
     281         */ 
     282        public function write_close() 
     283        { 
     284                static $run; 
     285 
     286                if ($run === NULL) 
     287                { 
     288                        $run = TRUE; 
     289 
     290                        // Run the events that depend on the session being open 
     291                        Event::run('system.session_write'); 
     292 
     293                        // Close the session 
     294                        session_write_close(); 
     295                } 
     296        } 
     297 
     298        /** 
    278299         * Method: set 
    279300         *  Set a session variable.