]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
river prefetch: Don't call elgg_get_entities if no GUIDs to fetch
authorSteve Clay <steve@mrclay.org>
Mon, 26 Nov 2012 06:32:46 +0000 (01:32 -0500)
committerSteve Clay <steve@mrclay.org>
Mon, 26 Nov 2012 06:32:46 +0000 (01:32 -0500)
engine/lib/river.php

index 133ef6de919e15f4a6299d94739ea1bd402d5107..33f34360e637eab56f72844d9269944306b529f0 100644 (file)
@@ -387,14 +387,16 @@ function _elgg_prefetch_river_entities(array $river_items) {
                        $guids[$item->object_guid] = true;
                }
        }
-       // avoid creating oversized query
-       // @todo how to better handle this?
-       $guids = array_slice($guids, 0, 300, true);
-       // return value unneeded, just priming cache
-       elgg_get_entities(array(
-               'guids' => array_keys($guids),
-               'limit' => 0,
-       ));
+       if ($guids) {
+               // avoid creating oversized query
+               // @todo how to better handle this?
+               $guids = array_slice($guids, 0, 300, true);
+               // return value unneeded, just priming cache
+               elgg_get_entities(array(
+                       'guids' => array_keys($guids),
+                       'limit' => 0,
+               ));
+       }
 
        // prefetch object containers
        $guids = array();
@@ -404,11 +406,13 @@ function _elgg_prefetch_river_entities(array $river_items) {
                        $guids[$object->container_guid] = true;
                }
        }
-       $guids = array_slice($guids, 0, 300, true);
-       elgg_get_entities(array(
-               'guids' => array_keys($guids),
-               'limit' => 0,
-       ));
+       if ($guids) {
+               $guids = array_slice($guids, 0, 300, true);
+               elgg_get_entities(array(
+                       'guids' => array_keys($guids),
+                       'limit' => 0,
+               ));
+       }
 }
 
 /**