]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #4321. Limit alone is no longer valid for batch delete operations for metadata...
authorBrett Profitt <brett.profitt@gmail.com>
Sun, 22 Jan 2012 21:02:53 +0000 (13:02 -0800)
committerBrett Profitt <brett.profitt@gmail.com>
Sun, 22 Jan 2012 21:02:53 +0000 (13:02 -0800)
engine/lib/annotations.php
engine/lib/elgglib.php
engine/lib/metadata.php
engine/tests/api/metastrings.php

index 5049d455b1b4ab98e7bef4f25643c3ef4e284651..f32dee0f08b98840589e82012bb3d1a61ecc8820 100644 (file)
@@ -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) {
index 38ae73d82b6762d473ef75b9bc9b7ddf5e6bb806..5a8c89a5679c35f6e38cd3a9cc4e4f1a7080be2b 100644 (file)
@@ -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) {
index f543c0fd0a30a1832f7c44b01f240e0a96e14f09..012c73ad921a1ab2c4cbb4d9931d79a86e6f9e84 100644 (file)
@@ -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.
index a96388217a99d077d958a19120011173e41c82fa..0a8945084faab682dd71618d398ed8e6d7f94649 100644 (file)
@@ -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();