diff options
author | cash <cash.costello@gmail.com> | 2013-05-30 21:04:09 -0400 |
---|---|---|
committer | cash <cash.costello@gmail.com> | 2013-05-30 21:04:09 -0400 |
commit | bbf99434e13ebf304fb15a8c5b9d70c621f38c86 (patch) | |
tree | a3163ae4df9c24f00fda3ac118826dbce3545516 /engine/lib/metastrings.php | |
parent | a9709da4bd45ea04944d93e0d472aa4ee801e0f5 (diff) | |
download | elgg-bbf99434e13ebf304fb15a8c5b9d70c621f38c86.tar.gz elgg-bbf99434e13ebf304fb15a8c5b9d70c621f38c86.tar.bz2 |
Fixes #5564 count works with elgg_get_entities_from_annotation_calculation()
Diffstat (limited to 'engine/lib/metastrings.php')
-rw-r--r-- | engine/lib/metastrings.php | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/engine/lib/metastrings.php b/engine/lib/metastrings.php index 39a81c6d0..57d876c06 100644 --- a/engine/lib/metastrings.php +++ b/engine/lib/metastrings.php @@ -425,7 +425,7 @@ function elgg_get_metastring_based_objects($options) { $wheres[] = get_access_sql_suffix('n_table'); } - if ($options['metastring_calculation'] === ELGG_ENTITIES_NO_VALUE) { + if ($options['metastring_calculation'] === ELGG_ENTITIES_NO_VALUE && !$options['count']) { $selects = array_unique($selects); // evalutate selects $select_str = ''; @@ -436,6 +436,9 @@ function elgg_get_metastring_based_objects($options) { } $query = "SELECT DISTINCT n_table.*{$select_str} FROM {$db_prefix}$type n_table"; + } elseif ($options['count']) { + // count is over the entities + $query = "SELECT count(DISTINCT e.guid) as calculation FROM {$db_prefix}$type n_table"; } else { $query = "SELECT {$options['metastring_calculation']}(v.string) as calculation FROM {$db_prefix}$type n_table"; } @@ -464,7 +467,7 @@ function elgg_get_metastring_based_objects($options) { $defaults['order_by']); } - if ($options['metastring_calculation'] === ELGG_ENTITIES_NO_VALUE) { + if ($options['metastring_calculation'] === ELGG_ENTITIES_NO_VALUE && !$options['count']) { if (isset($options['group_by'])) { $options['group_by'] = sanitise_string($options['group_by']); $query .= " GROUP BY {$options['group_by']}"; |