You are here

public function GroupUserUpdateProcessor::runQuery in Lightweight Directory Access Protocol (LDAP) 8.4

Same name and namespace in other branches
  1. 8.3 ldap_user/src/Processor/GroupUserUpdateProcessor.php \Drupal\ldap_user\Processor\GroupUserUpdateProcessor::runQuery()

Runs the updating mechanism.

Parameters

string $id: LDAP QueryEntity ID.

File

ldap_user/src/Processor/GroupUserUpdateProcessor.php, line 224

Class

GroupUserUpdateProcessor
Provides functionality to generically update existing users.

Namespace

Drupal\ldap_user\Processor

Code

public function runQuery(string $id) : void {
  $this->queryController
    ->load($id);
  if (!$this
    ->constraintsValid()) {
    return;
  }
  $this->queryController
    ->execute();
  $entries = $this->queryController
    ->getRawResults();
  $attribute = $this->ldapServer
    ->getAuthenticationNameAttribute();
  if (empty($attribute)) {
    $this->logger
      ->error('No authentication name attribute set for periodic update.');
    return;
  }
  $this->logger
    ->notice('Processing @count accounts for periodic update.', [
    '@count' => count($entries),
  ]);
  foreach ($entries as $entry) {
    $this
      ->processAccount($entry, $attribute);
  }
  $this->state
    ->set('ldap_user_cron_last_group_user_update', strtotime('today'));
}