You are here

function ldap_servers_update_8303 in Lightweight Directory Access Protocol (LDAP) 8.4

Same name and namespace in other branches
  1. 8.3 ldap_servers/ldap_servers.install \ldap_servers_update_8303()

Adds default timeout to all servers.

File

ldap_servers/ldap_servers.install, line 93

Code

function ldap_servers_update_8303() : \Drupal\Core\StringTranslation\TranslatableMarkup {

  /** @var \Drupal\Core\Entity\EntityStorageInterface $storage */
  $storage = \Drupal::service('entity_type.manager')
    ->getStorage('ldap_server');
  $servers = $storage
    ->getQuery()
    ->execute();

  /** @var \Drupal\ldap_servers\Entity\Server $server */
  foreach ($storage
    ->loadMultiple($servers) as $server) {
    $server
      ->set('timeout', 10);
    $server
      ->save();
  }
  return t('Server network timeouts are now configurable. Your servers have been set to 10 seconds.');
}