Back to MetadataManager class

Method checkSessionRecordExists

private int
checkSessionRecordExists
(string $sessionId)
Check if the session record exists
Parameters
  • string $sessionId The session ID to check
Returns
  • int Status value for record presence
Since
  • 4.0.0

Method checkSessionRecordExists - Source code

/**
 * Check if the session record exists
 *
 * @param   string  $sessionId  The session ID to check
 *
 * @return  integer  Status value for record presence
 *
 * @since   4.0.0
 */
private function checkSessionRecordExists(string $sessionId) : int
{
    $query = $this->db->getQuery(true)->select($this->db->quoteName('session_id'))->from($this->db->quoteName('#__session'))->where($this->db->quoteName('session_id') . ' = :session_id')->bind(':session_id', $sessionId)->setLimit(1);
    $this->db->setQuery($query);
    try {
        $exists = $this->db->loadResult();
    } catch (ExecutionFailureException $e) {
        return self::$sessionRecordUnknown;
    }
    if ($exists) {
        return self::$sessionRecordExists;
    }
    return self::$sessionRecordDoesNotExist;
}