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).

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

  • php

Students who completed this task

Yifei He

Task type

  • code Code
close

2017