Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. PdoSessionHandler.php

function PdoSessionHandler::updateTimestamp

File

vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php, line 373

Class

PdoSessionHandler
Session handler using a PDO connection to read and write data.

Namespace

Symfony\Component\HttpFoundation\Session\Storage\Handler

Code

public function updateTimestamp(string $sessionId, string $data) : bool {
    $expiry = time() + (int) (($this->ttl instanceof \Closure ? ($this->ttl)() : $this->ttl) ?? \ini_get('session.gc_maxlifetime'));
    try {
        $updateStmt = $this->pdo
            ->prepare("UPDATE {$this->table} SET {$this->lifetimeCol} = :expiry, {$this->timeCol} = :time WHERE {$this->idCol} = :id");
        $updateStmt->bindValue(':id', $sessionId, \PDO::PARAM_STR);
        $updateStmt->bindValue(':expiry', $expiry, \PDO::PARAM_INT);
        $updateStmt->bindValue(':time', time(), \PDO::PARAM_INT);
        $updateStmt->execute();
    } catch (\PDOException $e) {
        $this->rollback();
        throw $e;
    }
    return true;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal