diff options
author | Steve Clay <steve@mrclay.org> | 2012-11-26 01:32:46 -0500 |
---|---|---|
committer | Steve Clay <steve@mrclay.org> | 2012-11-26 01:32:46 -0500 |
commit | 3a3027ac4bf011873a8b08d56c19fa1379cd0a07 (patch) | |
tree | 3a6d62188d5e2d08e19e715fb4e361449a33315d /engine/lib/river.php | |
parent | 646c0c13b75efb55940245e27ad5c281a8eadd67 (diff) | |
download | elgg-3a3027ac4bf011873a8b08d56c19fa1379cd0a07.tar.gz elgg-3a3027ac4bf011873a8b08d56c19fa1379cd0a07.tar.bz2 |
river prefetch: Don't call elgg_get_entities if no GUIDs to fetch
Diffstat (limited to 'engine/lib/river.php')
-rw-r--r-- | engine/lib/river.php | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/engine/lib/river.php b/engine/lib/river.php index 133ef6de9..33f34360e 100644 --- a/engine/lib/river.php +++ b/engine/lib/river.php @@ -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, + )); + } } /** |