summaryrefslogtreecommitdiff
path: root/includes/AutoLoader.php
blob: 3d7bcdf34b623255962055b87726b6db004fb9c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
<?php

/* This defines autoloading handler for whole MediaWiki framework */

ini_set('unserialize_callback_func', '__autoload' );

function __autoload($className) {
	global $wgAutoloadClasses;

	static $localClasses = array(
		# Includes
		'AjaxDispatcher' => 'includes/AjaxDispatcher.php',
		'AjaxCachePolicy' => 'includes/AjaxFunctions.php',
		'AjaxResponse' => 'includes/AjaxResponse.php',
		'AlphabeticPager' => 'includes/Pager.php',
		'Article' => 'includes/Article.php',
		'AuthPlugin' => 'includes/AuthPlugin.php',
		'BagOStuff' => 'includes/BagOStuff.php',
		'HashBagOStuff' => 'includes/BagOStuff.php',
		'SqlBagOStuff' => 'includes/BagOStuff.php',
		'MediaWikiBagOStuff' => 'includes/BagOStuff.php',
		'TurckBagOStuff' => 'includes/BagOStuff.php',
		'APCBagOStuff' => 'includes/BagOStuff.php',
		'eAccelBagOStuff' => 'includes/BagOStuff.php',
		'DBABagOStuff' => 'includes/BagOStuff.php',
		'Block' => 'includes/Block.php',
		'HTMLFileCache' => 'includes/HTMLFileCache.php',
		'DependencyWrapper' => 'includes/CacheDependency.php',
		'FileDependency' => 'includes/CacheDependency.php',
		'TitleDependency' => 'includes/CacheDependency.php',
		'TitleListDependency' => 'includes/CacheDependency.php',
		'CategoryPage' => 'includes/CategoryPage.php',
		'CategoryViewer' => 'includes/CategoryPage.php',
		'Categoryfinder' => 'includes/Categoryfinder.php',
		'RCCacheEntry' => 'includes/ChangesList.php',
		'ChangesList' => 'includes/ChangesList.php',
		'OldChangesList' => 'includes/ChangesList.php',
		'EnhancedChangesList' => 'includes/ChangesList.php',
		'CoreParserFunctions' => 'includes/CoreParserFunctions.php',
		'DBObject' => 'includes/Database.php',
		'Database' => 'includes/Database.php',
		'DatabaseMysql' => 'includes/Database.php',
		'ResultWrapper' => 'includes/Database.php',
		'DatabasePostgres' => 'includes/DatabasePostgres.php',
		'DatabaseOracle' => 'includes/DatabaseOracle.php',
		'DateFormatter' => 'includes/DateFormatter.php',
		'DifferenceEngine' => 'includes/DifferenceEngine.php',
		'_DiffOp' => 'includes/DifferenceEngine.php',
		'_DiffOp_Copy' => 'includes/DifferenceEngine.php',
		'_DiffOp_Delete' => 'includes/DifferenceEngine.php',
		'_DiffOp_Add' => 'includes/DifferenceEngine.php',
		'_DiffOp_Change' => 'includes/DifferenceEngine.php',
		'_DiffEngine' => 'includes/DifferenceEngine.php',
		'Diff' => 'includes/DifferenceEngine.php',
		'MappedDiff' => 'includes/DifferenceEngine.php',
		'DiffFormatter' => 'includes/DifferenceEngine.php',
		'DjVuImage' => 'includes/DjVuImage.php',
		'_HWLDF_WordAccumulator' => 'includes/DifferenceEngine.php',
		'WordLevelDiff' => 'includes/DifferenceEngine.php',
		'TableDiffFormatter' => 'includes/DifferenceEngine.php',
		'EditPage' => 'includes/EditPage.php',
		'MWException' => 'includes/Exception.php',
		'Exif' => 'includes/Exif.php',
		'FormatExif' => 'includes/Exif.php',
		'WikiExporter' => 'includes/Export.php',
		'XmlDumpWriter' => 'includes/Export.php',
		'DumpOutput' => 'includes/Export.php',
		'DumpFileOutput' => 'includes/Export.php',
		'DumpPipeOutput' => 'includes/Export.php',
		'DumpGZipOutput' => 'includes/Export.php',
		'DumpBZip2Output' => 'includes/Export.php',
		'Dump7ZipOutput' => 'includes/Export.php',
		'DumpFilter' => 'includes/Export.php',
		'DumpNotalkFilter' => 'includes/Export.php',
		'DumpNamespaceFilter' => 'includes/Export.php',
		'DumpLatestFilter' => 'includes/Export.php',
		'DumpMultiWriter' => 'includes/Export.php',
		'ExternalEdit' => 'includes/ExternalEdit.php',
		'ExternalStore' => 'includes/ExternalStore.php',
		'ExternalStoreDB' => 'includes/ExternalStoreDB.php',
		'ExternalStoreHttp' => 'includes/ExternalStoreHttp.php',
		'FakeTitle' => 'includes/FakeTitle.php',
		'FeedItem' => 'includes/Feed.php',
		'ChannelFeed' => 'includes/Feed.php',
		'RSSFeed' => 'includes/Feed.php',
		'AtomFeed' => 'includes/Feed.php',
		'FileStore' => 'includes/FileStore.php',
		'FSException' => 'includes/FileStore.php',
		'FSTransaction' => 'includes/FileStore.php',
		'HTMLForm' => 'includes/HTMLForm.php',
		'HistoryBlob' => 'includes/HistoryBlob.php',
		'ConcatenatedGzipHistoryBlob' => 'includes/HistoryBlob.php',
		'HistoryBlobStub' => 'includes/HistoryBlob.php',
		'HistoryBlobCurStub' => 'includes/HistoryBlob.php',
		'HTMLCacheUpdate' => 'includes/HTMLCacheUpdate.php',
		'HTMLCacheUpdateJob' => 'includes/HTMLCacheUpdate.php',
		'Http' => 'includes/HttpFunctions.php',
		'Image' => 'includes/Image.php',
		'ArchivedFile' => 'includes/Image.php',
		'IP' => 'includes/IP.php',
		'ThumbnailImage' => 'includes/Image.php',
		'ImageGallery' => 'includes/ImageGallery.php',
		'ImagePage' => 'includes/ImagePage.php',
		'ImageHistoryList' => 'includes/ImagePage.php',
		'ImageRemote' => 'includes/ImageRemote.php',
		'Job' => 'includes/JobQueue.php',
		'Licenses' => 'includes/Licenses.php',
		'License' => 'includes/Licenses.php',
		'LinkBatch' => 'includes/LinkBatch.php',
		'LinkCache' => 'includes/LinkCache.php',
		'LinkFilter' => 'includes/LinkFilter.php',
		'Linker' => 'includes/Linker.php',
		'LinksUpdate' => 'includes/LinksUpdate.php',
		'LoadBalancer' => 'includes/LoadBalancer.php',
		'LogPage' => 'includes/LogPage.php',
		'MacBinary' => 'includes/MacBinary.php',
		'MagicWord' => 'includes/MagicWord.php',
		'MathRenderer' => 'includes/Math.php',
		'MediaTransformOutput' => 'includes/MediaTransformOutput.php',
		'ThumbnailImage' => 'includes/MediaTransformOutput.php',
		'MediaTransformError' => 'includes/MediaTransformOutput.php',
		'TransformParameterError' => 'includes/MediaTransformOutput.php',
		'MessageCache' => 'includes/MessageCache.php',
		'MimeMagic' => 'includes/MimeMagic.php',
		'Namespace' => 'includes/Namespace.php',
		'FakeMemCachedClient' => 'includes/ObjectCache.php',
		'OutputPage' => 'includes/OutputPage.php',
		'PageHistory' => 'includes/PageHistory.php',
		'IndexPager' => 'includes/Pager.php',
		'ReverseChronologicalPager' => 'includes/Pager.php',
		'TablePager' => 'includes/Pager.php',
		'Parser' => 'includes/Parser.php',
		'ParserOutput' => 'includes/ParserOutput.php',
		'ParserOptions' => 'includes/ParserOptions.php',
		'ParserCache' => 'includes/ParserCache.php',
		'PatrolLog' => 'includes/PatrolLog.php',
		'ProfilerSimple' => 'includes/ProfilerSimple.php',
		'ProfilerSimpleUDP' => 'includes/ProfilerSimpleUDP.php',
		'Profiler' => 'includes/Profiler.php',
		'ProxyTools' => 'includes/ProxyTools.php',
		'ProtectionForm' => 'includes/ProtectionForm.php',
		'QueryPage' => 'includes/QueryPage.php',
		'PageQueryPage' => 'includes/PageQueryPage.php',
		'ImageQueryPage' => 'includes/ImageQueryPage.php',
		'RawPage' => 'includes/RawPage.php',
		'RecentChange' => 'includes/RecentChange.php',
		'Revision' => 'includes/Revision.php',
		'Sanitizer' => 'includes/Sanitizer.php',
		'SearchEngine' => 'includes/SearchEngine.php',
		'SearchResultSet' => 'includes/SearchEngine.php',
		'SearchResult' => 'includes/SearchEngine.php',
		'SearchEngineDummy' => 'includes/SearchEngine.php',
		'SearchMySQL' => 'includes/SearchMySQL.php',
		'MySQLSearchResultSet' => 'includes/SearchMySQL.php',
		'SearchMySQL4' => 'includes/SearchMySQL4.php',
		'SearchPostgres' => 'includes/SearchPostgres.php',
		'SearchUpdate' => 'includes/SearchUpdate.php',
		'SearchUpdateMyISAM' => 'includes/SearchUpdate.php',
		'SearchOracle' => 'includes/SearchOracle.php',
		'SiteConfiguration' => 'includes/SiteConfiguration.php',
		'SiteStats' => 'includes/SiteStats.php',
		'SiteStatsUpdate' => 'includes/SiteStats.php',
		'Skin' => 'includes/Skin.php',
		'MediaWiki_I18N' => 'includes/SkinTemplate.php',
		'SkinTemplate' => 'includes/SkinTemplate.php',
		'QuickTemplate' => 'includes/SkinTemplate.php',
		'SpecialAllpages' => 'includes/SpecialAllpages.php',
		'AncientPagesPage' => 'includes/SpecialAncientpages.php',
		'IPBlockForm' => 'includes/SpecialBlockip.php',
		'SpecialBookSources' => 'includes/SpecialBooksources.php',
		'BrokenRedirectsPage' => 'includes/SpecialBrokenRedirects.php',
		'EmailConfirmation' => 'includes/SpecialConfirmemail.php',
		'ContributionsPage' => 'includes/SpecialContributions.php',
		'DeadendPagesPage' => 'includes/SpecialDeadendpages.php',
		'DisambiguationsPage' => 'includes/SpecialDisambiguations.php',
		'DoubleRedirectsPage' => 'includes/SpecialDoubleRedirects.php',
		'EmailUserForm' => 'includes/SpecialEmailuser.php',
		'WikiRevision' => 'includes/SpecialImport.php',
		'WikiImporter' => 'includes/SpecialImport.php',
		'ImportStringSource' => 'includes/SpecialImport.php',
		'ImportStreamSource' => 'includes/SpecialImport.php',
		'IPUnblockForm' => 'includes/SpecialIpblocklist.php',
		'ListredirectsPage' => 'includes/SpecialListredirects.php',
		'DBLockForm' => 'includes/SpecialLockdb.php',
		'LogReader' => 'includes/SpecialLog.php',
		'LogViewer' => 'includes/SpecialLog.php',
		'LonelyPagesPage' => 'includes/SpecialLonelypages.php',
		'LongPagesPage' => 'includes/SpecialLongpages.php',
		'MIMEsearchPage' => 'includes/SpecialMIMEsearch.php',
		'MostcategoriesPage' => 'includes/SpecialMostcategories.php',
		'MostimagesPage' => 'includes/SpecialMostimages.php',
		'MostlinkedPage' => 'includes/SpecialMostlinked.php',
		'MostlinkedCategoriesPage' => 'includes/SpecialMostlinkedcategories.php',
		'MostrevisionsPage' => 'includes/SpecialMostrevisions.php',
		'FewestrevisionsPage' => 'includes/SpecialFewestrevisions.php',
		'MovePageForm' => 'includes/SpecialMovepage.php',
		'NewbieContributionsPage' => 'includes/SpecialNewbieContributions.php',
		'NewPagesPage' => 'includes/SpecialNewpages.php',
		'SpecialPage' => 'includes/SpecialPage.php',
		'UnlistedSpecialPage' => 'includes/SpecialPage.php',
		'IncludableSpecialPage' => 'includes/SpecialPage.php',
		'PopularPagesPage' => 'includes/SpecialPopularpages.php',
		'PreferencesForm' => 'includes/SpecialPreferences.php',
		'SpecialPrefixindex' => 'includes/SpecialPrefixindex.php',
		'PasswordResetForm' => 'includes/SpecialResetpass.php',
		'RevisionDeleteForm' => 'includes/SpecialRevisiondelete.php',
		'RevisionDeleter' => 'includes/SpecialRevisiondelete.php',
		'SpecialSearch' => 'includes/SpecialSearch.php',
		'ShortPagesPage' => 'includes/SpecialShortpages.php',
		'UncategorizedCategoriesPage' => 'includes/SpecialUncategorizedcategories.php',
		'UncategorizedPagesPage' => 'includes/SpecialUncategorizedpages.php',
		'PageArchive' => 'includes/SpecialUndelete.php',
		'UndeleteForm' => 'includes/SpecialUndelete.php',
		'DBUnlockForm' => 'includes/SpecialUnlockdb.php',
		'UnusedCategoriesPage' => 'includes/SpecialUnusedcategories.php',
		'UnusedimagesPage' => 'includes/SpecialUnusedimages.php',
		'UnusedtemplatesPage' => 'includes/SpecialUnusedtemplates.php',
		'UnwatchedpagesPage' => 'includes/SpecialUnwatchedpages.php',
		'UploadForm' => 'includes/SpecialUpload.php',
		'UploadFormMogile' => 'includes/SpecialUploadMogile.php',
		'LoginForm' => 'includes/SpecialUserlogin.php',
		'UserrightsForm' => 'includes/SpecialUserrights.php',
		'SpecialVersion' => 'includes/SpecialVersion.php',
		'WantedCategoriesPage' => 'includes/SpecialWantedcategories.php',
		'WantedPagesPage' => 'includes/SpecialWantedpages.php',
		'WhatLinksHerePage' => 'includes/SpecialWhatlinkshere.php',
		'WithoutInterwikiPage' => 'includes/SpecialWithoutinterwiki.php',
		'SquidUpdate' => 'includes/SquidUpdate.php',
		'ReplacementArray' => 'includes/StringUtils.php',
		'Replacer' => 'includes/StringUtils.php',
		'RegexlikeReplacer' => 'includes/StringUtils.php',
		'DoubleReplacer' => 'includes/StringUtils.php',
		'HashtableReplacer' => 'includes/StringUtils.php',
		'StringUtils' => 'includes/StringUtils.php',
		'Title' => 'includes/Title.php',
		'User' => 'includes/User.php',
		'MailAddress' => 'includes/UserMailer.php',
		'EmailNotification' => 'includes/UserMailer.php',
		'WatchedItem' => 'includes/WatchedItem.php',
		'WebRequest' => 'includes/WebRequest.php',
		'WebResponse' => 'includes/WebResponse.php',
		'FauxRequest' => 'includes/WebRequest.php',
		'MediaWiki' => 'includes/Wiki.php',
		'WikiError' => 'includes/WikiError.php',
		'WikiErrorMsg' => 'includes/WikiError.php',
		'WikiXmlError' => 'includes/WikiError.php',
		'XCacheBagOStuff' => 'includes/BagOStuff.php',
		'Xml' => 'includes/Xml.php',
		'ZhClient' => 'includes/ZhClient.php',
		'memcached' => 'includes/memcached-client.php',

		# Media
		'BitmapHandler' => 'includes/media/Bitmap.php',
		'BmpHandler' => 'includes/media/BMP.php',
		'DjVuHandler' => 'includes/media/DjVu.php',
		'MediaHandler' => 'includes/media/Generic.php',
		'ImageHandler' => 'includes/media/Generic.php',
		'SvgHandler' => 'includes/media/SVG.php',

		# Normal
		'UtfNormal' => 'includes/normal/UtfNormal.php',

		# Templates
		'UsercreateTemplate' => 'includes/templates/Userlogin.php',
		'UserloginTemplate' => 'includes/templates/Userlogin.php',

		# Languages
		'Language' => 'languages/Language.php',
		'RandomPage' => 'includes/SpecialRandompage.php',

		# API
		'ApiBase' => 'includes/api/ApiBase.php',
		'ApiFormatFeedWrapper' => 'includes/api/ApiFormatBase.php',
		'ApiFeedWatchlist' => 'includes/api/ApiFeedWatchlist.php',
		'ApiFormatBase' => 'includes/api/ApiFormatBase.php',
		'Services_JSON' => 'includes/api/ApiFormatJson_json.php',
		'ApiFormatJson' => 'includes/api/ApiFormatJson.php',
		'ApiFormatPhp' => 'includes/api/ApiFormatPhp.php',
		'ApiFormatWddx' => 'includes/api/ApiFormatWddx.php',
		'ApiFormatXml' => 'includes/api/ApiFormatXml.php',
		'Spyc' => 'includes/api/ApiFormatYaml_spyc.php',
		'ApiFormatYaml' => 'includes/api/ApiFormatYaml.php',
		'ApiHelp' => 'includes/api/ApiHelp.php',
		'ApiLogin' => 'includes/api/ApiLogin.php',
		'ApiMain' => 'includes/api/ApiMain.php',
		'ApiOpenSearch' => 'includes/api/ApiOpenSearch.php',
		'ApiPageSet' => 'includes/api/ApiPageSet.php',
		'ApiQuery' => 'includes/api/ApiQuery.php',
		'ApiQueryAllpages' => 'includes/api/ApiQueryAllpages.php',
		'ApiQueryBase' => 'includes/api/ApiQueryBase.php',
		'ApiQueryBacklinks' => 'includes/api/ApiQueryBacklinks.php',
		'ApiQueryContributions' => 'includes/api/ApiQueryUserContributions.php',
		'ApiQueryInfo' => 'includes/api/ApiQueryInfo.php',
		'ApiQueryLogEvents' => 'includes/api/ApiQueryLogEvents.php',
		'ApiQueryRecentChanges'=> 'includes/api/ApiQueryRecentChanges.php',
		'ApiQueryRevisions' => 'includes/api/ApiQueryRevisions.php',
		'ApiQuerySiteinfo' => 'includes/api/ApiQuerySiteinfo.php',
		'ApiQueryWatchlist' => 'includes/api/ApiQueryWatchlist.php',
		'ApiResult' => 'includes/api/ApiResult.php',
	);
	
	wfProfileIn( __METHOD__ );
	if ( isset( $localClasses[$className] ) ) {
		$filename = $localClasses[$className];
	} elseif ( isset( $wgAutoloadClasses[$className] ) ) {
		$filename = $wgAutoloadClasses[$className];
	} else {
		# Try a different capitalisation
		# The case can sometimes be wrong when unserializing PHP 4 objects
		$filename = false;
		$lowerClass = strtolower( $className );
		foreach ( $localClasses as $class2 => $file2 ) {
			if ( strtolower( $class2 ) == $lowerClass ) {
				$filename = $file2;
			}
		}
		if ( !$filename ) {
			# Give up
			wfProfileOut( __METHOD__ );
			return;
		}
	}

	# Make an absolute path, this improves performance by avoiding some stat calls
	if ( substr( $filename, 0, 1 ) != '/' && substr( $filename, 1, 1 ) != ':' ) {
		global $IP;
		$filename = "$IP/$filename";
	}
	require( $filename );
	wfProfileOut( __METHOD__ );
}

function wfLoadAllExtensions() {
	global $wgAutoloadClasses;

	# It is crucial that SpecialPage.php is included before any special page 
	# extensions are loaded. Otherwise the parent class will not be available
	# when APC loads the early-bound extension class. Normally this is 
	# guaranteed by entering special pages via SpecialPage members such as 
	# executePath(), but here we have to take a more explicit measure.
	
	require_once( dirname(__FILE__) . '/SpecialPage.php' );
	
	foreach( $wgAutoloadClasses as $class => $file ) {
		if( !( class_exists( $class ) || interface_exists( $class ) ) ) {
			require( $file );
		}
	}
}

?>