28require_once __DIR__ .
'/../autoload.php';
44 public static function autoload( $className ) {
62 $lowerClass = strtolower( $className );
64 if ( self::$autoloadLocalClassesLower ===
null ) {
68 if ( isset( self::$autoloadLocalClassesLower[$lowerClass] ) ) {
69 if ( function_exists(
'wfDebugLog' ) ) {
70 wfDebugLog(
'autoloader',
"Class {$className} was loaded using incorrect case" );
72 $filename = self::$autoloadLocalClassesLower[$lowerClass];
76 if ( !$filename && strpos( $className,
'\\' ) !==
false ) {
79 while ( ( $pos = strrpos( $prefix,
'\\' ) ) !==
false ) {
81 $prefix = substr( $className, 0, $pos + 1 );
82 if ( isset( self::$psr4Namespaces[$prefix] ) ) {
83 $relativeClass = substr( $className, $pos + 1 );
85 $file = self::$psr4Namespaces[$prefix] .
'/' .
86 str_replace(
'\\',
'/', $relativeClass ) .
'.php';
87 if ( file_exists(
$file ) ) {
94 $prefix = rtrim( $prefix,
'\\' );
104 if ( substr( $filename, 0, 1 ) !=
'/' && substr( $filename, 1, 1 ) !=
':' ) {
106 $filename =
"$IP/$filename";
117 self::$autoloadLocalClassesLower =
null;
132 'MediaWiki\\' => __DIR__ .
'/',
133 'MediaWiki\\Api\\' => __DIR__ .
'/api/',
134 'MediaWiki\\Auth\\' => __DIR__ .
'/auth/',
135 'MediaWiki\\Block\\' => __DIR__ .
'/block/',
136 'MediaWiki\\Cache\\' => __DIR__ .
'/cache/',
137 'MediaWiki\\ChangeTags\\' => __DIR__ .
'/changetags/',
138 'MediaWiki\\Config\\' => __DIR__ .
'/config/',
139 'MediaWiki\\Content\\' => __DIR__ .
'/content/',
140 'MediaWiki\\DB\\' => __DIR__ .
'/db/',
141 'MediaWiki\\Diff\\' => __DIR__ .
'/diff/',
142 'MediaWiki\\Edit\\' => __DIR__ .
'/edit/',
143 'MediaWiki\\EditPage\\' => __DIR__ .
'/editpage/',
144 'MediaWiki\\FileBackend\\LockManager\\' => __DIR__ .
'/filebackend/lockmanager/',
145 'MediaWiki\\Http\\' => __DIR__ .
'/http/',
146 'MediaWiki\\Installer\\' => __DIR__ .
'/installer/',
147 'MediaWiki\\Interwiki\\' => __DIR__ .
'/interwiki/',
148 'MediaWiki\\Linker\\' => __DIR__ .
'/linker/',
149 'MediaWiki\\Logger\\' => __DIR__ .
'/debug/logger/',
150 'MediaWiki\\Logger\Monolog\\' => __DIR__ .
'/debug/logger/monolog/',
151 'MediaWiki\\Page\\' => __DIR__ .
'/page/',
152 'MediaWiki\\Preferences\\' => __DIR__ .
'/preferences/',
153 'MediaWiki\\ResourceLoader\\' => __DIR__ .
'/resourceloader/',
154 'MediaWiki\\Search\\' => __DIR__ .
'/search/',
155 'MediaWiki\\Search\\SearchWidgets\\' => __DIR__ .
'/search/searchwidgets/',
156 'MediaWiki\\Session\\' => __DIR__ .
'/session/',
157 'MediaWiki\\Shell\\' => __DIR__ .
'/shell/',
158 'MediaWiki\\Site\\' => __DIR__ .
'/site/',
159 'MediaWiki\\Sparql\\' => __DIR__ .
'/sparql/',
160 'MediaWiki\\SpecialPage\\' => __DIR__ .
'/specialpage/',
161 'MediaWiki\\Tidy\\' => __DIR__ .
'/tidy/',
162 'MediaWiki\\User\\' => __DIR__ .
'/user/',
163 'MediaWiki\\Widget\\' => __DIR__ .
'/widget/',
164 'Wikimedia\\' => __DIR__ .
'/libs/',
165 'Wikimedia\\Http\\' => __DIR__ .
'/libs/http/',
166 'Wikimedia\\UUID\\' => __DIR__ .
'/libs/uuid/',
172spl_autoload_register( [
'AutoLoader',
'autoload' ] );
$wgAutoloadAttemptLowercase
Switch controlling legacy case-insensitive classloading.
$wgAutoloadClasses
Array mapping class names to filenames, for autoloading.
wfDebugLog( $logGroup, $text, $dest='all', array $context=[])
Send a line to a supplementary debug log file, if configured, or main debug log if not.
global $wgAutoloadLocalClasses
Locations of core classes Extension classes are specified with $wgAutoloadClasses This array is a glo...
static getAutoloadNamespaces()
Get a mapping of namespace => file path The namespaces should follow the PSR-4 standard for autoloadi...
static $autoloadLocalClassesLower
static string[] $psr4Namespaces
static autoload( $className)
autoload - take a class name and attempt to load it
static resetAutoloadLocalClassesLower()
Method to clear the protected class property $autoloadLocalClassesLower.
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file
Item class for a filearchive table row.