You are here

function ldap_servers_schema 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_schema()
  2. 7 ldap_servers/ldap_servers.install \ldap_servers_schema()

Implements hook_schema().

2 calls to ldap_servers_schema()
ldap_servers_update_7201 in ldap_servers/ldap_servers.install
Upgrade as much as feasible for 7.1 to 7.2 branch.
ldap_servers_update_7203 in ldap_servers/ldap_servers.install
Make all schema field names lowercase in ldap server to deal with cronic case sensitivity issues.

File

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

Code

function ldap_servers_schema() {
  module_load_include('inc', 'ldap_servers', 'ldap_servers.functions');

  // To get the LDAP_SERVERS_ENC_TYPE_CLEARTEXT constants issue#1209576.
  module_load_include('module', 'ldap_servers', 'ldap_servers');
  module_load_include('php', 'ldap_servers', 'LdapServerAdmin.class');
  $schema['ldap_servers'] = [
    'export' => [
      'key' => 'sid',
      'key name' => 'Server ID',
      'primary key' => 'numeric_sid',
      'identifier' => 'ldap_servers_conf',
      'api' => [
        'owner' => 'ldap_servers',
        'api' => 'ldap_servers',
        'minimum_version' => 1,
        'current_version' => 1,
      ],
    ],
    'primary key' => [
      'numeric_sid',
    ],
    'unique keys' => [
      'name' => [
        'name',
      ],
    ],
  ];
  $fields = LdapServerAdmin::fields();
  foreach ($fields as $name => $props) {
    if (isset($props['schema'])) {
      $schema['ldap_servers']['fields'][$name] = $props['schema'];
    }
  }
  return $schema;
}