Update kss style guide wording and README
[lhc/web/wiklou.git] / includes / Setup.php
1 <?php
2 /**
3 * Include most things that are needed to make %MediaWiki work.
4 *
5 * This file is included by WebStart.php and doMaintenance.php so that both
6 * web and maintenance scripts share a final set up phase to include necessary
7 * files and create global object variables.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 * http://www.gnu.org/copyleft/gpl.html
23 *
24 * @file
25 */
26
27 /**
28 * This file is not a valid entry point, perform no further processing unless
29 * MEDIAWIKI is defined
30 */
31 if ( !defined( 'MEDIAWIKI' ) ) {
32 exit( 1 );
33 }
34
35 $fname = 'Setup.php';
36 wfProfileIn( $fname );
37 wfProfileIn( $fname . '-defaults' );
38
39 // Check to see if we are at the file scope
40 if ( !isset( $wgVersion ) ) {
41 echo "Error, Setup.php must be included from the file scope, after DefaultSettings.php\n";
42 die( 1 );
43 }
44
45 // Set various default paths sensibly...
46
47 if ( $wgScript === false ) {
48 $wgScript = "$wgScriptPath/index$wgScriptExtension";
49 }
50 if ( $wgLoadScript === false ) {
51 $wgLoadScript = "$wgScriptPath/load$wgScriptExtension";
52 }
53
54 if ( $wgArticlePath === false ) {
55 if ( $wgUsePathInfo ) {
56 $wgArticlePath = "$wgScript/$1";
57 } else {
58 $wgArticlePath = "$wgScript?title=$1";
59 }
60 }
61
62 if ( !empty( $wgActionPaths ) && !isset( $wgActionPaths['view'] ) ) {
63 // 'view' is assumed the default action path everywhere in the code
64 // but is rarely filled in $wgActionPaths
65 $wgActionPaths['view'] = $wgArticlePath;
66 }
67
68 if ( $wgStylePath === false ) {
69 $wgStylePath = "$wgScriptPath/skins";
70 }
71 if ( $wgLocalStylePath === false ) {
72 $wgLocalStylePath = "$wgScriptPath/skins";
73 }
74 if ( $wgStyleDirectory === false ) {
75 $wgStyleDirectory = "$IP/skins";
76 }
77 if ( $wgExtensionAssetsPath === false ) {
78 $wgExtensionAssetsPath = "$wgScriptPath/extensions";
79 }
80
81 if ( $wgLogo === false ) {
82 $wgLogo = "$wgStylePath/common/images/wiki.png";
83 }
84
85 if ( $wgUploadPath === false ) {
86 $wgUploadPath = "$wgScriptPath/images";
87 }
88 if ( $wgUploadDirectory === false ) {
89 $wgUploadDirectory = "$IP/images";
90 }
91 if ( $wgReadOnlyFile === false ) {
92 $wgReadOnlyFile = "{$wgUploadDirectory}/lock_yBgMBwiR";
93 }
94 if ( $wgFileCacheDirectory === false ) {
95 $wgFileCacheDirectory = "{$wgUploadDirectory}/cache";
96 }
97 if ( $wgDeletedDirectory === false ) {
98 $wgDeletedDirectory = "{$wgUploadDirectory}/deleted";
99 }
100
101 if ( isset( $wgFileStore['deleted']['directory'] ) ) {
102 $wgDeletedDirectory = $wgFileStore['deleted']['directory'];
103 }
104
105 if ( isset( $wgFooterIcons['copyright'] )
106 && isset( $wgFooterIcons['copyright']['copyright'] )
107 && $wgFooterIcons['copyright']['copyright'] === array()
108 ) {
109 if ( isset( $wgCopyrightIcon ) && $wgCopyrightIcon ) {
110 $wgFooterIcons['copyright']['copyright'] = $wgCopyrightIcon;
111 } elseif ( $wgRightsIcon || $wgRightsText ) {
112 $wgFooterIcons['copyright']['copyright'] = array(
113 'url' => $wgRightsUrl,
114 'src' => $wgRightsIcon,
115 'alt' => $wgRightsText,
116 );
117 } else {
118 unset( $wgFooterIcons['copyright']['copyright'] );
119 }
120 }
121
122 if ( isset( $wgFooterIcons['poweredby'] )
123 && isset( $wgFooterIcons['poweredby']['mediawiki'] )
124 && $wgFooterIcons['poweredby']['mediawiki']['src'] === null
125 ) {
126 $wgFooterIcons['poweredby']['mediawiki']['src'] = "$wgStylePath/common/images/poweredby_mediawiki_88x31.png";
127 }
128
129 /**
130 * Unconditional protection for NS_MEDIAWIKI since otherwise it's too easy for a
131 * sysadmin to set $wgNamespaceProtection incorrectly and leave the wiki insecure.
132 *
133 * Note that this is the definition of editinterface and it can be granted to
134 * all users if desired.
135 */
136 $wgNamespaceProtection[NS_MEDIAWIKI] = 'editinterface';
137
138 /**
139 * The canonical names of namespaces 6 and 7 are, as of v1.14, "File"
140 * and "File_talk". The old names "Image" and "Image_talk" are
141 * retained as aliases for backwards compatibility.
142 */
143 $wgNamespaceAliases['Image'] = NS_FILE;
144 $wgNamespaceAliases['Image_talk'] = NS_FILE_TALK;
145
146 /**
147 * Initialise $wgLockManagers to include basic FS version
148 */
149 $wgLockManagers[] = array(
150 'name' => 'fsLockManager',
151 'class' => 'FSLockManager',
152 'lockDirectory' => "{$wgUploadDirectory}/lockdir",
153 );
154 $wgLockManagers[] = array(
155 'name' => 'nullLockManager',
156 'class' => 'NullLockManager',
157 );
158
159 /**
160 * Initialise $wgLocalFileRepo from backwards-compatible settings
161 */
162 if ( !$wgLocalFileRepo ) {
163 if ( isset( $wgFileStore['deleted']['hash'] ) ) {
164 $deletedHashLevel = $wgFileStore['deleted']['hash'];
165 } else {
166 $deletedHashLevel = $wgHashedUploadDirectory ? 3 : 0;
167 }
168 $wgLocalFileRepo = array(
169 'class' => 'LocalRepo',
170 'name' => 'local',
171 'directory' => $wgUploadDirectory,
172 'scriptDirUrl' => $wgScriptPath,
173 'scriptExtension' => $wgScriptExtension,
174 'url' => $wgUploadBaseUrl ? $wgUploadBaseUrl . $wgUploadPath : $wgUploadPath,
175 'hashLevels' => $wgHashedUploadDirectory ? 2 : 0,
176 'thumbScriptUrl' => $wgThumbnailScriptPath,
177 'transformVia404' => !$wgGenerateThumbnailOnParse,
178 'deletedDir' => $wgDeletedDirectory,
179 'deletedHashLevels' => $deletedHashLevel
180 );
181 }
182 /**
183 * Initialise shared repo from backwards-compatible settings
184 */
185 if ( $wgUseSharedUploads ) {
186 if ( $wgSharedUploadDBname ) {
187 $wgForeignFileRepos[] = array(
188 'class' => 'ForeignDBRepo',
189 'name' => 'shared',
190 'directory' => $wgSharedUploadDirectory,
191 'url' => $wgSharedUploadPath,
192 'hashLevels' => $wgHashedSharedUploadDirectory ? 2 : 0,
193 'thumbScriptUrl' => $wgSharedThumbnailScriptPath,
194 'transformVia404' => !$wgGenerateThumbnailOnParse,
195 'dbType' => $wgDBtype,
196 'dbServer' => $wgDBserver,
197 'dbUser' => $wgDBuser,
198 'dbPassword' => $wgDBpassword,
199 'dbName' => $wgSharedUploadDBname,
200 'dbFlags' => ( $wgDebugDumpSql ? DBO_DEBUG : 0 ) | DBO_DEFAULT,
201 'tablePrefix' => $wgSharedUploadDBprefix,
202 'hasSharedCache' => $wgCacheSharedUploads,
203 'descBaseUrl' => $wgRepositoryBaseUrl,
204 'fetchDescription' => $wgFetchCommonsDescriptions,
205 );
206 } else {
207 $wgForeignFileRepos[] = array(
208 'class' => 'FileRepo',
209 'name' => 'shared',
210 'directory' => $wgSharedUploadDirectory,
211 'url' => $wgSharedUploadPath,
212 'hashLevels' => $wgHashedSharedUploadDirectory ? 2 : 0,
213 'thumbScriptUrl' => $wgSharedThumbnailScriptPath,
214 'transformVia404' => !$wgGenerateThumbnailOnParse,
215 'descBaseUrl' => $wgRepositoryBaseUrl,
216 'fetchDescription' => $wgFetchCommonsDescriptions,
217 );
218 }
219 }
220 if ( $wgUseInstantCommons ) {
221 $wgForeignFileRepos[] = array(
222 'class' => 'ForeignAPIRepo',
223 'name' => 'wikimediacommons',
224 'apibase' => WebRequest::detectProtocol() === 'https' ?
225 'https://commons.wikimedia.org/w/api.php' :
226 'http://commons.wikimedia.org/w/api.php',
227 'hashLevels' => 2,
228 'fetchDescription' => true,
229 'descriptionCacheExpiry' => 43200,
230 'apiThumbCacheExpiry' => 86400,
231 );
232 }
233 /*
234 * Add on default file backend config for file repos.
235 * FileBackendGroup will handle initializing the backends.
236 */
237 if ( !isset( $wgLocalFileRepo['backend'] ) ) {
238 $wgLocalFileRepo['backend'] = $wgLocalFileRepo['name'] . '-backend';
239 }
240 foreach ( $wgForeignFileRepos as &$repo ) {
241 if ( !isset( $repo['directory'] ) && $repo['class'] === 'ForeignAPIRepo' ) {
242 $repo['directory'] = $wgUploadDirectory; // b/c
243 }
244 if ( !isset( $repo['backend'] ) ) {
245 $repo['backend'] = $repo['name'] . '-backend';
246 }
247 }
248 unset( $repo ); // no global pollution; destroy reference
249
250 if ( $wgRCFilterByAge ) {
251 // Trim down $wgRCLinkDays so that it only lists links which are valid
252 // as determined by $wgRCMaxAge.
253 // Note that we allow 1 link higher than the max for things like 56 days but a 60 day link.
254 sort( $wgRCLinkDays );
255 for ( $i = 0; $i < count( $wgRCLinkDays ); $i++ ) {
256 if ( $wgRCLinkDays[$i] >= $wgRCMaxAge / ( 3600 * 24 ) ) {
257 $wgRCLinkDays = array_slice( $wgRCLinkDays, 0, $i + 1, false );
258 break;
259 }
260 }
261 }
262
263 if ( $wgSkipSkin ) {
264 $wgSkipSkins[] = $wgSkipSkin;
265 }
266
267 if ( $wgLocalInterwiki ) {
268 array_unshift( $wgLocalInterwikis, $wgLocalInterwiki );
269 }
270
271 // Set default shared prefix
272 if ( $wgSharedPrefix === false ) {
273 $wgSharedPrefix = $wgDBprefix;
274 }
275
276 if ( !$wgCookiePrefix ) {
277 if ( $wgSharedDB && $wgSharedPrefix && in_array( 'user', $wgSharedTables ) ) {
278 $wgCookiePrefix = $wgSharedDB . '_' . $wgSharedPrefix;
279 } elseif ( $wgSharedDB && in_array( 'user', $wgSharedTables ) ) {
280 $wgCookiePrefix = $wgSharedDB;
281 } elseif ( $wgDBprefix ) {
282 $wgCookiePrefix = $wgDBname . '_' . $wgDBprefix;
283 } else {
284 $wgCookiePrefix = $wgDBname;
285 }
286 }
287 $wgCookiePrefix = strtr( $wgCookiePrefix, '=,; +."\'\\[', '__________' );
288
289 $wgUseEnotif = $wgEnotifUserTalk || $wgEnotifWatchlist;
290
291 if ( $wgMetaNamespace === false ) {
292 $wgMetaNamespace = str_replace( ' ', '_', $wgSitename );
293 }
294
295 // Default value is either the suhosin limit or -1 for unlimited
296 if ( $wgResourceLoaderMaxQueryLength === false ) {
297 $maxValueLength = ini_get( 'suhosin.get.max_value_length' );
298 $wgResourceLoaderMaxQueryLength = $maxValueLength > 0 ? $maxValueLength : -1;
299 }
300
301 /**
302 * Definitions of the NS_ constants are in Defines.php
303 * @private
304 */
305 $wgCanonicalNamespaceNames = array(
306 NS_MEDIA => 'Media',
307 NS_SPECIAL => 'Special',
308 NS_TALK => 'Talk',
309 NS_USER => 'User',
310 NS_USER_TALK => 'User_talk',
311 NS_PROJECT => 'Project',
312 NS_PROJECT_TALK => 'Project_talk',
313 NS_FILE => 'File',
314 NS_FILE_TALK => 'File_talk',
315 NS_MEDIAWIKI => 'MediaWiki',
316 NS_MEDIAWIKI_TALK => 'MediaWiki_talk',
317 NS_TEMPLATE => 'Template',
318 NS_TEMPLATE_TALK => 'Template_talk',
319 NS_HELP => 'Help',
320 NS_HELP_TALK => 'Help_talk',
321 NS_CATEGORY => 'Category',
322 NS_CATEGORY_TALK => 'Category_talk',
323 );
324
325 /// @todo UGLY UGLY
326 if ( is_array( $wgExtraNamespaces ) ) {
327 $wgCanonicalNamespaceNames = $wgCanonicalNamespaceNames + $wgExtraNamespaces;
328 }
329
330 // These are now the same, always
331 // To determine the user language, use $wgLang->getCode()
332 $wgContLanguageCode = $wgLanguageCode;
333
334 // Easy to forget to falsify $wgShowIPinHeader for static caches.
335 // If file cache or squid cache is on, just disable this (DWIMD).
336 // Do the same for $wgDebugToolbar.
337 if ( $wgUseFileCache || $wgUseSquid ) {
338 $wgShowIPinHeader = false;
339 $wgDebugToolbar = false;
340 }
341
342 // Doesn't make sense to have if disabled.
343 if ( !$wgEnotifMinorEdits ) {
344 $wgHiddenPrefs[] = 'enotifminoredits';
345 }
346
347 // We always output HTML5 since 1.22, overriding these is no longer supported
348 // we set them here for extensions that depend on its value.
349 $wgHtml5 = true;
350 $wgXhtmlDefaultNamespace = 'http://www.w3.org/1999/xhtml';
351 $wgJsMimeType = 'text/javascript';
352
353 if ( !$wgHtml5Version && $wgAllowRdfaAttributes ) {
354 // see http://www.w3.org/TR/rdfa-in-html/#document-conformance
355 if ( $wgMimeType == 'application/xhtml+xml' ) {
356 $wgHtml5Version = 'XHTML+RDFa 1.0';
357 } else {
358 $wgHtml5Version = 'HTML+RDFa 1.0';
359 }
360 }
361
362 // Blacklisted file extensions shouldn't appear on the "allowed" list
363 $wgFileExtensions = array_values( array_diff ( $wgFileExtensions, $wgFileBlacklist ) );
364
365 if ( $wgArticleCountMethod === null ) {
366 $wgArticleCountMethod = $wgUseCommaCount ? 'comma' : 'link';
367 }
368
369 if ( $wgInvalidateCacheOnLocalSettingsChange ) {
370 $wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis', @filemtime( "$IP/LocalSettings.php" ) ) );
371 }
372
373 if ( $wgNewUserLog ) {
374 // Add a new log type
375 $wgLogTypes[] = 'newusers';
376 $wgLogNames['newusers'] = 'newuserlogpage';
377 $wgLogHeaders['newusers'] = 'newuserlogpagetext';
378 $wgLogActionsHandlers['newusers/newusers'] = 'NewUsersLogFormatter';
379 $wgLogActionsHandlers['newusers/create'] = 'NewUsersLogFormatter';
380 $wgLogActionsHandlers['newusers/create2'] = 'NewUsersLogFormatter';
381 $wgLogActionsHandlers['newusers/byemail'] = 'NewUsersLogFormatter';
382 $wgLogActionsHandlers['newusers/autocreate'] = 'NewUsersLogFormatter';
383 }
384
385 if ( $wgCookieSecure === 'detect' ) {
386 $wgCookieSecure = ( WebRequest::detectProtocol() === 'https' );
387 }
388
389 if ( $wgRC2UDPAddress ) {
390 $wgRCFeeds['default'] = array(
391 'formatter' => 'IRCColourfulRCFeedFormatter',
392 'uri' => "udp://$wgRC2UDPAddress:$wgRC2UDPPort/$wgRC2UDPPrefix",
393 'add_interwiki_prefix' => &$wgRC2UDPInterwikiPrefix,
394 'omit_bots' => &$wgRC2UDPOmitBots,
395 );
396 }
397
398 wfProfileOut( $fname . '-defaults' );
399
400 // Disable MWDebug for command line mode, this prevents MWDebug from eating up
401 // all the memory from logging SQL queries on maintenance scripts
402 global $wgCommandLineMode;
403 if ( $wgDebugToolbar && !$wgCommandLineMode ) {
404 wfProfileIn( $fname . '-debugtoolbar' );
405 MWDebug::init();
406 wfProfileOut( $fname . '-debugtoolbar' );
407 }
408
409 if ( !class_exists( 'AutoLoader' ) ) {
410 require_once "$IP/includes/AutoLoader.php";
411 }
412
413 wfProfileIn( $fname . '-exception' );
414 MWExceptionHandler::installHandler();
415 wfProfileOut( $fname . '-exception' );
416
417 wfProfileIn( $fname . '-includes' );
418 require_once "$IP/includes/normal/UtfNormalUtil.php";
419 require_once "$IP/includes/GlobalFunctions.php";
420 require_once "$IP/includes/normal/UtfNormalDefines.php";
421 wfProfileOut( $fname . '-includes' );
422
423 wfProfileIn( $fname . '-defaults2' );
424
425 if ( $wgCanonicalServer === false ) {
426 $wgCanonicalServer = wfExpandUrl( $wgServer, PROTO_HTTP );
427 }
428
429 // Set server name
430 $serverParts = wfParseUrl( $wgCanonicalServer );
431 if ( $wgServerName !== false ) {
432 wfWarn( '$wgServerName should be derived from $wgCanonicalServer, not customized. Overwriting $wgServerName.' );
433 }
434 $wgServerName = $serverParts['host'];
435 unset( $serverParts );
436
437 // Set defaults for configuration variables
438 // that are derived from the server name by default
439 if ( $wgEmergencyContact === false ) {
440 $wgEmergencyContact = 'wikiadmin@' . $wgServerName;
441 }
442
443 if ( $wgPasswordSender === false ) {
444 $wgPasswordSender = 'apache@' . $wgServerName;
445 }
446
447 if ( $wgSecureLogin && substr( $wgServer, 0, 2 ) !== '//' ) {
448 $wgSecureLogin = false;
449 wfWarn( 'Secure login was enabled on a server that only supports HTTP or HTTPS. Disabling secure login.' );
450 }
451
452 // Now that GlobalFunctions is loaded, set defaults that depend
453 // on it.
454 if ( $wgTmpDirectory === false ) {
455 wfProfileIn( $fname . '-tempDir' );
456 $wgTmpDirectory = wfTempDir();
457 wfProfileOut( $fname . '-tempDir' );
458 }
459
460 // $wgHTCPMulticastRouting got renamed to $wgHTCPRouting in MediaWiki 1.22
461 // ensure back compatibility.
462 if ( !$wgHTCPRouting && $wgHTCPMulticastRouting ) {
463 $wgHTCPRouting = $wgHTCPMulticastRouting;
464 }
465
466 // Initialize $wgHTCPRouting from backwards-compatible settings that
467 // comes from pre 1.20 version.
468 if ( !$wgHTCPRouting && $wgHTCPMulticastAddress ) {
469 $wgHTCPRouting = array(
470 '' => array(
471 'host' => $wgHTCPMulticastAddress,
472 'port' => $wgHTCPPort,
473 )
474 );
475 }
476
477 // Back compatibility for $wgRateLimitLog deprecated with 1.23
478 if ( $wgRateLimitLog && ! array_key_exists( 'ratelimit', $wgDebugLogGroups ) ) {
479 $wgDebugLogGroups['ratelimit'] = $wgRateLimitLog;
480 }
481
482 if ( $wgProfileOnly ) {
483 $wgDebugLogGroups['profileoutput'] = $wgDebugLogFile;
484 $wgDebugLogFile = '';
485 }
486
487 wfProfileOut( $fname . '-defaults2' );
488 wfProfileIn( $fname . '-misc1' );
489
490 // Raise the memory limit if it's too low
491 wfMemoryLimit();
492
493 /**
494 * Set up the timezone, suppressing the pseudo-security warning in PHP 5.1+
495 * that happens whenever you use a date function without the timezone being
496 * explicitly set. Inspired by phpMyAdmin's treatment of the problem.
497 */
498 if ( is_null( $wgLocaltimezone ) ) {
499 wfSuppressWarnings();
500 $wgLocaltimezone = date_default_timezone_get();
501 wfRestoreWarnings();
502 }
503
504 date_default_timezone_set( $wgLocaltimezone );
505 if ( is_null( $wgLocalTZoffset ) ) {
506 $wgLocalTZoffset = date( 'Z' ) / 60;
507 }
508
509 // Useful debug output
510 if ( $wgCommandLineMode ) {
511 $wgRequest = new FauxRequest( array() );
512
513 wfDebug( "\n\nStart command line script $self\n" );
514 } else {
515 // Can't stub this one, it sets up $_GET and $_REQUEST in its constructor
516 $wgRequest = new WebRequest;
517
518 $debug = "\n\nStart request {$wgRequest->getMethod()} {$wgRequest->getRequestURL()}\n";
519
520 if ( $wgDebugPrintHttpHeaders ) {
521 $debug .= "HTTP HEADERS:\n";
522
523 foreach ( $wgRequest->getAllHeaders() as $name => $value ) {
524 $debug .= "$name: $value\n";
525 }
526 }
527 wfDebug( $debug );
528 }
529
530 wfProfileOut( $fname . '-misc1' );
531 wfProfileIn( $fname . '-memcached' );
532
533 $wgMemc = wfGetMainCache();
534 $messageMemc = wfGetMessageCacheStorage();
535 $parserMemc = wfGetParserCacheStorage();
536 $wgLangConvMemc = wfGetLangConverterCacheStorage();
537
538 wfDebugLog( 'caches', 'main: ' . get_class( $wgMemc ) .
539 ', message: ' . get_class( $messageMemc ) .
540 ', parser: ' . get_class( $parserMemc ) );
541
542 wfProfileOut( $fname . '-memcached' );
543
544 // Most of the config is out, some might want to run hooks here.
545 wfRunHooks( 'SetupAfterCache' );
546
547 wfProfileIn( $fname . '-session' );
548
549 // If session.auto_start is there, we can't touch session name
550 if ( !wfIniGetBool( 'session.auto_start' ) ) {
551 session_name( $wgSessionName ? $wgSessionName : $wgCookiePrefix . '_session' );
552 }
553
554 if ( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode ) {
555 if ( $wgRequest->checkSessionCookie() || isset( $_COOKIE[$wgCookiePrefix . 'Token'] ) ) {
556 wfSetupSession();
557 $wgSessionStarted = true;
558 } else {
559 $wgSessionStarted = false;
560 }
561 }
562
563 wfProfileOut( $fname . '-session' );
564 wfProfileIn( $fname . '-globals' );
565
566 $wgContLang = Language::factory( $wgLanguageCode );
567 $wgContLang->initEncoding();
568 $wgContLang->initContLang();
569
570 // Now that variant lists may be available...
571 $wgRequest->interpolateTitle();
572 $wgUser = RequestContext::getMain()->getUser(); // BackCompat
573
574 /**
575 * @var $wgLang Language
576 */
577 $wgLang = new StubUserLang;
578
579 /**
580 * @var OutputPage
581 */
582 $wgOut = RequestContext::getMain()->getOutput(); // BackCompat
583
584 /**
585 * @var $wgParser Parser
586 */
587 $wgParser = new StubObject( 'wgParser', $wgParserConf['class'], array( $wgParserConf ) );
588
589 if ( !is_object( $wgAuth ) ) {
590 $wgAuth = new AuthPlugin;
591 wfRunHooks( 'AuthPluginSetup', array( &$wgAuth ) );
592 }
593
594 # Placeholders in case of DB error
595 $wgTitle = null;
596
597 $wgDeferredUpdateList = array();
598
599 wfProfileOut( $fname . '-globals' );
600 wfProfileIn( $fname . '-extensions' );
601
602 // Extension setup functions for extensions other than skins
603 // Entries should be added to this variable during the inclusion
604 // of the extension file. This allows the extension to perform
605 // any necessary initialisation in the fully initialised environment
606 foreach ( $wgExtensionFunctions as $func ) {
607 // Allow closures in PHP 5.3+
608 if ( is_object( $func ) && $func instanceof Closure ) {
609 $profName = $fname . '-extensions-closure';
610 } elseif ( is_array( $func ) ) {
611 if ( is_object( $func[0] ) ) {
612 $profName = $fname . '-extensions-' . get_class( $func[0] ) . '::' . $func[1];
613 } else {
614 $profName = $fname . '-extensions-' . implode( '::', $func );
615 }
616 } else {
617 $profName = $fname . '-extensions-' . strval( $func );
618 }
619
620 wfProfileIn( $profName );
621 call_user_func( $func );
622 wfProfileOut( $profName );
623 }
624
625 wfDebug( "Fully initialised\n" );
626 $wgFullyInitialised = true;
627
628 wfProfileOut( $fname . '-extensions' );
629 wfProfileOut( $fname );