]> source.dussan.org Git - nextcloud-server.git/commitdiff
LDAP: reset user/group-config association only after exists-check, may performance...
authorArthur Schiwon <blizzz@owncloud.com>
Mon, 22 Apr 2013 23:00:27 +0000 (01:00 +0200)
committerArthur Schiwon <blizzz@owncloud.com>
Mon, 22 Apr 2013 23:00:27 +0000 (01:00 +0200)
apps/user_ldap/group_proxy.php
apps/user_ldap/user_proxy.php

index 68d2efe38718dd00d1ed9bc8a4610c833f765e50..75e7cd46336328e8320447f6bb9f037ce8ca3aac 100644 (file)
@@ -76,8 +76,15 @@ class Group_Proxy extends lib\Proxy implements \OCP\GroupInterface {
                        if(isset($this->backends[$prefix])) {
                                $result = call_user_func_array(array($this->backends[$prefix], $method), $parameters);
                                if(!$result) {
-                                       //not found here, reset cache to null
-                                       $this->writeToCache($cacheKey, null);
+                                       //not found here, reset cache to null if group vanished
+                                       //because sometimes methods return false with a reason
+                                       $groupExists = call_user_func_array(
+                                               array($this->backends[$prefix], 'groupExists'),
+                                               array($gid)
+                                       );
+                                       if(!$groupExists) {
+                                               $this->writeToCache($cacheKey, null);
+                                       }
                                }
                                return $result;
                        }
index 6a75bae3815f0cbdb1b4b416cc9dacc58192d44d..7e5b9045df3f42064ef0e75a71ece3adc2a7c277 100644 (file)
@@ -76,8 +76,15 @@ class User_Proxy extends lib\Proxy implements \OCP\UserInterface {
                        if(isset($this->backends[$prefix])) {
                                $result = call_user_func_array(array($this->backends[$prefix], $method), $parameters);
                                if(!$result) {
-                                       //not found here, reset cache to null
-                                       $this->writeToCache($cacheKey, null);
+                                       //not found here, reset cache to null if user vanished
+                                       //because sometimes methods return false with a reason
+                                       $userExists = call_user_func_array(
+                                               array($this->backends[$prefix], 'userExists'),
+                                               array($uid)
+                                       );
+                                       if(!$userExists) {
+                                               $this->writeToCache($cacheKey, null);
+                                       }
                                }
                                return $result;
                        }