Active
Project:
New Aggregator for Drupal core
Version:
7.x-0.1-alpha2
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
21 Jul 2008 at 18:06 UTC
Updated:
21 Jul 2008 at 18:10 UTC
Now overridable deduping depends on a special variable:
// aggregator.module
foreach ($processors as $processor) {
if (count($processors) == 1 && $deduper != FALSE) {
module_invoke($deduper, 'aggregator_process', 'unique', $node);
}
else {
module_invoke($processor, 'aggregator_process', 'unique', $node);
}
$items = module_invoke($processor, 'aggregator_process', 'save', $node);
// a processor, e. g. aggregator.light.inc
case 'unique':
// ...
$node->feed->items[$k]->unique = ($iid == FALSE ? TRUE : $iid);
This is not necessary if all unique hooks are called before saving, and the unique flag is converted into an array of unique flags:
// aggregator.module
foreach ($processors as $processor) {
module_invoke($processor, 'aggregator_process', 'unique', $node);
}
foreach ($processors as $processor) {
$items = module_invoke($processor, 'aggregator_process', 'save', $node);
}
// a processor, e. g. aggregator.light.inc
case 'unique':
// ...
$node->feed->items[$k]->unique['aggregator_light'] = ($iid == FALSE ? TRUE : $iid);
This change makes deduping overridable and reusable for other modules without the necessity of an additional system variable. An important detail here is that the order of $processors must respect the module weights. I think at the moment it doesn't. This will allow site builders and module contributors to tweak and reuse unique flags for specific use cases.
Comments
Comment #1
alex_b commented