29require_once __DIR__ .
'/../autoload.php';
46 public static function find( $className ): ?string {
57 if ( self::$autoloadLocalClassesLower ===
null ) {
60 $lowerClass = strtolower( $className );
61 if ( isset( self::$autoloadLocalClassesLower[$lowerClass] ) ) {
62 if ( function_exists(
'wfDebugLog' ) ) {
63 wfDebugLog(
'autoloader',
"Class {$className} was loaded using incorrect case" );
65 $filename = self::$autoloadLocalClassesLower[$lowerClass];
69 if ( !$filename && strpos( $className,
'\\' ) !==
false ) {
72 while ( ( $pos = strrpos( $prefix,
'\\' ) ) !==
false ) {
74 $prefix = substr( $className, 0, $pos + 1 );
75 if ( isset( self::$psr4Namespaces[$prefix] ) ) {
76 $relativeClass = substr( $className, $pos + 1 );
78 $file = self::$psr4Namespaces[$prefix] .
80 strtr( $relativeClass,
'\\',
'/' ) .
82 if ( file_exists(
$file ) ) {
89 $prefix = rtrim( $prefix,
'\\' );
100 if ( $filename[0] !==
'/' && $filename[1] !==
':' ) {
102 $filename =
"$IP/$filename";
114 $filename = self::find( $className );
116 if ( $filename !==
null ) {
126 self::$autoloadLocalClassesLower =
null;
141 'MediaWiki\\' => __DIR__ .
'/',
142 'MediaWiki\\Actions\\' => __DIR__ .
'/actions/',
143 'MediaWiki\\Api\\' => __DIR__ .
'/api/',
144 'MediaWiki\\Auth\\' => __DIR__ .
'/auth/',
145 'MediaWiki\\Block\\' => __DIR__ .
'/block/',
146 'MediaWiki\\Cache\\' => __DIR__ .
'/cache/',
147 'MediaWiki\\ChangeTags\\' => __DIR__ .
'/changetags/',
148 'MediaWiki\\Config\\' => __DIR__ .
'/config/',
149 'MediaWiki\\Content\\' => __DIR__ .
'/content/',
150 'MediaWiki\\DB\\' => __DIR__ .
'/db/',
151 'MediaWiki\\Diff\\' => __DIR__ .
'/diff/',
152 'MediaWiki\\Edit\\' => __DIR__ .
'/edit/',
153 'MediaWiki\\EditPage\\' => __DIR__ .
'/editpage/',
154 'MediaWiki\\FileBackend\\LockManager\\' => __DIR__ .
'/filebackend/lockmanager/',
155 'MediaWiki\\JobQueue\\' => __DIR__ .
'/jobqueue/',
156 'MediaWiki\\Json\\' => __DIR__ .
'/json/',
157 'MediaWiki\\Http\\' => __DIR__ .
'/http/',
158 'MediaWiki\\Installer\\' => __DIR__ .
'/installer/',
159 'MediaWiki\\Interwiki\\' => __DIR__ .
'/interwiki/',
160 'MediaWiki\\Languages\\Data\\' => __DIR__ .
'/languages/data/',
161 'MediaWiki\\Linker\\' => __DIR__ .
'/linker/',
162 'MediaWiki\\Logger\\' => __DIR__ .
'/debug/logger/',
163 'MediaWiki\\Logger\Monolog\\' => __DIR__ .
'/debug/logger/monolog/',
164 'MediaWiki\\Mail\\' => __DIR__ .
'/mail/',
165 'MediaWiki\\Page\\' => __DIR__ .
'/page/',
166 'MediaWiki\\Preferences\\' => __DIR__ .
'/preferences/',
167 'MediaWiki\\ResourceLoader\\' => __DIR__ .
'/resourceloader/',
168 'MediaWiki\\Search\\' => __DIR__ .
'/search/',
169 'MediaWiki\\Search\\SearchWidgets\\' => __DIR__ .
'/search/searchwidgets/',
170 'MediaWiki\\Session\\' => __DIR__ .
'/session/',
171 'MediaWiki\\Shell\\' => __DIR__ .
'/shell/',
172 'MediaWiki\\Site\\' => __DIR__ .
'/site/',
173 'MediaWiki\\Sparql\\' => __DIR__ .
'/sparql/',
174 'MediaWiki\\SpecialPage\\' => __DIR__ .
'/specialpage/',
175 'MediaWiki\\Tidy\\' => __DIR__ .
'/tidy/',
176 'MediaWiki\\User\\' => __DIR__ .
'/user/',
177 'MediaWiki\\Widget\\' => __DIR__ .
'/widget/',
178 'Wikimedia\\' => __DIR__ .
'/libs/',
179 'Wikimedia\\Http\\' => __DIR__ .
'/libs/http/',
180 'Wikimedia\\UUID\\' => __DIR__ .
'/libs/uuid/',
186spl_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.
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 find( $className)
Find the file containing the given class.
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.