]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #4393 working around the overloaded 'count' parameter
authorcash <cash.costello@gmail.com>
Wed, 6 Mar 2013 21:51:20 +0000 (16:51 -0500)
committercash <cash.costello@gmail.com>
Wed, 6 Mar 2013 21:51:20 +0000 (16:51 -0500)
engine/lib/annotations.php
engine/lib/metadata.php
engine/lib/metastrings.php

index f40a2cc6fc41baa033bcf405cf52eccf68e6eabd..bd5ea1a1fed8bdfe48372c97c4b24dc512955d62 100644 (file)
@@ -200,6 +200,18 @@ function update_annotation($annotation_id, $name, $value, $value_type, $owner_gu
  * @since 1.8.0
  */
 function elgg_get_annotations(array $options = array()) {
+
+       // @todo remove support for count shortcut - see #4393
+       if (isset($options['__egefac']) && $options['__egefac']) {
+               unset($options['__egefac']);
+       } else {
+               // support shortcut of 'count' => true for 'annotation_calculation' => 'count'
+               if (isset($options['count']) && $options['count']) {
+                       $options['annotation_calculation'] = 'count';
+                       unset($options['count']);
+               }               
+       }
+       
        $options['metastring_type'] = 'annotations';
        return elgg_get_metastring_based_objects($options);
 }
@@ -425,6 +437,10 @@ function elgg_get_entities_from_annotation_calculation($options) {
 
        $options['callback'] = 'entity_row_to_elggstar';
 
+       // see #4393
+       // @todo remove after the 'count' shortcut is removed from elgg_get_annotations()
+       $options['__egefac'] = true;
+
        return elgg_get_annotations($options);
 }
 
index 35b7b4dfb9cdfddf36a5b436b7303cbf05a87549..96d4460600f19818dcd6dcb11f4543e25b8f87b0 100644 (file)
@@ -281,6 +281,14 @@ $access_id = ACCESS_PRIVATE, $allow_multiple = false) {
  * @since 1.8.0
  */
 function elgg_get_metadata(array $options = array()) {
+
+       // @todo remove support for count shortcut - see #4393
+       // support shortcut of 'count' => true for 'metadata_calculation' => 'count'
+       if (isset($options['count']) && $options['count']) {
+               $options['metadata_calculation'] = 'count';
+               unset($options['count']);
+       }
+
        $options['metastring_type'] = 'metadata';
        return elgg_get_metastring_based_objects($options);
 }
index 76c4bd8c439f9795a0f9dea68ffde20ea0a50465..f49b4a163cb30ed272a904845c3505e6972b378a 100644 (file)
@@ -389,11 +389,6 @@ function elgg_get_metastring_based_objects($options) {
 
        $selects = $options['selects'];
 
-       // allow count shortcut
-       if ($options['count']) {
-               $options['metastring_calculation'] = 'count';
-       }
-
        // For performance reasons we don't want the joins required for metadata / annotations
        // unless we're going through one of their callbacks.
        // this means we expect the functions passing different callbacks to pass their required joins.