function DatabaseBackend::doInsert

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Flood/DatabaseBackend.php \Drupal\Core\Flood\DatabaseBackend::doInsert()
  2. 8.9.x core/lib/Drupal/Core/Flood/DatabaseBackend.php \Drupal\Core\Flood\DatabaseBackend::doInsert()
  3. 11.x core/lib/Drupal/Core/Flood/DatabaseBackend.php \Drupal\Core\Flood\DatabaseBackend::doInsert()

Inserts an event into the flood table.

Parameters

string $name: The name of an event.

int $window: Number of seconds before this event expires.

string $identifier: Unique identifier of the current user.

See also

\Drupal\Core\Flood\DatabaseBackend::register

1 call to DatabaseBackend::doInsert()
DatabaseBackend::register in core/lib/Drupal/Core/Flood/DatabaseBackend.php

File

core/lib/Drupal/Core/Flood/DatabaseBackend.php, line 88

Class

DatabaseBackend
Defines the database flood backend. This is the default Drupal backend.

Namespace

Drupal\Core\Flood

Code

protected function doInsert($name, $window, $identifier) {
    $this->connection
        ->insert(static::TABLE_NAME)
        ->fields([
        'event' => $name,
        'identifier' => $identifier,
        'timestamp' => $this->time
            ->getRequestTime(),
        'expiration' => $this->time
            ->getRequestTime() + $window,
    ])
        ->execute();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.