You are here

function ldap_user_update_8302 in Lightweight Directory Access Protocol (LDAP) 8.4

Same name and namespace in other branches
  1. 8.3 ldap_user/ldap_user.install \ldap_user_update_8302()

Drop ldap_user_identities table.

File

ldap_user/ldap_user.install, line 81

Code

function ldap_user_update_8302(&$sandbox) {

  // Check for externalauth module (which has been a dependency for ages).
  if (!\Drupal::moduleHandler()
    ->moduleExists('externalauth')) {
    $external_link = Url::fromUri('https://drupal.org/project/externalauth');
    $message = t('Please install the 8301 %external_link module.', [
      '%external_link' => Link::fromTextAndUrl('External Auth', $external_link),
    ]);
    \Drupal::messenger()
      ->addError($message);
    throw new UpdateException($message);
  }

  // Drop the table if it exists.
  try {
    Database::getConnection()
      ->query('DROP TABLE {ldap_user_identities}');
  } catch (Exception $e) {
    \Drupal::messenger()
      ->addWarning(t("Couldn't drop the table 'ldap_user_identities'. Maybe it's been dropped already?"));
  }
}