r44302 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44301‎ | r44302 | r44303 >
Date:11:48, 8 December 2008
Author:aaron
Status:reverted (Comments)
Tags:
Comment:
Tweak r44296: use autoloader if it is set there
Modified paths:
  • /trunk/phase3/includes/Skin.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Skin.php
@@ -123,7 +123,7 @@
124124 * @static
125125 */
126126 static function &newFromKey( $key ) {
127 - global $wgStyleDirectory;
 127+ global $wgStyleDirectory, $wgAutoloadClasses;
128128
129129 $key = Skin::normalizeKey( $key );
130130
@@ -132,7 +132,8 @@
133133 $className = 'Skin'.ucfirst($key);
134134
135135 # Grab the skin class and initialise it.
136 - if ( !class_exists( $className, false ) ) {
 136+ # Use autoloader if it is set in $wgAutoloadClasses.
 137+ if( !class_exists( $className, isset($wgAutoloadClasses[$className]) ) ) {
137138 // Preload base classes to work around APC/PHP5 bug
138139 $deps = "{$wgStyleDirectory}/{$skinName}.deps.php";
139140 if( file_exists( $deps ) ) include_once( $deps );

Follow-up revisions

RevisionCommit summaryAuthorDate
r44435Revert part of r44296 "*Skip autoloading of skin, always does inefficient str...brion23:39, 10 December 2008

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r44296*Skip autoloading of skin, always does inefficient strtolower() stuff and fai...aaron00:35, 8 December 2008

Comments

#Comment by Brion VIBBER (talk | contribs)   23:39, 10 December 2008

Reverted in r44435.

Unless there's some really huge overriding reason to do this, there's no point poking around in the autoloader's guts to try to outsmart it. Just let it take a few nanoseconds to check its array and don't add yourself a dependency on its implementation details.

If there *is* some really huge overriding reason to complicate the code, please provide some data supporting it.

Status & tagging log