You are here

public static function SimpleLdap::ldap_rename in Simple LDAP 7.2

Same name and namespace in other branches
  1. 7 SimpleLdap.class.php \SimpleLdap::ldap_rename()

Wrapper function for ldap_rename().

@throw SimpleLdapException

Parameters

resource $link_identifier: An LDAP link identifier.

string $dn: The distinguished name of an LDAP entity.

string $newrdn: The new RDN.

string $newparent: The new parent/superior entry.

boolean $deleteoldrdn: If TRUE the old RDN value(s) is removed, else the old RDN value(s) is retained as non-distinguished values of the entry.

Return value

boolean TRUE on success.

1 call to SimpleLdap::ldap_rename()
SimpleLdapServer::move in ./SimpleLdapServer.class.php
Move an entry to a new DN.

File

./SimpleLdap.class.php, line 1296
Class defining base Simple LDAP functionallity.

Class

SimpleLdap
Simple LDAP class.

Code

public static function ldap_rename($link_identifier, $dn, $newrdn, $newparent, $deleteoldrdn) {

  // Devel debugging.
  if (variable_get('simple_ldap_devel', FALSE)) {
    dpm(__FUNCTION__);
    dpm(array(
      '$dn' => $dn,
      '$newrdn' => $newrdn,
      '$newparent' => $newparent,
      '$deleteoldrdn' => $deleteoldrdn,
    ));
  }

  // Wrapped function call.
  $return = @ldap_rename($link_identifier, $dn, $newrdn, $newparent, $deleteoldrdn);

  // Debugging.
  if (variable_get('simple_ldap_debug', FALSE)) {
    $message = __FUNCTION__ . '($link_identifier = @link_identifier, $dn = @dn, $newrdn = @newrdn, $newparent = @newparent, $deleteoldrdn = @deleteoldrdn) returns @return';
    $variables = array(
      '@link_identifier' => print_r($link_identifier, TRUE),
      '@dn' => print_r($dn, TRUE),
      '@newrdn' => print_r($newrdn, TRUE),
      '@newparent' => print_r($newparent, TRUE),
      '@deleteoldrdn' => print_r($deleteoldrdn, TRUE),
      '@return' => print_r($return, TRUE),
    );
    watchdog('simple_ldap', $message, $variables, WATCHDOG_DEBUG);
  }

  // Error handling.
  if ($return === FALSE) {
    throw new SimpleLdapException($link_identifier);
  }
  return $return;
}