public function filterMetadataHeavyEntities(array $guids, $limit = 1024000)
{
$db_prefix = _elgg_services()->config->get('dbprefix');
$options = array('guids' => $guids, 'limit' => 0, 'callback' => false, 'selects' => array('SUM(LENGTH(n_table.value)) AS bytes'), 'order_by' => 'n_table.entity_guid, n_table.time_created ASC', 'group_by' => 'n_table.entity_guid');
$data = _elgg_services()->metadataTable->getAll($options);
// don't cache if metadata for entity is over 10MB (or rolled INT)
foreach ($data as $row) {
if ($row->bytes > $limit || $row->bytes < 0) {
array_splice($guids, array_search($row->entity_guid, $guids), 1);
}
}
return $guids;
}