You are here

function ldap_user_cron in Lightweight Directory Access Protocol (LDAP) 8.3

Same name and namespace in other branches
  1. 8.4 ldap_user/ldap_user.module \ldap_user_cron()
  2. 8.2 ldap_user/ldap_user.module \ldap_user_cron()
  3. 7.2 ldap_user/ldap_user.module \ldap_user_cron()

Implements hook_cron().

File

ldap_user/ldap_user.module, line 23
Module for the LDAP User Entity.

Code

function ldap_user_cron() {
  $check_orphans = \Drupal::config('ldap_user.settings')
    ->get('orphanedDrupalAcctBehavior');
  if ($check_orphans != 'ldap_user_orphan_do_not_check') {
    $processor = \Drupal::service('ldap_user.orphan_processor');
    $processor
      ->checkOrphans();
  }
  $ldapUpdateQuery = \Drupal::config('ldap_user.settings')
    ->get('userUpdateCronQuery');
  if (\Drupal::moduleHandler()
    ->moduleExists('ldap_query') && $ldapUpdateQuery != NULL && $ldapUpdateQuery != 'none') {
    $processor = \Drupal::service('ldap_user.group_user_update_processor');
    if ($processor
      ->updateDue()) {
      $processor
        ->runQuery($ldapUpdateQuery);
    }
  }
}