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