You are here

function ldap_servers_update_7108 in Lightweight Directory Access Protocol (LDAP) 7.2

Same name and namespace in other branches
  1. 8.2 ldap_servers/ldap_servers.install \ldap_servers_update_7108()

Add group related fields to ldap_servers table.

File

ldap_servers/ldap_servers.install, line 343
Install, update and uninstall functions for the LDAP API module.

Code

function ldap_servers_update_7108() {
  foreach ([
    'groupFunctionalityUnused',
    'groupNested',
    'groupSearchAll',
    'groupUserMembershipsAttrExists',
    'groupDeriveFromDn',
    'groupUserMembershipsAttrExists',
  ] as $tinyint_field_name) {
    if (!ldap_servers_db_field_exists('ldap_servers', $tinyint_field_name)) {
      db_add_field('ldap_servers', $tinyint_field_name, [
        'type' => 'int',
        'size' => 'tiny',
        'not null' => FALSE,
        'default' => 0,
      ]);
      $msg = t('"!name" field added to ldap_servers table', [
        '!name' => $tinyint_field_name,
      ]);
    }
  }
  foreach ([
    'groupUserMembershipsAttr',
    'groupMembershipsAttr',
    'groupTestGroupDn',
    'groupUserMembershipsAttr',
    'groupMembershipsAttrMatchingUserAttr',
  ] as $varchar255field_name) {
    if (!ldap_servers_db_field_exists('ldap_servers', $varchar255field_name) && !ldap_servers_db_field_exists('ldap_servers', drupal_strtolower($varchar255field_name))) {
      db_add_field('ldap_servers', $varchar255field_name, [
        'type' => 'varchar',
        'length' => '255',
        'not null' => FALSE,
      ]);
      $msg = t('"!name" field added to ldap_servers table', [
        '!name' => $varchar255field_name,
      ]);
    }
  }
}