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