Skip to content

Commit

Permalink
MDL-27171 messages: fix static variable filtering bug in get_message_…
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
Ruslan Kabalin committed May 31, 2011
1 parent 298925d commit 72e6af0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions message/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 72e6af0

Please sign in to comment.