Updates the given sessionId so its last request time is equal to the present date and time.

@param string   $sessionId the session identifier key.
@param int|null $lastUsed  the last request timestamp
555476
public function refreshLastUsed($sessionId, $lastUsed = null)
    {
        if ($sessionInformation = $this->getSessionInformation($sessionId)) {
            if ($sessionInformation->getLastUsed() !== $lastUsed) {
                $sessionInformation->refreshLastUsed($lastUsed);
                $this->saveSessionInformation($sessionInformation);
            }
        }
    }
1075917
public static function update_recent_session_locks($sessionlock) {
        global $CFG, $SESSION;

        if (empty($CFG->debugsessionlock)) {
            return;
        }

        $SESSION->recentsessionlocks = self::get_recent_session_locks();
        array_push($SESSION->recentsessionlocks, $sessionlock);

        self::cleanup_recent_session_locks();
    }
330571
protected function setSessionId($sessionId) {
    $session = ObjectFactory::getInstance('session');
    $sids = $session->get(self::SIDS_SESSION_VARNAME);
    $sids[$this->serverCli] = $sessionId;
    $session->set(self::SIDS_SESSION_VARNAME, $sids);
  }
450156
public function startSession($sessionId = NULl){
        if($sessionId != NULL){ 
            session_id($sessionId);
        }
        session_start();
        $this->checkIdentity();
    }
655890
public function session_write($sessionId, $sessionData)
    {
        $sessionData       = (!$sessionData || !is_array($sessionData)) ? [] : $sessionData;
        $this->sessionData = (!$this->sessionData) ? [] : $this->sessionData;

        $this->sessionData = array_merge($sessionData, $this->sessionData);
        $this->engine->set($this->sessionKey . $sessionId, $this->sessionData, $this->sessionLifeTime);

        return true;
    }
829082
public function getSessionBySessionId($sessionId)
    {
        if (!is_scalar($sessionId)) {
            return false;
        }

        return isset($this->sessions[$sessionId]) ? $this->sessions[$sessionId] : false;
    }
758461
public void update(Date lastScheduledExecutionTime, Date lastActualExecutionTime, Date lastCompletionTime) {
        this.lastScheduledExecutionTime = lastScheduledExecutionTime;
        this.lastActualExecutionTime = lastActualExecutionTime;
        this.lastCompletionTime = lastCompletionTime;
    }
589234
public function destroy($sessionId): bool
    {
        $sql = 'DELETE FROM sessions WHERE id = :id';
        $params = ['id' => $sessionId];
        $this->db->delete($sql, $params);

        return true;
    }
141164
public void onCandidate(long sessionId, int index, String id, String sdp) {
        send(new RTCCandidate(deviceId, sessionId, index, id, sdp));
    }
801833
public function write($sessionId, $value)
    {
        if (Config::get('session_user_loc') == 'db') {
            $this->handler->set(Config::get('session_user_loc_table'), [
                'id' => $sessionId,
                'value' => $value,
                'ctime' => Cml::$nowTime
            ], Config::get('session_user_loc_tableprefix'));
        } else {
            $this->handler->set(Config::get('session_user_loc_tableprefix') . Config::get('session_user_loc_table') . '-id-' . $sessionId, $value, $this->lifeTime);
        }
        return true;
    }
458486
public function updateSession($sessionId, $update)
  {
    return $this->put->path('/sessions/')->subpath($sessionId)->body($update);
  }
