r44296 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44295‎ | r44296 | r44297 >
Date:00:35, 8 December 2008
Author:aaron
Status:resolved (Comments)
Tags:
Comment:
*Skip autoloading of skin, always does inefficient strtolower() stuff and fails (returns false) anyway
*Add wfDebug() call on class load failure
Modified paths:
  • /trunk/phase3/includes/AutoLoader.php (modified) (history)
  • /trunk/phase3/includes/Skin.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/AutoLoader.php
@@ -554,6 +554,7 @@
555555 }
556556 }
557557 if ( !$filename ) {
 558+ wfDebug( "Class {$className} not found; skipped loading" );
558559 # Give up
559560 wfProfileOut( __METHOD__ );
560561 return false;
Index: trunk/phase3/includes/Skin.php
@@ -132,7 +132,7 @@
133133 $className = 'Skin'.ucfirst($key);
134134
135135 # Grab the skin class and initialise it.
136 - if ( !class_exists( $className ) ) {
 136+ if ( !class_exists( $className, false ) ) {
137137 // Preload base classes to work around APC/PHP5 bug
138138 $deps = "{$wgStyleDirectory}/{$skinName}.deps.php";
139139 if( file_exists( $deps ) ) include_once( $deps );

Follow-up revisions

RevisionCommit summaryAuthorDate
r44302Tweak r44296: use autoloader if it is set thereaaron11:48, 8 December 2008
r44435Revert part of r44296 "*Skip autoloading of skin, always does inefficient str...brion23:39, 10 December 2008

Comments

#Comment by IAlex (talk | contribs)   11:17, 8 December 2008

This broke extension's skins (such as the ones in /trunk/extensions/skins/) since they're autoloaded.

#Comment by Aaron Schulz (talk | contribs)   11:48, 8 December 2008

Ugh, inconsistency. Tweaked in r44302.

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

Partially 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