Skip to content

Commit

Permalink
Fixes Elgg#4512. Passing inc_offset only for deleting / disabling cal…
Browse files Browse the repository at this point in the history
…lbacks in metastring functions.
  • Loading branch information
brettp committed May 11, 2012
1 parent 25b1a1e commit 1c810fd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions engine/lib/annotations.php
Expand Up @@ -220,7 +220,7 @@ function elgg_delete_annotations(array $options) {
} }


$options['metastring_type'] = 'annotations'; $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);
} }


/** /**
Expand All @@ -238,7 +238,7 @@ function elgg_disable_annotations(array $options) {
} }


$options['metastring_type'] = 'annotations'; $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);
} }


/** /**
Expand Down
4 changes: 2 additions & 2 deletions engine/lib/metadata.php
Expand Up @@ -309,7 +309,7 @@ function elgg_delete_metadata(array $options) {
} }


$options['metastring_type'] = 'metadata'; $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);
} }


/** /**
Expand All @@ -329,7 +329,7 @@ function elgg_disable_metadata(array $options) {
} }


$options['metastring_type'] = 'metadata'; $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);
} }


/** /**
Expand Down
16 changes: 8 additions & 8 deletions engine/lib/metastrings.php
Expand Up @@ -718,21 +718,21 @@ function elgg_set_metastring_based_object_enabled_by_id($id, $enabled, $type) {
* *
* @warning This returns null on no ops. * @warning This returns null on no ops.
* *
* @param array $options An options array. {@See elgg_get_metastring_based_objects()} * @param array $options An options array. {@See elgg_get_metastring_based_objects()}
* @param string $callback The callback to pass each result through * @param string $callback The callback to pass each result through
* @return mixed * @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 * @since 1.8.0
* @access private * @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)) { if (!$options || !is_array($options)) {
return false; return false;
} }


$batch = new ElggBatch('elgg_get_metastring_based_objects', $options, $callback, 50, false); $batch = new ElggBatch('elgg_get_metastring_based_objects', $options, $callback, 50, $inc_offset);
$r = $batch->callbackResult; return $batch->callbackResult;

return $r;
} }


/** /**
Expand Down

0 comments on commit 1c810fd

Please sign in to comment.