RE: [PHP4BETA] session_set_save_handler
| From: | Peter Kocks | Date: | Wed, 01 Mar 2000 02:04:09 +0000 |
| Subject: | RE: [PHP4BETA] session_set_save_handler | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-11228@lists.php.net to get a copy of this message | ||
I use register_shutdown() all the time. What I am looking for is the
equivalent for sessions. When a session is destroyed (either forcefully or
by exceeding a timeout) I want to run some cleanup stuff on the session.
E.g. go to the database delete this delete that, remove some temporary files
etc. In fact, I would probably be fine with just re-writing the
session_set_save_handler(...,..,.,.., "destroy") function, but only the
destroy function. The other stuff all works fine.
register_session_shutdown()????
--pk
> -----Original Message-----
> From: pour@mieterra.com [mailto:pour@mieterra.com]
> Sent: Tuesday, February 29, 2000 5:58 PM
> To: peter.kocks@baygate.com
> Cc: php4beta@lists.php.net
> Subject: Re: [PHP4BETA] session_set_save_handler
>
>
> Hi,
>
> Use 'register_shutdown_function("my_func")'. This function will be
> called at each shutdown. Thus you need to keep track if this function
> has been called before. Two functions which might help you is
> connection_aborted(), which returns true if the function was called b/c
> of a user abort, and connection_timeout(), which tells you if the timer
> was exceeded.
>
> Ciao,
>
> Andreas
>
>
> Peter Kocks wrote:
> >
> > Hi,
> >
> > I'd like to register a function to be called whenever a session
> is destroyed
> > or when the max lifetime is exceeded. Basically, there is some
> cleanup I'd
> > like to do that is not directly related to the session functions. I see
> > there is a function:
> >
> > session_set_save_handler ("open", "close", "read",
> > "write", "destroy",
> > "gc");
> >
> > But, what I really want is some type of callback within the
> regular destroy
> > function so that I can do some cleanup. Is there anyway to do this? A
> > register_shutdown() for sessions?
> >
> > Thanks
> >
> > --pk
> >
> > --
> > PHP 4.0 Beta Mailing List
> > <http://www.php.net/version4/>
> > To unsubscribe, e-mail: php4beta-unsubscribe@lists.php.net
> > For additional commands, e-mail: php4beta-help@lists.php.net
> > To contact the list administrators, e-mail: php4beta-admin@lists.php.net
>