@@ -118,7 +118,10 @@ public function createGroup(string $gid): bool {
118118 }
119119
120120 // Add to cache
121- $ this ->groupCache [$ gid ] = $ gid ;
121+ $ this ->groupCache [$ gid ] = [
122+ 'gid ' => $ gid ,
123+ 'displayname ' => $ gid
124+ ];
122125
123126 return $ result === 1 ;
124127 }
@@ -244,15 +247,19 @@ public function getUserGroups($uid) {
244247
245248 // No magic!
246249 $ qb = $ this ->dbConn ->getQueryBuilder ();
247- $ cursor = $ qb ->select ('gid ' )
248- ->from ('group_user ' )
250+ $ cursor = $ qb ->select ('gu.gid ' , 'g.displayname ' )
251+ ->from ('group_user ' , 'gu ' )
252+ ->leftJoin ('gu ' , 'groups ' , 'g ' , $ qb ->expr ()->eq ('gu.gid ' , 'g.gid ' ))
249253 ->where ($ qb ->expr ()->eq ('uid ' , $ qb ->createNamedParameter ($ uid )))
250254 ->execute ();
251255
252256 $ groups = [];
253257 while ($ row = $ cursor ->fetch ()) {
254258 $ groups [] = $ row ['gid ' ];
255- $ this ->groupCache [$ row ['gid ' ]] = $ row ['gid ' ];
259+ $ this ->groupCache [$ row ['gid ' ]] = [
260+ 'gid ' => $ row ['gid ' ],
261+ 'displayname ' => $ row ['displayname ' ],
262+ ];
256263 }
257264 $ cursor ->closeCursor ();
258265
@@ -309,15 +316,18 @@ public function groupExists($gid) {
309316 }
310317
311318 $ qb = $ this ->dbConn ->getQueryBuilder ();
312- $ cursor = $ qb ->select ('gid ' )
319+ $ cursor = $ qb ->select ('gid ' , ' displayname ' )
313320 ->from ('groups ' )
314321 ->where ($ qb ->expr ()->eq ('gid ' , $ qb ->createNamedParameter ($ gid )))
315322 ->execute ();
316323 $ result = $ cursor ->fetch ();
317324 $ cursor ->closeCursor ();
318325
319326 if ($ result !== false ) {
320- $ this ->groupCache [$ gid ] = $ gid ;
327+ $ this ->groupCache [$ gid ] = [
328+ 'gid ' => $ gid ,
329+ 'displayname ' => $ result ['displayname ' ],
330+ ];
321331 return true ;
322332 }
323333 return false ;
@@ -430,6 +440,10 @@ public function countDisabledInGroup(string $gid): int {
430440 }
431441
432442 public function getDisplayName (string $ gid ): string {
443+ if (isset ($ this ->groupCache [$ gid ])) {
444+ return $ this ->groupCache [$ gid ]['displayname ' ];
445+ }
446+
433447 $ this ->fixDI ();
434448
435449 $ query = $ this ->dbConn ->getQueryBuilder ();
0 commit comments