Wikimedia
Avoid using array_map in ExtensionRegistry and ExtensionProcessor for simple operations
In MediaWiki core's includes/registration/
directory, there are a few (two I think) places we use array_map
for very simple operations:
$this->globals["wgExtensionMessagesFiles"] += array_map( function ( $file ) use ( $dir ) {
return "$dir/$file";
}, $info['ExtensionMessagesFiles'] );
Since these are quick operations, we can make this code faster by using a foreach
loop instead of array_map
with a closure (unnecessary function calls are expensive).
- https://secure.php.net/manual/en/function.array-map.php
- https://secure.php.net/manual/en/control-structures.foreach.php
You are expected to provide a patch in Wikimedia Gerrit. See https://www.mediawiki.org/wiki/Gerrit/Tutorial for how to set up Git and Gerrit.
Task tags
Students who completed this task
Yifei He