Jump to content

Session information in the DB


bmacnaughton
 Share

Recommended Posts

I'm looking at the session information in the database. The "ts" column shows my local time formatted as text.

The code in the wire/core/sessions.php file shows a check against the normal PHP/Unix "time()" function, which is GMT/UTC time.

Shouldn't the timestamp in the DB be GMT/UTC?

And pardon the next question; I'm still trying to grasp the structure of PW.

How/where does Session.php fetch the 'ts' column from the database? I was trying to track down the answer to my own questions but couldn't find where the 'ts' column gets used.

Context - I'm writing a lazy cron job to delete files if the session they are associated with has expired. It seems like the sessions in the DB need to be cleaned up as well - if I explicitly logout the session is deleted. But there are leftover sessions from months ago in the DB, so it looks like old sessions that just don't come back don't get deleted because the expiration logic doesn't delete the session record when it determines the session timed out.

Link to comment
Share on other sites

OK, my issue. The DB does have UTC time; I hadn't realized it was configured with SYSTEM time, so it's doing a conversion on output.

I just need to configure MySQL appropriately. It would be nicer/easier to use if the timestamp was a Unix time value rather than a timestamp.

  • Like 3
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...