Reset recent session locks array if there is a 10 seconds time gap.

@return array Recent session locks array.
555185
public static function cleanup_recent_session_locks() {
        global $SESSION;

        $locks = self::get_recent_session_locks();
        if (count($locks) > 2) {
            for ($i = count($locks) - 1; $i > 0; $i--) {
                // Calculate the gap between session locks.
                $gap = $locks[$i]['released'] - $locks[$i - 1]['start'];
                if ($gap >= 10) {
                    // Remove previous locks if the gap is 10 seconds or more.
                    $SESSION->recentsessionlocks = array_slice($locks, $i);
                    break;
                }
            }
        }
    }
1318953
public function lock()
    {
        $user = UserHelper::getUser($this->getUserResource());

        if ($this->getUserLocksService()->lockUser($user)) {
            $this->returnJson(['success' => true, 'message' => __('User %s successfully locked', UserHelper::getUserLogin(UserHelper::getUser($user)))]);
        } else {
            $this->returnJson(['success' => false, 'message' => __('User %s can not be locked', UserHelper::getUserLogin(UserHelper::getUser($user)))]);
        }
    }
1359092
public function getActiveSessions()
    {
        $activeSessions = [];
        foreach ($this->metaDataCache->getByTag('session') as $sessionIdentifier => $sessionInfo) {
            $session = new Session($sessionIdentifier, $sessionInfo['storageIdentifier'], $sessionInfo['lastActivityTimestamp'], $sessionInfo['tags']);
            $activeSessions[] = $session;
        }
        return $activeSessions;
    }
118722
private function sessions() : array
    {
        if (!empty($sessions)) return $sessions;

        $returnSessions = [];

        $sessions = $this->get(sprintf(Session::SESSION_ENDPOINT, $this->onlineIdParameter), [
            'fields' => '@default,npTitleDetail,npTitleDetail.platform,sessionName,sessionCreateTimestamp,availablePlatforms,members,memberCount,sessionMaxUser',
            'titleIconSize' => 's',
            'npLanguage' => 'en'
        ]);

        if ($sessions->size === 0) return null;

        // Multiple sessions could be used if the user is in a party while playing a game.
        foreach ($sessions->sessions as $session) {
            $returnSessions[] = new Session($this->client, $session);
        }

        $sessions = $returnSessions;

        return $returnSessions;
    }
797166
protected function setTimers()
	{
		if (!$this->has('session.timer.start'))
		{
			$start = time();

			$this->set('session.timer.start', $start);
			$this->set('session.timer.last', $start);
			$this->set('session.timer.now', $start);
		}

		$this->set('session.timer.last', $this->get('session.timer.now'));
		$this->set('session.timer.now', time());

		return true;
	}
112706
public function reset()
    {
        $this->_data     = array();
        $this->_modified = array();

        if ($this->isConnected()) {
            $this->_data = $this->getTable()->getDefaults();
        }

        return $this;
    }
196309
public function reset()
    {
        $this->messages = [];

        foreach (self::$when as $when) {
            $this->messages[$when] = [];
        }

        return $this;
    }
453413
protected function autoExpire()
    {
        $lastActivitySecondsAgo = $this->now - $this->lastActivityTimestamp;
        $expired = false;
        if ($this->inactivityTimeout !== 0 && $lastActivitySecondsAgo > $this->inactivityTimeout) {
            $this->started = true;
            $this->sessionIdentifier = $this->sessionCookie->getValue();
            $this->destroy(sprintf('Session %s was inactive for %s seconds, more than the configured timeout of %s seconds.', $this->sessionIdentifier, $lastActivitySecondsAgo, $this->inactivityTimeout));
            $expired = true;
        }
        return $expired;
    }
898502
public function reset()
    {
        $this->close();
        $this->_cookies = array();
        $this->_headers = array();
        $this->error = false;
        $this->error_code = 0;
        $this->error_message = null;
        $this->curl_error = false;
        $this->curl_error_code = 0;
        $this->curl_error_message = null;
        $this->http_error = false;
        $this->http_status_code = 0;
        $this->http_error_message = null;
        $this->request_headers = null;
        $this->response_headers = array();
        $this->response = false;
        $this->init();
        return $this;
    }
171906
public static function reset() {
        $factory = self::instance();
        $factory->reset_cache_instances();
        $factory->configs = array();
        $factory->definitions = array();
        $factory->definitionstores = array();
        $factory->lockplugins = array(); // MUST be null in order to force its regeneration.
        // Reset the state to uninitialised.
        $factory->state = self::STATE_UNINITIALISED;
    }
