You are here

function _login_security_remove_all_events in Login Security 2.x

Same name and namespace in other branches
  1. 8 login_security.module \_login_security_remove_all_events()
  2. 6 login_security.module \_login_security_remove_all_events()
  3. 7 login_security.module \_login_security_remove_all_events()

Remove all tracked events up to a date..

Parameters

int $time: if specified, events up to this timestamp will be deleted. If not specified, all elements up to current timestamp will be deleted.

Return value

int The number of events deleted.

2 calls to _login_security_remove_all_events()
LoginSecurityAdminSettings::cleanTrackedEvents in src/Form/LoginSecurityAdminSettings.php
Submit handler to clean the login_security_track table.
_login_security_remove_events in ./login_security.module
Remove tracked events or expire old ones.

File

./login_security.module, line 312
Login Security module hooks.

Code

function _login_security_remove_all_events($time = NULL) {

  // Remove selected events.
  if (empty($time)) {
    $time = \Drupal::time()
      ->getRequestTime();
  }
  return \Drupal::database()
    ->delete('login_security_track')
    ->condition('timestamp', $time, '<')
    ->execute();
}