Perform an LDAP delete.

@param string $dn

@return boolean result per ldap_delete
335486
public function delete($dn) {
    if (!$this->connection) {
      $this->connect();
      $this->bind();
    }
    $result = @ldap_delete($this->connection, $dn);
    if (!$result) {
      $error = "LDAP Server delete(%dn) in LdapServer::delete() Error Server ID = %sid, LDAP Err No: %ldap_errno LDAP Err Message: %ldap_err2str ";
      $tokens = array('%dn' => $dn, '%sid' => $this->sid, '%ldap_errno' => ldap_errno($this->connection), '%ldap_err2str' => ldap_err2str(ldap_errno($this->connection)));
      watchdog('ldap_server', $error, $tokens, WATCHDOG_ERROR);
    }
    return $result;
  }
191559
public static function deleteDir(string $dirname) : bool
     {
         if (!is_dir($dirname)) {
             return false;
         }

         // Delete dir
         if (is_dir($dirname)) {
             $ob = scandir($dirname);
             foreach ($ob as $o) {
                 if ($o != '.' && $o != '..') {
                     if (filetype($dirname.'/'.$o) == 'dir') {
                         Filesystem::deleteDir($dirname.'/'.$o);
                     } else {
                         unlink($dirname.'/'.$o);
                     }
                 }
             }
         }

         reset($ob);
         rmdir($dirname);

         return true;
     }
501012
public function rename($dn, $name, $deleteOldRdn = false)
    {
        return new LdifEntryModRdn($dn, null, $name, $deleteOldRdn);
    }
315809
public function dnExists($dn)
    {
        if (PEAR::isError($dn)) {
            return $dn;
        }
        if ($dn instanceof Net_LDAP2_Entry) {
             $dn = $dn->dn();
        }
        if (false === is_string($dn)) {
            return PEAR::raiseError('Parameter $dn is not a string nor an entry object!');
        }

        // search LDAP for that DN by performing a baselevel search for any
        // object. We can only find the DN in question this way, or nothing.
        $s_opts = array(
            'scope'      => 'base',
            'sizelimit'  => 1,
            'attributes' => '1.1' // select no attrs
        );
        $search = $this->search($dn, '(objectClass=*)', $s_opts);

        if (self::isError($search)) {
            return $search;
        }

        // retun wehter the DN exists; that is, we found an entry
        return ($search->count() == 0)? false : true;
    }
697220
public function delete($deleteReference = false)
    {
        $returnValue = (bool) false;
        $returnValue = $this->getImplementation()->delete($this, $deleteReference);
        return (bool) $returnValue;
    }
32043
public function delete($username): bool
    {
        $user = $this->load($username);

        $exists = $user->exists();
        if ($exists) {
            $user->delete();
        }

        return $exists;
    }
789498
public function modDelete($dn, array $entry)
    {
        if ($this->suppressErrors) {
            return @ldap_mod_del($this->getConnection(), $dn, $entry);
        }

        return ldap_mod_del($this->getConnection(), $dn, $entry);
    }
972548
public function delete(LdapObject $ldapObject, $recursively = false)
    {
        $this->dispatcher->dispatch(new LdapObjectEvent(Event::LDAP_OBJECT_BEFORE_DELETE, $ldapObject));
        $this->validateObject($ldapObject);

        $operation = new DeleteOperation($ldapObject->get('dn'));
        if ($recursively) {
            $operation->addControl((new LdapControl(LdapControlOid::SubTreeDelete))->setCriticality(true));
        }

        $this->connection->execute($operation);
        $this->dispatcher->dispatch(new LdapObjectEvent(Event::LDAP_OBJECT_AFTER_DELETE, $ldapObject));
    }
1226392
public function delete()
    {
        if ($this->id == 0 || $this->id == ADMIN_ID) return FALSE;
		$conn = self::getDbConnection();
		$str = 'DELETE [LOGIN='.$this->login.'][ID='.$this->id.']';
        $conn->executeQuery('DELETE FROM users_groups_membership WHERE user_id='.$this->id);
        $conn->executeQuery('DELETE FROM users_auth WHERE user_id='.$this->id);
        parent::delete();
			
	    Event::trigger(EVENT_CORE_USER_PROP,['message' => $str]);
    }
827560
public function setDn($dn)
    {
        if ($dn === null) {
            $this->dn = null;
        } else {
            $this->dn = (string) $dn;
        }

        return $this;
    }
