Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2021-12-12 16:14:16 +0300
committerCarl Schwan <carl@carlschwan.eu>2022-10-20 13:08:34 +0300
commit5647093319e6083a4571651f7491c5aa50df4a03 (patch)
tree4e46d11e23e128b25486b047784801fbecd24e98 /apps
parentad2fdbe3776dc2d25c646d37b9cff448d5fdf326 (diff)
Cache intermediates
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de> Co-authored-by: Carl Schwan <carl@carlschwan.eu>
Diffstat (limited to 'apps')
-rw-r--r--apps/user_ldap/lib/Access.php6
-rw-r--r--apps/user_ldap/lib/Group_LDAP.php8
2 files changed, 13 insertions, 1 deletions
diff --git a/apps/user_ldap/lib/Access.php b/apps/user_ldap/lib/Access.php
index cec192721a5..7ad6552780c 100644
--- a/apps/user_ldap/lib/Access.php
+++ b/apps/user_ldap/lib/Access.php
@@ -511,6 +511,11 @@ class Access extends LDAPUtility {
* @throws \Exception
*/
public function dn2ocname($fdn, $ldapName = null, $isUser = true, &$newlyMapped = null, array $record = null) {
+ static $intermediates = [];
+ if (isset($intermediates[($isUser ? 'user-' : 'group-') . $fdn])) {
+ return false; // is a known intermediate
+ }
+
$newlyMapped = false;
if ($isUser) {
$mapper = $this->getUserMapper();
@@ -546,6 +551,7 @@ class Access extends LDAPUtility {
$ldapName = $this->readAttribute($fdn, $nameAttribute, $filter);
if (!isset($ldapName[0]) || empty($ldapName[0])) {
$this->logger->debug('No or empty name for ' . $fdn . ' with filter ' . $filter . '.', ['app' => 'user_ldap']);
+ $intermediates[($isUser ? 'user-' : 'group-') . $fdn] = true;
return false;
}
$ldapName = $ldapName[0];
diff --git a/apps/user_ldap/lib/Group_LDAP.php b/apps/user_ldap/lib/Group_LDAP.php
index b0d5909fd81..aa4c6572869 100644
--- a/apps/user_ldap/lib/Group_LDAP.php
+++ b/apps/user_ldap/lib/Group_LDAP.php
@@ -363,7 +363,13 @@ class Group_LDAP extends BackendUtility implements GroupInterface, IGroupLDAP, I
// Prevent loops
continue;
}
- $fetched = $fetcher($record);
+
+ $cacheKey = 'walkNestedGroups_' . $recordDN;
+ $fetched = $this->access->connection->getFromCache($cacheKey);
+ if ($fetched === null) {
+ $fetched = $fetcher($record);
+ $fetched = $this->access->connection->writeToCache($cacheKey, $fetched);
+ }
$list = array_merge($list, $fetched);
if (!isset($seen[$recordDN]) || is_bool($seen[$recordDN]) && is_array($record)) {
$seen[$recordDN] = $record;