/** * Event listener for the `onAfterSessionStart` event. * * @param JSession $session Session object * * @return void * * @since 3.2 */ public function afterSessionStart(JSession $session) { parent::afterSessionStart($session); // If not using the database store, register the cleanup function to run at the end of the application cycle if ($session->storeName != 'database') { $this->registerEvent('onAfterRender', array($this, 'cleanupSessionMetadata')); } /* * Check for extra session metadata when: * * 1) The database handler is in use and the session is new * 2) The database handler is not in use and the time is an even numbered second or the session is new */ if ($session->storeName != 'database' && (time() % 2 || $session->isNew()) || $session->storeName == 'database' && $session->isNew()) { $this->checkSession($session); } }