You are here

public function TokenManager::cleanupExpiredTokens in Persistent Login 8

Remove expired tokens from the database.

File

src/TokenManager.php, line 241

Class

TokenManager
Class TokenManager.

Namespace

Drupal\persistent_login

Code

public function cleanupExpiredTokens() {
  try {
    $this->connection
      ->delete('persistent_login')
      ->condition('expires', $this->time
      ->getRequestTime(), '<')
      ->execute();
  } catch (\Exception $e) {
    $this->logger
      ->error('An error occurred while removing expired tokens');
  }
}