Minor optimization to the AutoLoader
authorAdam Roses Wight <awight@wikimedia.org>
Sun, 27 Oct 2013 05:59:01 +0000 (22:59 -0700)
committerTim Starling <tstarling@wikimedia.org>
Mon, 28 Oct 2013 21:39:57 +0000 (21:39 +0000)
commit7f51cf22f918089a0c9669a60c9c3fb92bbd16b8
treef554fc0067f3daed4b9cd253331103ba9a937fd5
parent22280a1e3b8bd8ad33bac75225a6c71d19780d36
Minor optimization to the AutoLoader

When MediaWiki autoloading fails, we should gracefully return false.
Instead, we have been calling strtolower roughly 1,000 times in the hope
of finding a case-insensitive match.

This patch preserves the legacy case-insensitivity, but improves its
performance by approximately 100x, by storing the case-insensitive class
lookups as a static variable.

There is a new global $wgAutoloadAttemptLowercase which will switch the
behavior if desired.  The default is to support case-insensitive loading.

Change-Id: Ifb12e05614a48390b730167e9d4ddcd8545db764
includes/AutoLoader.php
includes/DefaultSettings.php
tests/phpunit/data/autoloader/TestAutoloadedCamlClass.php [new file with mode: 0644]
tests/phpunit/data/autoloader/TestAutoloadedClass.php [new file with mode: 0644]
tests/phpunit/data/autoloader/TestAutoloadedLocalClass.php [new file with mode: 0644]
tests/phpunit/data/autoloader/TestAutoloadedSerializedClass.php [new file with mode: 0644]
tests/phpunit/structure/AutoLoaderTest.php