Regenerate the user's session

@param bool $bDestroy Whether to destroy the old session
325939
public function regenerate($bDestroy = false)
    {
        if (empty($this->oSession)) {
            return $this;
        }

        $this->oSession->sess_regenerate($bDestroy);
        return $this;
    }
1065794
public function regenerate($flush = false)
    {
        // regenerate and fetch status
        $status = session_regenerate_id($flush);

        // store fresh created session-id
        $this->setId(session_id());

        // check for lifetime
        if ($flush) {
            // if we flush - we flush cookie too! so set date/time in past
            $lifetime = (time() - $this->getLifetime());
        } else {
            // we use the current defined lifetime
            $lifetime = $this->getLifetime();
        }

        /*
        // reset session cookie
        $status &= $this->setSessionCookie(
            $this->getIdentifier(),
            $this->getId(),
            $lifetime,
            $this->retrievePathToCurrentClass(),
            $this->getDomain(),
            $this->getSsl(),
            $this->getHttpOnly()
        );
        */

        // return status
        return $status;
    }
224594
public function restoreSession() {
	    $sessId = $this->getRequestParameter('session');
	    $url = $this->getRequestParameter('redirect');
	    if (session_id() != $sessId) {  
            common_Logger::i('Changing session to '.$sessId);
            session_unset();
            session_destroy();
            
            session_id($sessId);
            session_start();
            if (session_id() != $sessId) {
               $this->returnError(__('Unable to restore Session'));
            }
            session_regenerate_id(true);
            common_Logger::d('regenerated session to id \''.session_id().'\'');
	    } else {
	        common_Logger::w('Restore session called with correct session id \''.session_id().'\'');
	    }
	    $this->forwardUrl($url);
	}
1183078
public function regenerateId($deleteOldSession = false)
    {
        if (headers_sent() || !$this->id) {
            return false;
        }
        $oldId = $this->id;
        $this->id = IdGenerator::generateSessionId($this->idLength);
        $this->setCookie($this->name, $this->id);
        if ($oldId && $deleteOldSession) {
            $this->handler->destroy($oldId);
        }
        return true;
    }
1204918
public static function regenerateId(bool $deleteOldSessionId = true)
    {
        Base::checkOpen();
        if (Base::driver() == 'file') {
            session_regenerate_id($deleteOldSessionId);
            return true;
        }
        if ($deleteOldSessionId) {
            self::removeAll();
        }
        $random = new \Phalcon\Security\Random();
        session_write_close();
        session_id(str_replace('-', '', $random->uuid()));
        session_start();
        return true;
    }
697220
public function delete($deleteReference = false)
    {
        $returnValue = (bool) false;
        $returnValue = $this->getImplementation()->delete($this, $deleteReference);
        return (bool) $returnValue;
    }
1258920
public function destroy($regenerate = false)
    {
        $this->instance->unlock();
        $result = $this->instance->destroy();
        if ($regenerate == true) {
            session_regenerate_id(true);
        }
        return $result;
    }
104089
public static function regenerateId($delOldSession = false)
    {
        $success = false;
        if (self::$status['regenerated']) {
            // already regenerated... no sense in doing it again
            return false;
        }
        if (empty(self::$status['requestId'])) {
            // no session id was passed... there's no need to regenerate!
            return false;
        }
        if (\session_status() === PHP_SESSION_NONE) {
            // there's currently not a session
            self::$cfgStatic['regenOnStart'] = true;
        }
        if (\session_status() === PHP_SESSION_ACTIVE) {
            $success = \session_regenerate_id($delOldSession);
            self::$cfgStatic['regenOnStart'] = false;
            self::$status['regenerated'] = true;
        }
        if ($success) {
            \bdk\Debug::_info('new session_id', \session_id());
        }
        return $success;
    }
957185
public function delete()
    {
        $this->_user = false;

        $this->_session->delete($this->_config['key']);
        $this->_session->renew();
    }
423286
public function refresh(bool $force = false, bool $cascade = false) : bool
    {
        $this->relinkDB();
        return $this->load();
    }
650038
public function regenerate()
    {
        $this->init();

        # Generate a new session
        session_start();
        session_regenerate_id();

        # Get the newly generated ID
        $this->id = session_id();

        # Remove the lock from the session file
        session_write_close();

        return $this->id;
    }
1015999
public function restart()
	{
		$this->destroy();

		if ($this->_state !==  self::STATE_DESTROYED) {
			throw new LibSessionsException("Session is not destroyed!\n");
		}

		$this->_storage->register();

		$this->_state = self::STATE_RESTART;

		$id	= $this->_createToken(strlen($this->getId()));

		session_id($id);

		$this->_start();

		$this->_state = self::STATE_ACTIVE;

		$this->_setCounter();

		return true;
	}
657540
public function login($force=false) {
		if( !$force && static::isLogged() ) {
			static::throwException('alreadyLoggedin');
		}
		/**
		 * @var AbstractUser $USER
		 * @deprecated
		 */
		global $USER;
		$_SESSION['USER'] = $USER = $this;
		$this->login = $force ? self::LOGGED_FORCED : self::IS_LOGGED;
		if( !$force ) {
			static::logEvent('login');
		}
		static::logEvent('activity');
	}
1010994
public function regenerate() {
		$operations = Configure::read('FileStorage.imageSizes.' . $this->args[0]);
		$options = [
			'overwrite' => !$this->params['keep-old-versions']
		];

		if (empty($operations)) {
			$this->abort(__d('file_storage', 'Invalid table or version.'));
		}

		foreach ($operations as $version => $operation) {
			try {
				$this->_loop($this->command, $this->args[0], [$version => $operation], $options);
			} catch (Exception $e) {
				$this->abort($e->getMessage());
			}
		}
	}
350855
public function start()
    {
        if ($this->isStarted()) {
            return true;
        }

        /*
         * Write and Close handlers are called after destructing objects since PHP 5.0.5.
         * Thus destructors can use sessions but session handler can't use objects.
         * So we are moving session closure before destructing objects.
         */
        session_register_shutdown();

        session_cache_limiter('none');

        if (!session_start()) {
            throw new \RuntimeException('Failed to start the session');
        }

        static::$started = true;

        return true;
    }
537513
public function destroy($sessionId)
    {
        if (Config::get('session_user_loc') == 'db') {
            $this->handler->delete(Config::get('session_user_loc_table') . '-id-' . $sessionId, true, Config::get('session_user_loc_tableprefix'));
        } else {
            $this->handler->delete(Config::get('session_user_loc_tableprefix') . Config::get('session_user_loc_table') . '-id-' . $sessionId);
        }
        return true;
    }
410274
public function restart()
	{
		$this->destroy();

		if ($this->state !== 'destroyed')
		{
			// @TODO :: generated error here
			return false;
		}

		// Re-register the session handler after a session has been destroyed, to avoid PHP bug
		$this->store->register();

		$this->state = 'restart';

		// Regenerate session id
		$id = $this->createId();

		session_id($id);

		$this->start();
		$this->state = 'active';

		$this->validate();
		$this->setCounter();

		return true;
	}