Hello again:

On 10.04.2012 02:12, Achim wrote:
6) rcmimportreplace ('Replace the entire address book' when importing
a VCF file) does not work for LDAP. The newly imported card is simply
added to the existing cards, rather than replacing them all.

I figured out that the implementation for the abstract function delete_all() declared in the base class rcube_addressbook was missing from rcube_ldap. Here is a version that works for me, feel free to add it to the codebase:

    /**
     * Remove all records from the database
     */
    function delete_all() {
        $recursive = true; // to support groups once they work
return $this->_ldap_delete($this->conn,$this->base_dn,$recursive,true);
    }

        /**
* helper function from http://www.php.net/manual/en/function.ldap-delete.php#21467
          */

private function _ldap_delete($ds,$dn,$recursive=false,$root=true){
    if($recursive == false){
        if (!$root)
                return(ldap_delete($ds,$dn));
        else
                return true;
    } else {
        //searching for sub entries
$sr= @ldap_list($ds,$dn,$this->filter ? $this->filter : '(objectclass=*)',array(""));
        $info = @ldap_get_entries($ds, $sr);
        $result = false;
        for($i=0;$i<$info['count'];$i++){
            //deleting recursively sub entries
$result=$this->_ldap_delete($ds,$info[$i]['dn'],$recursive,false);
            }
        if (!$root)
                return(ldap_delete($ds,$dn));
        else
                return true;
    }
}


Now there are only 5 issues remaining ;-)

Achim
_______________________________________________
Roundcube Users mailing list
[email protected]
http://lists.roundcube.net/mailman/listinfo/users

Reply via email to