users/BitUser is supposed to delete sessions from users_cnxn however the following around line 958 appears to be wrong:
I believe this:
$oldy = $update['last_get'] - ($gBitSystem->getConfig( 'users_cnxn_history_days', 30 ) * 24 * 60);
should read:
$oldy = $update['last_get'] - ($gBitSystem->getConfig( 'users_cnxn_history_days', 30 ) * 24 * 60 * 60);
otherwise sessions < 12 hours old would be deleted.
and this:
$query = "DELETE from `".BIT_DB_PREFIX."users_cnxn` where `connect_time`<?";
should read:
$query = "DELETE from `".BIT_DB_PREFIX."users_cnxn` where `last_get`<?";
as connect_time never seems to be populated!
I also believe this:
// Delete old connections nightly during the hour of 3 am
if( date( 'H' ) == '03' && date( 'i' ) > 0 && date( 'i' ) < 2 ) {
is too restrictive. I think this is saying that sessions will only be aged out if someone happens to be using the site between 3:00 and 3:01 AM ?
Yep - this is a little screwy.
`connect_time` is not used as far as I can see, and I think that it could probably be dropped, except that it would be nice to be logging user access.
I've made a couple of these changes locally here, but these are the right answer.
Since this table is used to display active users, should it not be cleared down a little more frequently?
This is an area I am plying with myself, since the 'located' login for my client management systems needs to know exactly who is logged in where, and requires users to log out, but this also needs a 'backup' log off. Which may require a scheduled update?