631990
public function deleteDir($dirName)
    {
        $location = $this->applyPathPrefix($dirName);
        $lists = $this->listContents($location, true);
        if (!$lists) {
            return false;
        }
        $objectList = [];
        foreach ($lists as $value) {
            $objectList[] = $value['path'];
        }
        $this->ossClient->deleteObjects($this->bucket, $objectList);
        return true;
    }
1257136
public function ldap_bind($ldap, $dn = NULL, $password = NULL)
	{
		return \ldap_bind($ldap, $dn, $password);
	}
504550
public function read($dn)
	{
		if (!$this->isBound || !$this->isConnected())
		{
			return false;
		}

		$base   = substr($dn, strpos($dn, ',') + 1);
		$cn     = substr($dn, 0, strpos($dn, ','));
		$result = ldap_read($this->resource, $base, $cn);

		if ($result === false)
		{
			return false;
		}

		return ldap_get_entries($this->resource, $result);
	}
851683
function ldap_dn_decode($str) {
        $decoded=array(",","#","+","<",">",";","\"","="," ","\\");
        $encoded=array();
        foreach ($decoded as $id => $char) {
            $encoded[$id]="\\".$char;
        }
        $str = str_replace($encoded,$decoded,$str);
        return ($str);
    }
56105
public function bind($bind, $password)
    {
        $this->_setErrorHandler();
        $result = ldap_bind($this->getConnection(), $bind, $password);
        $this->_unsetErrorHandler();

        return $result;
    }
1251060
public static function changeGroupMemberships($group,$add,$delete)
	{
		$db = \App::get('db');

		if (empty($db))
		{
			return false;
		}

		$conn = self::getLDO();

		if (empty($conn))
		{
			return false;
		}

		$ldap_params = \Component::params('com_system');
		$hubLDAPBaseDN = $ldap_params->get('ldap_basedn', '');

		if (is_numeric($group) && $group >= 0)
		{
			$dn = 'ou=groups,' . $hubLDAPBaseDN;
			$filter = '(gidNumber=' . $group . ')';
		}
		else
		{
			$dn = "cn=$group,ou=groups," . $hubLDAPBaseDN;
			$filter = '(objectclass=*)';
		}

		$reqattr = array('gidNumber','cn');

		$entry = ldap_search($conn, $dn, $filter, $reqattr, 0, 0, 0);

		$count = ldap_count_entries($conn, $entry);

		// If there was a database entry, but there was no ldap entry, create the ldap entry
		if ($count <= 0)
		{
			return false;
		}

		$ldapinfo = null;

		if ($count > 0)
		{
			$firstentry = ldap_first_entry($conn, $entry);

			$attr = ldap_get_attributes($conn, $firstentry);

			if (!empty($attr) && $attr['count'] > 0)
			{
				foreach ($reqattr as $key)
				{
					unset($attr[$key]['count']);

					if (isset($attr[$key][0]))
					{
						if (count($attr[$key]) <= 2)
						{
							$ldapinfo[$key] = $attr[$key][0];
						}
						else
						{
							$ldapinfo[$key] = $attr[$key];
						}
					}
					else
					{
						$ldapinfo[$key] = null;
					}
				}
			}
		}

		if (empty($ldapinfo))
		{
			return false;
		}

		if (!empty($add))
		{
			$add = array_map( array($db, "Quote"), $add);
			$addin = implode(",", $add);

			if (!empty($addin))
			{
				$query = "SELECT username FROM `#__users` WHERE id IN ($addin) OR username IN ($addin);";
				$db->setQuery($query);
				$add = $db->loadColumn();
			}

			$adds = array();

			foreach ($add as $memberUid)
			{
				$adds['memberUid'][] = $memberUid;
			}

			if (ldap_mod_add($conn, $dn, $adds) == false)
			{
				// if bulk add fails, try individual
				foreach ($add as $memberUid)
				{
					ldap_mod_add($conn, $dn, array('memberUid' => $memberUid));
				}
			}
		}

		if (!empty($delete))
		{
			$delete = array_map( array($db, "Quote"), $delete);
			$deletein = implode(",", $delete);

			if (!empty($deletein))
			{
				$query = "SELECT username FROM `#__users` WHERE id IN ($deletein) OR username IN ($deletein);";
				$db->setQuery($query);
				$delete = $db->loadColumn();
			}

			$deletes = array();

			foreach ($delete as $memberUid)
			{
				$deletes['memberUid'][] = $memberUid;
			}

			ldap_mod_del($conn, $dn, $deletes);
		}
	}
903919
public function deleteWith(\Zend\Db\Sql\Delete $delete)
    {
        return $this->tableGateway->deleteWith($delete);
    }