Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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>
  • Loading branch information...
commit 72e6af034447c7ca220e7dab35ed68c87522f2f0 1 parent 298925d
Ruslan Kabalin authored
Showing with 8 additions and 2 deletions.
  1. +8 −2 message/lib.php
View
10 message/lib.php
@@ -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;
Please sign in to comment.
Something went wrong with that request. Please try again.