W3cubDocs

/Drupal 8

public function DatabaseBackend::schemaDefinition

public DatabaseBackend::schemaDefinition()

Defines the schema for the flood table.

File

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

Class

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

Namespace

Drupal\Core\Flood

Code

public function schemaDefinition() {
  return [
    'description' => 'Flood controls the threshold of events, such as the number of contact attempts.',
    'fields' => [
      'fid' => [
        'description' => 'Unique flood event ID.',
        'type' => 'serial',
        'not null' => TRUE,
      ],
      'event' => [
        'description' => 'Name of event (e.g. contact).',
        'type' => 'varchar_ascii',
        'length' => 64,
        'not null' => TRUE,
        'default' => '',
      ],
      'identifier' => [
        'description' => 'Identifier of the visitor, such as an IP address or hostname.',
        'type' => 'varchar_ascii',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
      ],
      'timestamp' => [
        'description' => 'Timestamp of the event.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ],
      'expiration' => [
        'description' => 'Expiration timestamp. Expired events are purged on cron run.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ],
    ],
    'primary key' => ['fid'],
    'indexes' => [
      'allow' => ['event', 'identifier', 'timestamp'],
      'purge' => ['expiration'],
    ],
  ];
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Flood!DatabaseBackend.php/function/DatabaseBackend::schemaDefinition/8.1.x