1233672
protected function expireRequests()
    {
        $now = TimeSupport::now();
        $expiredReqs = [];

        foreach ($this->reqs as $pid=>$request)
        {
            if ($now >= $request->getTimeout())
            {
                $expiredReqs[] = $request;
            }
        }

        foreach ($expiredReqs as $request)
        {
            unset($this->reqs[$request->getPid()]);
        }

        foreach ($expiredReqs as $request)
        {
            $request->cancel(new ThrowableProxy(new TimeoutException("RequestRecord has expired.")));
        }
    }
1142414
public function resetSession()
    {
        /*
         * TODO not in love with suppressing errors
         */
        if (session_status() !== PHP_SESSION_ACTIVE) {
            @session_start();
        }
        @session_destroy();
        @session_unset();
        @session_start();
        session_regenerate_id(true);
        $_SESSION[__CLASS__] =& $this;
        session_write_close();
    }
536999
public function resume()
    {
        if ($this->started === false && $this->canBeResumed()) {
            $this->started = true;

            $sessionObjects = $this->storageCache->get($this->storageIdentifier . md5('Neos_Flow_Object_ObjectManager'));
            if (is_array($sessionObjects)) {
                foreach ($sessionObjects as $object) {
                    if ($object instanceof ProxyInterface) {
                        $objectName = $this->objectManager->getObjectNameByClassName(get_class($object));
                        if ($this->objectManager->getScope($objectName) === ObjectConfiguration::SCOPE_SESSION) {
                            $this->objectManager->setInstance($objectName, $object);
                            $this->objectManager->get(Aspect\LazyLoadingAspect::class)->registerSessionInstance($objectName, $object);
                        }
                    }
                }
            } else {
                // Fallback for some malformed session data, if it is no array but something else.
                // In this case, we reset all session objects (graceful degradation).
                $this->storageCache->set($this->storageIdentifier . md5('Neos_Flow_Object_ObjectManager'), [], [$this->storageIdentifier], 0);
            }

            $lastActivitySecondsAgo = ($this->now - $this->lastActivityTimestamp);
            $this->lastActivityTimestamp = $this->now;
            return $lastActivitySecondsAgo;
        }
    }
1171914
private function deleteOldSessions()
    {
        // 2% chance of kicking idle sessions
        if (mt_rand(0, 49)) {
            return false;
        }

        $sessions = new UsersSessionEntityRepository();
        $sessions->setOnlyOutdated();
        $sessions->deleteObjectCollection();

        return true;
    }
678533
protected function getPersistent()
    {
        $values = [];
        if ($this->getSessionStorage()->has('filter')) {
            $values = $this->getSessionStorage()->get('filter');
        }

        if (\array_key_exists($this->getEnvironment()->getDataDefinition()->getName(), $values)) {
            $values = $values[$this->getEnvironment()->getDataDefinition()->getName()];

            if (\array_key_exists($this->getPropertyName(), $values)) {
                return $values[$this->getPropertyName()];
            }
        }

        return null;
    }
1273488
public function reset()
    {
        $this->_set_query = null;
        $this->_loaded = false;
        $this->_object_set = new ArrayObject();

        return $this;
    }
635509
private function resume()
	{
		$this->debug->groupCollapsed(__METHOD__);
		if (isset($_SESSION)) {
			$this->user = ArrayUtil::pathGet($_SESSION, $this->cfg['sessionPath']);
		}
		/*
			Session?
		*/
		if (!empty($this->user)) {
			$this->debug->info('resuming from session');
			if (isset($this->user['_ts_cur'])) {
				$this->user['lastactivity'] = $this->user['_ts_cur'];
			}
			$this->userid = $this->user['userid'];
			$this->auth_via = 'session';
			$this->auth = 2;
			if ($this->user['lastactivity'] + $this->cfg['maxIdle'] < time()) {
				$this->debug->warn('idle');
				$this->debug->log('lastactivity', $this->user['lastactivity']);
				$this->auth = 0;
			} else {
				$this->update(array('lastactivity'=>'NOW()'));
			}
		}
		/*
			Persist cookie?
		*/
		if (empty($this->auth) && isset($_COOKIE[ $this->cfg['persistCookie']['name'] ])) {
			$persist_vals = Cookie::get($this->cfg['persistCookie']['name']);
			$userid = isset($persist_vals['username']) && isset($persist_vals['token'])
				? $this->verifyPersistToken($persist_vals['username'], $persist_vals['token'])	// drops from db if found
				: null;
			if ($userid) {
				$this->debug->info('resuming from persist token');
				$this->setCurrent($userid);
				$this->setPersistToken();
				$this->auth_via = 'cookie';
				$this->auth = 1;
			}
		}
		/*
			Social Cookie?
		*/
		if (empty($this->auth)) {
		}
		if (!empty($this->auth)) {
			$this->user['_ts_cur'] = time();
		}
		$this->debug->groupEnd();
	}