Function __global->delete_expired_sessions_or_recover

Definitions

sources/users.php

  • Find what sessions are expired and delete them, and recover an existing one for $member_id if there is one.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: array

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$member_id ?MEMBER No No Null N/A N/A User to get a current session for (null: do not try, which guarantees a return result of null also)
$force_cleanup boolean No No False N/A N/A Force cleanup of expired sessions (otherwise happens randomly, to reduce load)

Returns

  • A tuple: The session ID we rebound to (null means did not rebind), The number of member sessions, The number of Guest sessions
  • Type: array
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Find what sessions are expired and delete them, and recover an existing one for $member_id if there is one.
 *
 * @param  ?MEMBER $member_id User to get a current session for (null: do not try, which guarantees a return result of null also)
 * @param  boolean $force_cleanup Force cleanup of expired sessions (otherwise happens randomly, to reduce load)
 * @return array A tuple: The session ID we rebound to (null means did not rebind), The number of member sessions, The number of Guest sessions
 */

function delete_expired_sessions_or_recover(?int $member_id = null, bool $force_cleanup = false) : array