Skip to content

Commit

Permalink
fixup! read records from DB for lists at once, not one by one.
Browse files Browse the repository at this point in the history
  • Loading branch information
blizzz committed Mar 15, 2020
1 parent acd0a83 commit ab9f13a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions apps/user_ldap/lib/Access.php
Original file line number Diff line number Diff line change
Expand Up @@ -882,10 +882,10 @@ public function fetchListOfUsers($filter, $attr, $limit = null, $offset = null,
$listOfDNs[] = $entry['dn'][0];
return $listOfDNs;
}, []);
$uidsByDn = $this->userMapper->getListOfIdsByDn($listOfDNs);
$recordsToUpdate = array_filter($ldapRecords, function($record) use ($isBackgroundJobModeAjax, $uidsByDn) {
$idsByDn = $this->userMapper->getListOfIdsByDn($listOfDNs);
$recordsToUpdate = array_filter($ldapRecords, function($record) use ($isBackgroundJobModeAjax, $idsByDn) {
$newlyMapped = false;
$uid = $uidsByDn[$record['dn'][0]] ?? null;
$uid = $idsByDn[$record['dn'][0]] ?? null;
if($uid === null) {
$uid = $this->dn2ocname($record['dn'][0], null, true, $newlyMapped, $record);
}
Expand Down
2 changes: 1 addition & 1 deletion apps/user_ldap/lib/Mapping/AbstractMapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ protected function modify($query, $parameters) {
*/
public function getDNByName($name) {
$dn = array_search($name, $this->cache);
if($dn === null) {
if($dn === false) {
$dn = $this->getXbyY('ldap_dn', 'owncloud_name', $name);
$this->cache[$dn] = $name;
}
Expand Down

0 comments on commit ab9f13a

Please sign in to comment.