You are here

function recovery_pass_cron in Recovery Password (Email New Password) 8

Same name and namespace in other branches
  1. 7 recovery_pass.module \recovery_pass_cron()

Implements hook_cron().

File

./recovery_pass.module, line 222
Contains module code.

Code

function recovery_pass_cron() {
  $expiry_period = strtotime("-" . \Drupal::config('recovery_pass.settings')
    ->get('expiry_period') . " week");

  // Delete all records more created than one week ago.
  $entry_deleted = \Drupal::database()
    ->delete('recovery_pass')
    ->condition('changed', $expiry_period, '<')
    ->execute();
  if ($entry_deleted) {
    \Drupal::logger('recovery_pass')
      ->notice('Error deleting entry from recovery_table at cron time.');
  }
}