MDL-27171 messages: fix static variable filtering bug in get_message_processors

Static $processors should contain the full list of processors only, when
filtering is required, the $processors variable should not be updated.

Lambda function refactoring is made as well.

Signed-off-by: Ruslan Kabalin <ruslan.kabalin@luns.net.uk>
This commit is contained in:
Ruslan Kabalin 2011-05-31 11:18:11 +01:00
parent 298925d4d1
commit 72e6af0344

View file

@ -2286,8 +2286,14 @@ function get_message_processors($ready = false) {
}
}
if ($ready) {
// Filter out enabled, available and system_configured processors only.
$processors = array_filter($processors, create_function('$a', 'return $a->enabled && $a->configured;'));
// Filter out enabled and system_configured processors
$readyprocessors = $processors;
foreach ($readyprocessors as $readyprocessor) {
if (!($readyprocessor->enabled && $readyprocessor->configured)) {
unset($readyprocessors[$readyprocessor->name]);
}
}
return $readyprocessors;
}
return $processors;