aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/entities.php
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2013-06-13 16:35:03 -0700
committerCash Costello <cash.costello@gmail.com>2013-06-13 16:35:03 -0700
commit9c322938db8b7c4cf87298f5f51fc3eed9450aeb (patch)
tree846260a21a15d709db58a3993706fd0c6556ba4c /engine/lib/entities.php
parent6d17bde6d059a5d0d5782719623317ec494b773b (diff)
parent8a47b2342e53c9cdf3093982486b19d6cc2f3e9b (diff)
downloadelgg-9c322938db8b7c4cf87298f5f51fc3eed9450aeb.tar.gz
elgg-9c322938db8b7c4cf87298f5f51fc3eed9450aeb.tar.bz2
Merge pull request #5592 from mrclay/5357
Fixes #5357: ElggBatch skips over incomplete entities
Diffstat (limited to 'engine/lib/entities.php')
-rw-r--r--engine/lib/entities.php14
1 files changed, 11 insertions, 3 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php
index d0d97aa95..072b26805 100644
--- a/engine/lib/entities.php
+++ b/engine/lib/entities.php
@@ -933,6 +933,8 @@ function elgg_get_entities(array $options = array()) {
'joins' => array(),
'callback' => 'entity_row_to_elggstar',
+
+ '__ElggBatch' => null,
);
$options = array_merge($defaults, $options);
@@ -1050,7 +1052,7 @@ function elgg_get_entities(array $options = array()) {
}
if ($options['callback'] === 'entity_row_to_elggstar') {
- $dt = _elgg_fetch_entities_from_sql($query);
+ $dt = _elgg_fetch_entities_from_sql($query, $options['__ElggBatch']);
} else {
$dt = get_data($query, $options['callback']);
}
@@ -1085,13 +1087,14 @@ function elgg_get_entities(array $options = array()) {
/**
* Return entities from an SQL query generated by elgg_get_entities.
*
- * @param string $sql
+ * @param string $sql
+ * @param ElggBatch $batch
* @return ElggEntity[]
*
* @access private
* @throws LogicException
*/
-function _elgg_fetch_entities_from_sql($sql) {
+function _elgg_fetch_entities_from_sql($sql, ElggBatch $batch = null) {
static $plugin_subtype;
if (null === $plugin_subtype) {
$plugin_subtype = get_subtype_id('object', 'plugin');
@@ -1168,6 +1171,11 @@ function _elgg_fetch_entities_from_sql($sql) {
} catch (IncompleteEntityException $e) {
// don't let incomplete entities throw fatal errors
unset($rows[$i]);
+
+ // report incompletes to the batch process that spawned this query
+ if ($batch) {
+ $batch->reportIncompleteEntity($row);
+ }
}
}
}