diff options
author | Brett Profitt <brett.profitt@gmail.com> | 2012-01-22 13:02:53 -0800 |
---|---|---|
committer | Brett Profitt <brett.profitt@gmail.com> | 2012-01-22 13:02:53 -0800 |
commit | 8d62572ff8c2b5bde2c2a933c5b0268d5984a879 (patch) | |
tree | 5b1e742056957f042e7bba05479b1979b279439e | |
parent | 673a7bedf097289b2885c7bd35b2d46b612d67dc (diff) | |
download | elgg-8d62572ff8c2b5bde2c2a933c5b0268d5984a879.tar.gz elgg-8d62572ff8c2b5bde2c2a933c5b0268d5984a879.tar.bz2 |
Fixes #4321. Limit alone is no longer valid for batch delete operations for metadata or annotations.
-rw-r--r-- | engine/lib/annotations.php | 4 | ||||
-rw-r--r-- | engine/lib/elgglib.php | 2 | ||||
-rw-r--r-- | engine/lib/metadata.php | 4 | ||||
-rw-r--r-- | engine/tests/api/metastrings.php | 6 |
4 files changed, 11 insertions, 5 deletions
diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php index 5049d455b..f32dee0f0 100644 --- a/engine/lib/annotations.php +++ b/engine/lib/annotations.php @@ -209,9 +209,11 @@ function elgg_get_annotations(array $options = array()) { * Deletes annotations based on $options. * * @warning Unlike elgg_get_annotations() this will not accept an empty options array! + * This requires at least one constraint: annotation_owner_guid(s), + * annotation_name(s), annotation_value(s), or guid(s) must be set. * * @param array $options An options array. {@See elgg_get_annotations()} - * @return mixed + * @return mixed Null if the metadata name is invalid. Bool on success or fail. * @since 1.8.0 */ function elgg_delete_annotations(array $options) { diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 38ae73d82..5a8c89a56 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -1970,7 +1970,7 @@ function elgg_is_valid_options_for_batch_operation($options, $type) { // at least one of these is required. $required = array( // generic restraints - 'guid', 'guids', 'limit' + 'guid', 'guids' ); switch ($type) { diff --git a/engine/lib/metadata.php b/engine/lib/metadata.php index f543c0fd0..012c73ad9 100644 --- a/engine/lib/metadata.php +++ b/engine/lib/metadata.php @@ -294,8 +294,8 @@ function elgg_get_metadata(array $options = array()) { * Deletes metadata based on $options. * * @warning Unlike elgg_get_metadata() this will not accept an empty options array! - * This requires at least one constraints: metadata_owner_guid(s), - * metadata_name(s), metadata_value(s), guid(s), or limit must be set. + * This requires at least one constraint: metadata_owner_guid(s), + * metadata_name(s), metadata_value(s), or guid(s) must be set. * * @param array $options An options array. {@see elgg_get_metadata()} * @return mixed Null if the metadata name is invalid. Bool on success or fail. diff --git a/engine/tests/api/metastrings.php b/engine/tests/api/metastrings.php index a96388217..0a8945084 100644 --- a/engine/tests/api/metastrings.php +++ b/engine/tests/api/metastrings.php @@ -132,7 +132,7 @@ class ElggCoreMetastringsTest extends ElggCoreUnitTest { public function testKeepMeFromDeletingEverything() { foreach ($this->metastringTypes as $type) { $required = array( - 'guid', 'guids', 'limit' + 'guid', 'guids' ); switch ($type) { @@ -160,6 +160,10 @@ class ElggCoreMetastringsTest extends ElggCoreUnitTest { $options = array(); $this->assertFalse(elgg_is_valid_options_for_batch_operation($options, $type)); + // limit alone isn't valid: + $options = array('limit' => 10); + $this->assertFalse(elgg_is_valid_options_for_batch_operation($options, $type)); + foreach ($required as $key) { $options = array(); |