aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrett Profitt <brett.profitt@gmail.com>2012-05-10 20:09:15 -0700
committerBrett Profitt <brett.profitt@gmail.com>2012-05-10 20:09:15 -0700
commit1c810fd7d66e3b5121edeba1bf5bf7d118625931 (patch)
tree229814a5b3691b96fb62962ce6808f3e9285916d
parent25b1a1ea11182b6fc195f4cca76ec4788d79c65e (diff)
downloadelgg-1c810fd7d66e3b5121edeba1bf5bf7d118625931.tar.gz
elgg-1c810fd7d66e3b5121edeba1bf5bf7d118625931.tar.bz2
Fixes #4512. Passing inc_offset only for deleting / disabling callbacks in metastring functions.
-rw-r--r--engine/lib/annotations.php4
-rw-r--r--engine/lib/metadata.php4
-rw-r--r--engine/lib/metastrings.php16
3 files changed, 12 insertions, 12 deletions
diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php
index 7383f5e04..2036ccd61 100644
--- a/engine/lib/annotations.php
+++ b/engine/lib/annotations.php
@@ -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);
}
/**
diff --git a/engine/lib/metadata.php b/engine/lib/metadata.php
index 973d447f5..0ff3a43dc 100644
--- a/engine/lib/metadata.php
+++ b/engine/lib/metadata.php
@@ -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);
}
/**
diff --git a/engine/lib/metastrings.php b/engine/lib/metastrings.php
index 0c858c9d3..cf6dd4d98 100644
--- a/engine/lib/metastrings.php
+++ b/engine/lib/metastrings.php
@@ -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;
}
/**