@@ -312,18 +312,17 @@ private function fetchFilecacheByFileIds(array $fileIds): array {
312312 $ result = [];
313313 $ qb = $ this ->connection ->getTypedQueryBuilder ();
314314 $ qb ->selectColumns ('fileid ' , 'storage ' , 'etag ' , 'mimetype ' )
315- ->from ('filecache ' );
315+ ->from ('filecache ' )
316+ ->where ($ qb ->expr ()->in ('fileid ' , $ qb ->createParameter ('fileIds ' )))
317+ ->runAcrossAllShards ();
316318 foreach (array_chunk ($ fileIds , 1000 ) as $ chunk ) {
317- $ qb ->andWhere (
318- $ qb ->expr ()->in ('fileid ' , $ qb ->createNamedParameter ($ chunk , IQueryBuilder::PARAM_INT_ARRAY ))
319- );
320- }
321- $ rows = $ qb ->runAcrossAllShards ()
322- ->executeQuery ();
323- while ($ row = $ rows ->fetchAssociative ()) {
324- $ result [(int )$ row ['fileid ' ]] = $ row ;
319+ $ qb ->setParameter ('fileIds ' , $ chunk , IQueryBuilder::PARAM_INT_ARRAY );
320+ $ rows = $ qb ->executeQuery ();
321+ while ($ row = $ rows ->fetchAssociative ()) {
322+ $ result [(int )$ row ['fileid ' ]] = $ row ;
323+ }
324+ $ rows ->closeCursor ();
325325 }
326- $ rows ->closeCursor ();
327326 return $ result ;
328327 }
329328
@@ -340,18 +339,17 @@ private function fetchFilecacheByPathHashes(array $pathHashes): array {
340339 $ result = [];
341340 $ qb = $ this ->connection ->getTypedQueryBuilder ();
342341 $ qb ->selectColumns ('fileid ' , 'storage ' , 'etag ' , 'mimetype ' , 'parent ' , 'path_hash ' )
343- ->from ('filecache ' );
342+ ->from ('filecache ' )
343+ ->where ($ qb ->expr ()->in ('path_hash ' , $ qb ->createParameter ('pathHashes ' )))
344+ ->runAcrossAllShards ();
344345 foreach (array_chunk ($ pathHashes , 1000 ) as $ chunk ) {
345- $ qb ->andWhere (
346- $ qb ->expr ()->in ('path_hash ' , $ qb ->createNamedParameter ($ chunk , IQueryBuilder::PARAM_STR_ARRAY ))
347- );
348- }
349- $ rows = $ qb ->runAcrossAllShards ()
350- ->executeQuery ();
351- while ($ row = $ rows ->fetchAssociative ()) {
352- $ result [$ row ['path_hash ' ]] = $ row ;
346+ $ qb ->setParameter ('pathHashes ' , $ chunk , IQueryBuilder::PARAM_STR_ARRAY );
347+ $ rows = $ qb ->executeQuery ();
348+ while ($ row = $ rows ->fetchAssociative ()) {
349+ $ result [$ row ['path_hash ' ]] = $ row ;
350+ }
351+ $ rows ->closeCursor ();
353352 }
354- $ rows ->closeCursor ();
355353 return $ result ;
356354 }
357355
0 commit comments