]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
#5952 - fix infinite loop when disabling > 50 annotations or metadata
authorMatt Beckett <beck24@gmail.com>
Thu, 10 Oct 2013 20:29:50 +0000 (13:29 -0700)
committerPaweł Sroka <srokap@gmail.com>
Sun, 27 Oct 2013 12:07:37 +0000 (13:07 +0100)
engine/lib/annotations.php
engine/lib/metadata.php

index 124e67e0f1d47eda21761a5aba27d5b1694d7245..5e9b530debc005dc2d629cb9013035bd19d990c5 100644 (file)
@@ -249,9 +249,13 @@ function elgg_disable_annotations(array $options) {
        if (!elgg_is_valid_options_for_batch_operation($options, 'annotations')) {
                return false;
        }
+       
+       // if we can see hidden (disabled) we need to use the offset
+       // otherwise we risk an infinite loop if there are more than 50
+       $inc_offset = access_get_show_hidden_status();
 
        $options['metastring_type'] = 'annotations';
-       return elgg_batch_metastring_based_objects($options, 'elgg_batch_disable_callback', false);
+       return elgg_batch_metastring_based_objects($options, 'elgg_batch_disable_callback', $inc_offset);
 }
 
 /**
index d2f8d4cd45e77e81cd1864c9e3bc303da79bdcf8..fdb1b85f6b79ba02b8846aa68368c77a6c3b7510 100644 (file)
@@ -333,9 +333,13 @@ function elgg_disable_metadata(array $options) {
        }
 
        elgg_get_metadata_cache()->invalidateByOptions('disable', $options);
+       
+       // if we can see hidden (disabled) we need to use the offset
+       // otherwise we risk an infinite loop if there are more than 50
+       $inc_offset = access_get_show_hidden_status();
 
        $options['metastring_type'] = 'metadata';
-       return elgg_batch_metastring_based_objects($options, 'elgg_batch_disable_callback', false);
+       return elgg_batch_metastring_based_objects($options, 'elgg_batch_disable_callback', $inc_offset);
 }
 
 /**