]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #4512. Passing inc_offset only for deleting / disabling callbacks in metastring...
authorBrett Profitt <brett.profitt@gmail.com>
Fri, 11 May 2012 03:09:15 +0000 (20:09 -0700)
committerBrett Profitt <brett.profitt@gmail.com>
Fri, 11 May 2012 03:09:15 +0000 (20:09 -0700)
engine/lib/annotations.php
engine/lib/metadata.php
engine/lib/metastrings.php

index 7383f5e043d100c244b610d9d0201b285241d41a..2036ccd612669258a3abb336866a2fa90b3177c1 100644 (file)
@@ -220,7 +220,7 @@ function elgg_delete_annotations(array $options) {
        }
 
        $options['metastring_type'] = 'annotations';
-       return elgg_batch_metastring_based_objects($options, 'elgg_batch_delete_callback');
+       return elgg_batch_metastring_based_objects($options, 'elgg_batch_delete_callback', false);
 }
 
 /**
@@ -238,7 +238,7 @@ function elgg_disable_annotations(array $options) {
        }
 
        $options['metastring_type'] = 'annotations';
-       return elgg_batch_metastring_based_objects($options, 'elgg_batch_disable_callback');
+       return elgg_batch_metastring_based_objects($options, 'elgg_batch_disable_callback', false);
 }
 
 /**
index 973d447f5e6465e6f222d43164a2045ffdd361c0..0ff3a43dc986b38da5fb9469a08a3697d5419ab5 100644 (file)
@@ -309,7 +309,7 @@ function elgg_delete_metadata(array $options) {
        }
 
        $options['metastring_type'] = 'metadata';
-       return elgg_batch_metastring_based_objects($options, 'elgg_batch_delete_callback');
+       return elgg_batch_metastring_based_objects($options, 'elgg_batch_delete_callback', false);
 }
 
 /**
@@ -329,7 +329,7 @@ function elgg_disable_metadata(array $options) {
        }
 
        $options['metastring_type'] = 'metadata';
-       return elgg_batch_metastring_based_objects($options, 'elgg_batch_disable_callback');
+       return elgg_batch_metastring_based_objects($options, 'elgg_batch_disable_callback', false);
 }
 
 /**
index 0c858c9d36d72c16ce2fd7f49209ffc72b565f1c..cf6dd4d987870e40e4b4bde25628e1293ba7ceea 100644 (file)
@@ -718,21 +718,21 @@ function elgg_set_metastring_based_object_enabled_by_id($id, $enabled, $type) {
  *
  * @warning This returns null on no ops.
  *
- * @param array  $options  An options array. {@See elgg_get_metastring_based_objects()}
- * @param string $callback The callback to pass each result through
- * @return mixed
+ * @param array  $options    An options array. {@See elgg_get_metastring_based_objects()}
+ * @param string $callback   The callback to pass each result through
+ * @param bool   $inc_offset Increment the offset? Pass false for callbacks that delete / disable
+ *
+ * @return bool|null true on success, false on failure, null if no objects are found.
  * @since 1.8.0
  * @access private
  */
-function elgg_batch_metastring_based_objects(array $options, $callback) {
+function elgg_batch_metastring_based_objects(array $options, $callback, $inc_offset = true) {
        if (!$options || !is_array($options)) {
                return false;
        }
 
-       $batch = new ElggBatch('elgg_get_metastring_based_objects', $options, $callback, 50, false);
-       $r = $batch->callbackResult;
-
-       return $r;
+       $batch = new ElggBatch('elgg_get_metastring_based_objects', $options, $callback, 50, $inc_offset);
+       return $batch->callbackResult;
 }
 
 /**