setConnector($connector); $groupBE = new \OCA\user_ldap\GROUP_LDAP(); $groupBE->setConnector($connector); foreach($objects as $object) { $fetchDNSql = 'SELECT `ldap_dn` FROM `*PREFIX*ldap_'.$object.'_mapping`'; $updateSql = 'UPDATE `*PREFIX*ldap_'.$object.'_mapping` SET `ldap_DN` = ?, `directory_uuid` = ? WHERE `ldap_dn` = ?'; $query = OCP\DB::prepare($fetchDNSql); $res = $query->execute(); $DNs = $res->fetchAll(); $updateQuery = OCP\DB::prepare($updateSql); foreach($DNs as $dn) { $newDN = mb_strtolower($dn['ldap_dn'], 'UTF-8'); if($object == 'user') { $uuid = $userBE->getUUID($newDN); } else { $uuid = $groupBE->getUUID($newDN); } $updateQuery->execute(array($newDN, $uuid, $dn['ldap_dn'])); } }