You are here

function user_restrictions_cron in User restrictions 8

Same name and namespace in other branches
  1. 7 user_restrictions.module \user_restrictions_cron()

Implements hook_cron().

Delete expired items in the user_restrictions table.

File

./user_restrictions.module, line 16
Specifies rules for restricting the data users can set for their accounts.

Code

function user_restrictions_cron() {
  $entity_manager = \Drupal::getContainer()
    ->get('entity_type.manager');
  $user_restrictions_type_manager = \Drupal::getContainer()
    ->get('user_restrictions.type_manager');
  $logger = \Drupal::getContainer()
    ->get('logger.factory')
    ->get('user_restrictions');
  $user_restrictions = new UserRestrictionsManager($entity_manager, $user_restrictions_type_manager, $logger);
  $user_restrictions
    ->deleteExpiredRules();
}