]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Refs #4269. Using ElggBatch to delete annotations / metadata again.
authorBrett Profitt <brett.profitt@gmail.com>
Wed, 25 Jan 2012 19:48:59 +0000 (11:48 -0800)
committerBrett Profitt <brett.profitt@gmail.com>
Wed, 25 Jan 2012 19:48:59 +0000 (11:48 -0800)
engine/lib/metastrings.php

index 62b60e279ef3e6cbaf7191c5356c1090e6960287..d7cc4e0bcd2ef4020a63039cc38fc26cd1843c6e 100644 (file)
@@ -727,38 +727,11 @@ function elgg_batch_metastring_based_objects(array $options, $callback) {
                return false;
        }
 
-       switch($options['metastring_type']) {
-               case 'metadata':
-                       $objects = elgg_get_metadata($options);
-                       break;
-
-               case 'annotations':
-                       $objects = elgg_get_annotations($options);
-                       break;
-
-               default:
-                       return false;
-       }
-
-       if (!is_array($objects)) {
-               $r = false;
-       } elseif (empty($objects)) {
-               // ElggBatch returns null if the results are an empty array
-               $r = null;
-       } else {
-               $r = true;
-               foreach($objects as $object) {
-                       $r = $r && $callback($object);
-               }
-       }
+       // @todo restore once ElggBatch supports callbacks that delete rows.
+       $batch = new ElggBatch('elgg_get_metastring_based_objects', $options, $callback, 50, false);
+       $r = $batch->callbackResult;
 
        return $r;
-
-//     // @todo restore once ElggBatch supports callbacks that delete rows.
-//     $batch = new ElggBatch('elgg_get_metastring_based_objects', $options, $callback);
-//     $r = $batch->callbackResult;
-//
-//     return $r;
 }
 
 /**