Make ApiStashEdit use the StashEdit log group, rather than PreparedEdit
[mediawiki.git] / includes / Setup.php
blobf61de7eb6d6029bb0548c0e1ac351100e8c27958
1 <?php
2 /**
3 * Include most things that are needed to make %MediaWiki work.
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.
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.
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.
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
24 * @file
27 /**
28 * This file is not a valid entry point, perform no further processing unless
29 * MEDIAWIKI is defined
31 if ( !defined( 'MEDIAWIKI' ) ) {
32 exit( 1 );
35 $fname = 'Setup.php';
36 wfProfileIn( $fname );
37 wfProfileIn( $fname . '-defaults' );
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 );
45 // Set various default paths sensibly...
47 if ( $wgScript === false ) {
48 $wgScript = "$wgScriptPath/index$wgScriptExtension";
50 if ( $wgLoadScript === false ) {
51 $wgLoadScript = "$wgScriptPath/load$wgScriptExtension";
54 if ( $wgArticlePath === false ) {
55 if ( $wgUsePathInfo ) {
56 $wgArticlePath = "$wgScript/$1";
57 } else {
58 $wgArticlePath = "$wgScript?title=$1";
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;
68 if ( $wgStylePath === false ) {
69 $wgStylePath = "$wgScriptPath/skins";
71 if ( $wgLocalStylePath === false ) {
72 $wgLocalStylePath = "$wgScriptPath/skins";
74 if ( $wgStyleDirectory === false ) {
75 $wgStyleDirectory = "$IP/skins";
77 if ( $wgExtensionAssetsPath === false ) {
78 $wgExtensionAssetsPath = "$wgScriptPath/extensions";
80 if ( $wgResourceBasePath === null ) {
81 $wgResourceBasePath = $wgScriptPath;
84 if ( $wgLogo === false ) {
85 $wgLogo = "$wgResourceBasePath/resources/assets/wiki.png";
88 if ( $wgUploadPath === false ) {
89 $wgUploadPath = "$wgScriptPath/images";
91 if ( $wgUploadDirectory === false ) {
92 $wgUploadDirectory = "$IP/images";
94 if ( $wgReadOnlyFile === false ) {
95 $wgReadOnlyFile = "{$wgUploadDirectory}/lock_yBgMBwiR";
97 if ( $wgFileCacheDirectory === false ) {
98 $wgFileCacheDirectory = "{$wgUploadDirectory}/cache";
100 if ( $wgDeletedDirectory === false ) {
101 $wgDeletedDirectory = "{$wgUploadDirectory}/deleted";
104 if ( $wgGitInfoCacheDirectory === false && $wgCacheDirectory !== false ) {
105 $wgGitInfoCacheDirectory = "{$wgCacheDirectory}/gitinfo";
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
117 if ( isset( $wgFooterIcons['copyright'] )
118 && isset( $wgFooterIcons['copyright']['copyright'] )
119 && $wgFooterIcons['copyright']['copyright'] === array()
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,
129 } else {
130 unset( $wgFooterIcons['copyright']['copyright'] );
134 if ( isset( $wgFooterIcons['poweredby'] )
135 && isset( $wgFooterIcons['poweredby']['mediawiki'] )
136 && $wgFooterIcons['poweredby']['mediawiki']['src'] === null
138 $wgFooterIcons['poweredby']['mediawiki']['src'] =
139 "$wgResourceBasePath/resources/assets/poweredby_mediawiki_88x31.png";
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.
146 * Note that this is the definition of editinterface and it can be granted to
147 * all users if desired.
149 $wgNamespaceProtection[NS_MEDIAWIKI] = 'editinterface';
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.
156 $wgNamespaceAliases['Image'] = NS_FILE;
157 $wgNamespaceAliases['Image_talk'] = NS_FILE_TALK;
160 * Initialise $wgLockManagers to include basic FS version
162 $wgLockManagers[] = array(
163 'name' => 'fsLockManager',
164 'class' => 'FSLockManager',
165 'lockDirectory' => "{$wgUploadDirectory}/lockdir",
167 $wgLockManagers[] = array(
168 'name' => 'nullLockManager',
169 'class' => 'NullLockManager',
173 * Initialise $wgLocalFileRepo from backwards-compatible settings
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
191 * Initialise shared repo from backwards-compatible settings
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,
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,
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,
242 * Add on default file backend config for file repos.
243 * FileBackendGroup will handle initializing the backends.
245 if ( !isset( $wgLocalFileRepo['backend'] ) ) {
246 $wgLocalFileRepo['backend'] = $wgLocalFileRepo['name'] . '-backend';
248 foreach ( $wgForeignFileRepos as &$repo ) {
249 if ( !isset( $repo['directory'] ) && $repo['class'] === 'ForeignAPIRepo' ) {
250 $repo['directory'] = $wgUploadDirectory; // b/c
252 if ( !isset( $repo['backend'] ) ) {
253 $repo['backend'] = $repo['name'] . '-backend';
256 unset( $repo ); // no global pollution; destroy reference
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 );
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;
274 if ( $wgSkipSkin ) {
275 $wgSkipSkins[] = $wgSkipSkin;
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 } );
288 // Register a hidden "fallback" skin
289 $factory->register( 'fallback', 'Fallback', function () {
290 return new SkinFallback;
291 } );
292 // Register a hidden skin for api output
293 $factory->register( 'apioutput', 'ApiOutput', function () {
294 return new SkinApi;
295 } );
296 } );
297 $wgSkipSkins[] = 'fallback';
298 $wgSkipSkins[] = 'apioutput';
300 if ( $wgLocalInterwiki ) {
301 array_unshift( $wgLocalInterwikis, $wgLocalInterwiki );
304 // Set default shared prefix
305 if ( $wgSharedPrefix === false ) {
306 $wgSharedPrefix = $wgDBprefix;
309 // Set default shared schema
310 if ( $wgSharedSchema === false ) {
311 $wgSharedSchema = $wgDBmwschema;
314 if ( !$wgCookiePrefix ) {
315 if ( $wgSharedDB && $wgSharedPrefix && in_array( 'user', $wgSharedTables ) ) {
316 $wgCookiePrefix = $wgSharedDB . '_' . $wgSharedPrefix;
317 } elseif ( $wgSharedDB && in_array( 'user', $wgSharedTables ) ) {
318 $wgCookiePrefix = $wgSharedDB;
319 } elseif ( $wgDBprefix ) {
320 $wgCookiePrefix = $wgDBname . '_' . $wgDBprefix;
321 } else {
322 $wgCookiePrefix = $wgDBname;
325 $wgCookiePrefix = strtr( $wgCookiePrefix, '=,; +."\'\\[', '__________' );
327 if ( $wgEnableEmail ) {
328 $wgUseEnotif = $wgEnotifUserTalk || $wgEnotifWatchlist;
329 } else {
330 // Disable all other email settings automatically if $wgEnableEmail
331 // is set to false. - bug 63678
332 $wgAllowHTMLEmail = false;
333 $wgEmailAuthentication = false; // do not require auth if you're not sending email anyway
334 $wgEnableUserEmail = false;
335 $wgEnotifFromEditor = false;
336 $wgEnotifImpersonal = false;
337 $wgEnotifMaxRecips = 0;
338 $wgEnotifMinorEdits = false;
339 $wgEnotifRevealEditorAddress = false;
340 $wgEnotifUseJobQ = false;
341 $wgEnotifUseRealName = false;
342 $wgEnotifUserTalk = false;
343 $wgEnotifWatchlist = false;
344 unset( $wgGroupPermissions['user']['sendemail'] );
345 $wgUseEnotif = false;
346 $wgUserEmailUseReplyTo = false;
347 $wgUsersNotifiedOnAllChanges = array();
350 // Doesn't make sense to have if disabled.
351 if ( !$wgEnotifMinorEdits ) {
352 $wgHiddenPrefs[] = 'enotifminoredits';
355 if ( $wgMetaNamespace === false ) {
356 $wgMetaNamespace = str_replace( ' ', '_', $wgSitename );
359 // Default value is either the suhosin limit or -1 for unlimited
360 if ( $wgResourceLoaderMaxQueryLength === false ) {
361 $maxValueLength = ini_get( 'suhosin.get.max_value_length' );
362 $wgResourceLoaderMaxQueryLength = $maxValueLength > 0 ? $maxValueLength : -1;
366 * Definitions of the NS_ constants are in Defines.php
367 * @private
369 $wgCanonicalNamespaceNames = array(
370 NS_MEDIA => 'Media',
371 NS_SPECIAL => 'Special',
372 NS_TALK => 'Talk',
373 NS_USER => 'User',
374 NS_USER_TALK => 'User_talk',
375 NS_PROJECT => 'Project',
376 NS_PROJECT_TALK => 'Project_talk',
377 NS_FILE => 'File',
378 NS_FILE_TALK => 'File_talk',
379 NS_MEDIAWIKI => 'MediaWiki',
380 NS_MEDIAWIKI_TALK => 'MediaWiki_talk',
381 NS_TEMPLATE => 'Template',
382 NS_TEMPLATE_TALK => 'Template_talk',
383 NS_HELP => 'Help',
384 NS_HELP_TALK => 'Help_talk',
385 NS_CATEGORY => 'Category',
386 NS_CATEGORY_TALK => 'Category_talk',
389 /// @todo UGLY UGLY
390 if ( is_array( $wgExtraNamespaces ) ) {
391 $wgCanonicalNamespaceNames = $wgCanonicalNamespaceNames + $wgExtraNamespaces;
394 // These are now the same, always
395 // To determine the user language, use $wgLang->getCode()
396 $wgContLanguageCode = $wgLanguageCode;
398 // Easy to forget to falsify $wgShowIPinHeader for static caches.
399 // If file cache or squid cache is on, just disable this (DWIMD).
400 // Do the same for $wgDebugToolbar.
401 if ( $wgUseFileCache || $wgUseSquid ) {
402 $wgShowIPinHeader = false;
403 $wgDebugToolbar = false;
406 // We always output HTML5 since 1.22, overriding these is no longer supported
407 // we set them here for extensions that depend on its value.
408 $wgHtml5 = true;
409 $wgXhtmlDefaultNamespace = 'http://www.w3.org/1999/xhtml';
410 $wgJsMimeType = 'text/javascript';
412 if ( !$wgHtml5Version && $wgAllowRdfaAttributes ) {
413 // see http://www.w3.org/TR/rdfa-in-html/#document-conformance
414 if ( $wgMimeType == 'application/xhtml+xml' ) {
415 $wgHtml5Version = 'XHTML+RDFa 1.0';
416 } else {
417 $wgHtml5Version = 'HTML+RDFa 1.0';
421 // Blacklisted file extensions shouldn't appear on the "allowed" list
422 $wgFileExtensions = array_values( array_diff ( $wgFileExtensions, $wgFileBlacklist ) );
424 if ( $wgInvalidateCacheOnLocalSettingsChange ) {
425 // @codingStandardsIgnoreStart Generic.PHP.NoSilencedErrors.Discouraged - No GlobalFunction here yet.
426 $wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis', @filemtime( "$IP/LocalSettings.php" ) ) );
427 // @codingStandardsIgnoreEnd
430 if ( $wgNewUserLog ) {
431 // Add a new log type
432 $wgLogTypes[] = 'newusers';
433 $wgLogNames['newusers'] = 'newuserlogpage';
434 $wgLogHeaders['newusers'] = 'newuserlogpagetext';
435 $wgLogActionsHandlers['newusers/newusers'] = 'NewUsersLogFormatter';
436 $wgLogActionsHandlers['newusers/create'] = 'NewUsersLogFormatter';
437 $wgLogActionsHandlers['newusers/create2'] = 'NewUsersLogFormatter';
438 $wgLogActionsHandlers['newusers/byemail'] = 'NewUsersLogFormatter';
439 $wgLogActionsHandlers['newusers/autocreate'] = 'NewUsersLogFormatter';
442 if ( $wgPageLanguageUseDB ) {
443 $wgLogTypes[] = 'pagelang';
444 $wgLogActionsHandlers['pagelang/pagelang'] = 'PageLangLogFormatter';
447 if ( $wgCookieSecure === 'detect' ) {
448 $wgCookieSecure = ( WebRequest::detectProtocol() === 'https' );
451 // Back compatibility for $wgRateLimitLog deprecated with 1.23
452 if ( $wgRateLimitLog && !array_key_exists( 'ratelimit', $wgDebugLogGroups ) ) {
453 $wgDebugLogGroups['ratelimit'] = $wgRateLimitLog;
456 if ( $wgProfileOnly ) {
457 $wgDebugLogGroups['profileoutput'] = $wgDebugLogFile;
458 $wgDebugLogFile = '';
461 wfProfileOut( $fname . '-defaults' );
463 // Disable MWDebug for command line mode, this prevents MWDebug from eating up
464 // all the memory from logging SQL queries on maintenance scripts
465 global $wgCommandLineMode;
466 if ( $wgDebugToolbar && !$wgCommandLineMode ) {
467 wfProfileIn( $fname . '-debugtoolbar' );
468 MWDebug::init();
469 wfProfileOut( $fname . '-debugtoolbar' );
472 if ( !class_exists( 'AutoLoader' ) ) {
473 require_once "$IP/includes/AutoLoader.php";
476 wfProfileIn( $fname . '-exception' );
477 MWExceptionHandler::installHandler();
478 wfProfileOut( $fname . '-exception' );
480 wfProfileIn( $fname . '-includes' );
481 require_once "$IP/includes/normal/UtfNormalUtil.php";
482 require_once "$IP/includes/GlobalFunctions.php";
483 require_once "$IP/includes/normal/UtfNormalDefines.php";
484 wfProfileOut( $fname . '-includes' );
486 wfProfileIn( $fname . '-defaults2' );
488 if ( $wgCanonicalServer === false ) {
489 $wgCanonicalServer = wfExpandUrl( $wgServer, PROTO_HTTP );
492 // Set server name
493 $serverParts = wfParseUrl( $wgCanonicalServer );
494 if ( $wgServerName !== false ) {
495 wfWarn( '$wgServerName should be derived from $wgCanonicalServer, '
496 . 'not customized. Overwriting $wgServerName.' );
498 $wgServerName = $serverParts['host'];
499 unset( $serverParts );
501 // Set defaults for configuration variables
502 // that are derived from the server name by default
503 if ( $wgEmergencyContact === false ) {
504 $wgEmergencyContact = 'wikiadmin@' . $wgServerName;
507 if ( $wgPasswordSender === false ) {
508 $wgPasswordSender = 'apache@' . $wgServerName;
511 if ( $wgSecureLogin && substr( $wgServer, 0, 2 ) !== '//' ) {
512 $wgSecureLogin = false;
513 wfWarn( 'Secure login was enabled on a server that only supports '
514 . 'HTTP or HTTPS. Disabling secure login.' );
517 // Now that GlobalFunctions is loaded, set defaults that depend
518 // on it.
519 if ( $wgTmpDirectory === false ) {
520 wfProfileIn( $fname . '-tempDir' );
521 $wgTmpDirectory = wfTempDir();
522 wfProfileOut( $fname . '-tempDir' );
525 // We don't use counters anymore. Left here for extensions still
526 // expecting this to exist. Should be removed sometime 1.26 or later.
527 $wgDisableCounters = true;
529 wfProfileOut( $fname . '-defaults2' );
530 wfProfileIn( $fname . '-misc1' );
532 // Raise the memory limit if it's too low
533 wfMemoryLimit();
536 * Set up the timezone, suppressing the pseudo-security warning in PHP 5.1+
537 * that happens whenever you use a date function without the timezone being
538 * explicitly set. Inspired by phpMyAdmin's treatment of the problem.
540 if ( is_null( $wgLocaltimezone ) ) {
541 wfSuppressWarnings();
542 $wgLocaltimezone = date_default_timezone_get();
543 wfRestoreWarnings();
546 date_default_timezone_set( $wgLocaltimezone );
547 if ( is_null( $wgLocalTZoffset ) ) {
548 $wgLocalTZoffset = date( 'Z' ) / 60;
551 // Useful debug output
552 if ( $wgCommandLineMode ) {
553 $wgRequest = new FauxRequest( array() );
555 wfDebug( "\n\nStart command line script $self\n" );
556 } else {
557 // Can't stub this one, it sets up $_GET and $_REQUEST in its constructor
558 $wgRequest = new WebRequest;
560 $debug = "\n\nStart request {$wgRequest->getMethod()} {$wgRequest->getRequestURL()}\n";
562 if ( $wgDebugPrintHttpHeaders ) {
563 $debug .= "HTTP HEADERS:\n";
565 foreach ( $wgRequest->getAllHeaders() as $name => $value ) {
566 $debug .= "$name: $value\n";
569 wfDebug( $debug );
572 wfProfileOut( $fname . '-misc1' );
573 wfProfileIn( $fname . '-memcached' );
575 $wgMemc = wfGetMainCache();
576 $messageMemc = wfGetMessageCacheStorage();
577 $parserMemc = wfGetParserCacheStorage();
578 $wgLangConvMemc = wfGetLangConverterCacheStorage();
580 wfDebugLog( 'caches', 'main: ' . get_class( $wgMemc ) .
581 ', message: ' . get_class( $messageMemc ) .
582 ', parser: ' . get_class( $parserMemc ) );
584 wfProfileOut( $fname . '-memcached' );
586 // Most of the config is out, some might want to run hooks here.
587 wfRunHooks( 'SetupAfterCache' );
589 wfProfileIn( $fname . '-session' );
591 if ( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode ) {
592 // If session.auto_start is there, we can't touch session name
593 if ( !wfIniGetBool( 'session.auto_start' ) ) {
594 session_name( $wgSessionName ? $wgSessionName : $wgCookiePrefix . '_session' );
597 if ( $wgRequest->checkSessionCookie() || isset( $_COOKIE[$wgCookiePrefix . 'Token'] ) ) {
598 wfSetupSession();
602 wfProfileOut( $fname . '-session' );
603 wfProfileIn( $fname . '-globals' );
606 * @var Language $wgContLang
608 $wgContLang = Language::factory( $wgLanguageCode );
609 $wgContLang->initEncoding();
610 $wgContLang->initContLang();
612 // Now that variant lists may be available...
613 $wgRequest->interpolateTitle();
616 * @var User $wgUser
618 $wgUser = RequestContext::getMain()->getUser(); // BackCompat
621 * @var Language $wgLang
623 $wgLang = new StubUserLang;
626 * @var OutputPage $wgOut
628 $wgOut = RequestContext::getMain()->getOutput(); // BackCompat
631 * @var Parser $wgParser
633 $wgParser = new StubObject( 'wgParser', $wgParserConf['class'], array( $wgParserConf ) );
635 if ( !is_object( $wgAuth ) ) {
636 $wgAuth = new AuthPlugin;
637 wfRunHooks( 'AuthPluginSetup', array( &$wgAuth ) );
641 * @var Title $wgTitle
643 $wgTitle = null;
646 * @deprecated since 1.24 Use DeferredUpdates::addUpdate instead
647 * @var array
649 $wgDeferredUpdateList = array();
651 wfProfileOut( $fname . '-globals' );
652 wfProfileIn( $fname . '-extensions' );
654 // Extension setup functions for extensions other than skins
655 // Entries should be added to this variable during the inclusion
656 // of the extension file. This allows the extension to perform
657 // any necessary initialisation in the fully initialised environment
658 foreach ( $wgExtensionFunctions as $func ) {
659 // Allow closures in PHP 5.3+
660 if ( is_object( $func ) && $func instanceof Closure ) {
661 $profName = $fname . '-extensions-closure';
662 } elseif ( is_array( $func ) ) {
663 if ( is_object( $func[0] ) ) {
664 $profName = $fname . '-extensions-' . get_class( $func[0] ) . '::' . $func[1];
665 } else {
666 $profName = $fname . '-extensions-' . implode( '::', $func );
668 } else {
669 $profName = $fname . '-extensions-' . strval( $func );
672 wfProfileIn( $profName );
673 call_user_func( $func );
674 wfProfileOut( $profName );
677 wfDebug( "Fully initialised\n" );
678 $wgFullyInitialised = true;
680 wfProfileOut( $fname . '-extensions' );
681 wfProfileOut( $fname );