@@ -257,47 +257,43 @@ protected function getAncestorLookupSql(array $batch)
257
257
INNER JOIN {$ this ->options ['oid_ancestors_table_name ' ]} a ON a.object_identity_id = o.id
258
258
WHERE (
259
259
SELECTCLAUSE ;
260
-
261
- $ types = array ();
262
- for ($ i =0 ,$ c =count ($ batch ); $ i <$ c ; $ i ++) {
263
- if (!isset ($ types [$ batch [$ i ]->getType ()])) {
264
- $ types [$ batch [$ i ]->getType ()] = true ;
265
- if (count ($ batch ) > 1 ) {
266
- break ;
267
- }
268
- }
260
+
261
+ $ types = array ();
262
+ $ count = count ($ batch );
263
+ for ($ i = 0 ; $ i < $ count ; $ i ++) {
264
+ if (!isset ($ types [$ batch [$ i ]->getType ()])) {
265
+ $ types [$ batch [$ i ]->getType ()] = true ;
266
+ if ($ count > 1 ) {
267
+ break ;
268
+ }
269
+ }
269
270
}
270
-
271
- if (count ($ types ) === 1 ) {
272
-
273
- $ where = '(o.object_identifier IN (%s) AND c.class_type = %s) ' ;
274
- $ ids = array ();
275
- for ($ i =0 ,$ c =count ($ batch ); $ i <$ c ; $ i ++) {
276
- $ ids [] = $ this ->connection ->quote ($ batch [$ i ]->getIdentifier ());
277
- }
278
-
279
- $ sql .= sprintf (
280
- $ where ,
281
- implode (', ' , $ ids ),
282
- $ this ->connection ->quote ($ batch [0 ]->getType ())
283
- );
284
-
271
+
272
+ if (1 === count ($ types )) {
273
+ $ ids = array ();
274
+ for ($ i = 0 ; $ i < $ count ; $ i ++) {
275
+ $ ids [] = $ this ->connection ->quote ($ batch [$ i ]->getIdentifier ());
276
+ }
277
+
278
+ $ sql .= sprintf (
279
+ '(o.object_identifier IN (%s) AND c.class_type = %s) ' ,
280
+ implode (', ' , $ ids ),
281
+ $ this ->connection ->quote ($ batch [0 ]->getType ())
282
+ );
285
283
} else {
286
-
287
- $ where = '(o.object_identifier = %s AND c.class_type = %s) ' ;
288
- for ($ i =0 ,$ c =count ($ batch ); $ i <$ c ; $ i ++) {
289
- $ sql .= sprintf (
290
- $ where ,
291
- $ this ->connection ->quote ($ batch [$ i ]->getIdentifier ()),
292
- $ this ->connection ->quote ($ batch [$ i ]->getType ())
293
- );
294
-
295
- if ($ i +1 < $ c ) {
296
- $ sql .= ' OR ' ;
297
- }
298
- }
284
+ $ where = '(o.object_identifier = %s AND c.class_type = %s) ' ;
285
+ for ($ i = 0 ; $ i < $ count ; $ i ++) {
286
+ $ sql .= sprintf (
287
+ $ where ,
288
+ $ this ->connection ->quote ($ batch [$ i ]->getIdentifier ()),
289
+ $ this ->connection ->quote ($ batch [$ i ]->getType ())
290
+ );
291
+
292
+ if ($ i +1 < $ count ) {
293
+ $ sql .= ' OR ' ;
294
+ }
295
+ }
299
296
}
300
-
301
297
302
298
$ sql .= ') ' ;
303
299
@@ -445,7 +441,7 @@ private function doUpdateAceIdentityMap(array &$aces)
445
441
* @param array $oidLookup
446
442
*
447
443
* @return \SplObjectStorage mapping object identities to ACL instances
448
- *
444
+ *
449
445
* @throws AclNotFoundException
450
446
*/
451
447
private function lookupObjectIdentities (array $ batch , array $ sids , array $ oidLookup )
0 commit comments