1141343
public function retrieve($sessionId)
    {
        try {

            $stream = $this->getRetrievalStream($sessionId);
            $stream->open();
            $access = $this->createBinaryStreamAccess($stream);

            // -- Deal with intrinsic values of the Test Session.
            $assessmentTestSessionState = $access->readTinyInt();
            $currentPosition = $access->readTinyInt();

            if ($access->readBoolean() === true) {
                $timeReference = $access->readDateTime();
            } else {
                $timeReference = null;
            }
            
            $visitedTestPartIdentifiers = array();
            $visitedTestPartIdentifiersCount = $access->readTinyInt();
            for ($i = 0; $i < $visitedTestPartIdentifiersCount; $i++) {
                $visitedTestPartIdentifiers[] = $access->readString();
            }
            
            $path = $access->readPath();
            
            // -- Session configuration.
            $config = $access->readShort();

            // Build the route and the item sessions.
            $route = new Route();
            $lastOccurenceUpdate = new SplObjectStorage();
            $itemSessionStore = new AssessmentItemSessionStore();
            $pendingResponseStore = new PendingResponseStore();
            $routeCount = $access->readTinyInt();

            // Create the item session factory that will be used to instantiate
            // new item sessions.
            
            $seeker = $this->getSeeker();

            for ($i = 0; $i < $routeCount; $i++) {
                $routeItem = $access->readRouteItem($seeker);
                $route->addRouteItemObject($routeItem);
                
                // An already instantiated session for this route item?
                if ($access->readBoolean() === true) {
                    $itemSession = $access->readAssessmentItemSession($this->getManager(), $seeker);
                    
                    // last-update
                    if ($access->readBoolean() === true) {
                        $lastOccurenceUpdate[$routeItem->getAssessmentItemRef()] = $routeItem->getOccurence();
                    }
                    
                    // pending-responses
                    if ($access->readBoolean() === true) {
                        $pendingResponseStore->addPendingResponses($access->readPendingResponses($seeker));
                    }

                    $itemSessionStore->addAssessmentItemSession($itemSession, $routeItem->getOccurence());
                }
            }

            $route->setPosition($currentPosition);
            $manager = $this->getManager();
            $assessmentTestSession = $manager->createAssessmentTestSession($this->getAssessmentTest(), $route, $config);
            $assessmentTestSession->setAssessmentItemSessionStore($itemSessionStore);
            $assessmentTestSession->setSessionId($sessionId);
            $assessmentTestSession->setState($assessmentTestSessionState);
            $assessmentTestSession->setLastOccurenceUpdate($lastOccurenceUpdate);
            $assessmentTestSession->setPendingResponseStore($pendingResponseStore);
            $assessmentTestSession->setTimeReference($timeReference);
            $assessmentTestSession->setVisitedTestPartIdentifiers($visitedTestPartIdentifiers);
            $assessmentTestSession->setPath($path);

            // Build the test-level global scope, composed of Outcome Variables.
            foreach ($this->getAssessmentTest()->getOutcomeDeclarations() as $outcomeDeclaration) {
                $outcomeVariable = OutcomeVariable::createFromDataModel($outcomeDeclaration);
                $access->readVariableValue($outcomeVariable);
                $assessmentTestSession->setVariable($outcomeVariable);
            }

            // Build the duration store.
            $durationStore = new DurationStore();
            $durationCount = $access->readShort();
            for ($i = 0; $i < $durationCount; $i++) {
                $varName = $access->readString();
                $durationVariable = new OutcomeVariable($varName, Cardinality::SINGLE, BaseType::DURATION);
                $access->readVariableValue($durationVariable);
                $durationStore->setVariable($durationVariable);
            }

            $assessmentTestSession->setDurationStore($durationStore);

            $stream->close();

            return $assessmentTestSession;
        } catch (Exception $e) {
            $msg = "An error occured while retrieving AssessmentTestSession. " . $e->getMessage();
            throw new StorageException($msg, StorageException::RETRIEVAL, $e);
        }
    }
37661
public function setCurrent($userid)
	{
		$this->debug->groupCollapsed(__METHOD__, $userid);
		Session::start();
		$user = $this->get($userid);
		// initialize session array
		ArrayUtil::path($_SESSION, $this->cfg['sessionPath'], array());
		// create link to session array
		// $this->user = &ArrayUtil::path($_SESSION, $this->cfg['sessionPath']);
        $path = $this->cfg['sessionPath'];
        if (!\is_array($path)) {
            $path = \array_filter(\preg_split('#[\./]#', $path), 'strlen');
        }
        $this->user =& $_SESSION;
        foreach ($path as $k) {
        	if (!isset($this->user[$k])) {
        		$this->user[$k] = array();
        	}
        	$this->user =& $this->user[$k];
        }
		// load session array
		$this->user = $user;
		$this->user['_ts_cur'] = time();
		$this->userid = $this->user['userid'];
		$this->update(array('lastactivity'=>'NOW()'));
		$this->debug->groupEnd();
		return;
	}
1196297
public function destroy($sessionID)
    {
        $fileName = $this->getFileName($sessionID);
        if(is_file($fileName))
        {
            unlink($fileName);
        }
    }
168553
public function read($sessionId)
    {
        $sessionId = $this->keyPrefix . $sessionId;
        $sessionData = $this->redis->get($sessionId);

        $this->redis->expire($sessionId, $this->maxLifetime);

        return $sessionData;
    }
394845
protected function setLastLogin($userId)
    {
        $user = $this->userService->findById($userId);

        $result = $this->userService->update($user, [
            'last_login' => time()
        ]);
    }
195264
protected static function add_session_record($userid) {
        global $DB;
        $record = new \stdClass();
        $record->state       = 0;
        $record->sid         = session_id();
        $record->sessdata    = null;
        $record->userid      = $userid;
        $record->timecreated = $record->timemodified = time();
        $record->firstip     = $record->lastip = getremoteaddr();

        $record->id = $DB->insert_record('sessions', $record);

        return $record;
    }