public function regenerate($destroy = false, $lifetime = null)
    {
        $oldSessionId = $this->getId();
        $success = $this->innerSessionStorage->regenerate($destroy, $lifetime);
        $newSessionId = $this->getId();

        // Callbacks cannot be called once the session is destroyed.
        if ($success && !$destroy) {
            $kernelClosure = $this->legacyKernelClosure;
            $kernelClosure()->runCallback(
                static function () use ($oldSessionId, $newSessionId) {
                    ezpEvent::getInstance()->notify('session/regenerate', [$oldSessionId, $newSessionId]);
                    $db = eZDB::instance();
                    $escOldKey = $db->escapeString($oldSessionId);
                    $escNewKey = $db->escapeString($newSessionId);
                    $escUserID = $db->escapeString(eZSession::userID());
                    eZSession::triggerCallback('regenerate_pre', [$db, $escNewKey, $escOldKey, $escUserID]);
                    eZSession::triggerCallback('regenerate_post', [$db, $escNewKey, $escOldKey, $escUserID]);
                },
                false,
                false
            );
        }

        return $success;
    }
public function regenerate($destroy = false, $lifetime = null)
    {
        $oldSessionId = $this->getId();
        $success = $this->innerSessionStorage->regenerate($destroy, $lifetime);
        $newSessionId = $this->getId();

        // Callbacks cannot be called once the session is destroyed.
        if ($success && !$destroy) {
            $kernelClosure = $this->legacyKernelClosure;
            $kernelClosure()->runCallback(
                static function () use ($oldSessionId, $newSessionId) {
                    ezpEvent::getInstance()->notify('session/regenerate', [$oldSessionId, $newSessionId]);
                    $db = eZDB::instance();
                    $escOldKey = $db->escapeString($oldSessionId);
                    $escNewKey = $db->escapeString($newSessionId);
                    $escUserID = $db->escapeString(eZSession::userID());
                    eZSession::triggerCallback('regenerate_pre', [$db, $escNewKey, $escOldKey, $escUserID]);
                    eZSession::triggerCallback('regenerate_post', [$db, $escNewKey, $escOldKey, $escUserID]);
                },
                false,
                false
            );
        }

        return $success;
    }
public function regenerate ( $ destroy = false , $ lifetime = null ) { $ oldSessionId = $ this -> getId ( ) ; $ success = $ this -> innerSessionStorage -> regenerate ( $ destroy , $ lifetime ) ; $ newSessionId = $ this -> getId ( ) ; // Callbacks cannot be called once the session is destroyed. if ( $ success && ! $ destroy ) { $ kernelClosure = $ this -> legacyKernelClosure ; $ kernelClosure ( ) -> runCallback ( static function ( ) use ( $ oldSessionId , $ newSessionId ) { ezpEvent :: getInstance ( ) -> notify ( 'session/regenerate' , [ $ oldSessionId , $ newSessionId ] ) ; $ db = eZDB :: instance ( ) ; $ escOldKey = $ db -> escapeString ( $ oldSessionId ) ; $ escNewKey = $ db -> escapeString ( $ newSessionId ) ; $ escUserID = $ db -> escapeString ( eZSession :: userID ( ) ) ; eZSession :: triggerCallback ( 'regenerate_pre' , [ $ db , $ escNewKey , $ escOldKey , $ escUserID ] ) ; eZSession :: triggerCallback ( 'regenerate_post' , [ $ db , $ escNewKey , $ escOldKey , $ escUserID ] ) ; } , false , false ) ; } return $ success ; }
Ensures appropriate legacy events are sent when migrating the session.

{@inheritdoc}
Ensures appropriate legacy events are sent when migrating the session .