Merge "User rights API: Abstract out some stuff about core's form into separate methods"
[mediawiki.git] / includes / Setup.php
blob743936e6ad1a310fd3bf144058d401fd896eb70c
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 if ( !$wgCookiePrefix ) {
310 if ( $wgSharedDB && $wgSharedPrefix && in_array( 'user', $wgSharedTables ) ) {
311 $wgCookiePrefix = $wgSharedDB . '_' . $wgSharedPrefix;
312 } elseif ( $wgSharedDB && in_array( 'user', $wgSharedTables ) ) {
313 $wgCookiePrefix = $wgSharedDB;
314 } elseif ( $wgDBprefix ) {
315 $wgCookiePrefix = $wgDBname . '_' . $wgDBprefix;
316 } else {
317 $wgCookiePrefix = $wgDBname;
320 $wgCookiePrefix = strtr( $wgCookiePrefix, '=,; +."\'\\[', '__________' );
322 if ( $wgEnableEmail ) {
323 $wgUseEnotif = $wgEnotifUserTalk || $wgEnotifWatchlist;
324 } else {
325 // Disable all other email settings automatically if $wgEnableEmail
326 // is set to false. - bug 63678
327 $wgAllowHTMLEmail = false;
328 $wgEmailAuthentication = false; // do not require auth if you're not sending email anyway
329 $wgEnableUserEmail = false;
330 $wgEnotifFromEditor = false;
331 $wgEnotifImpersonal = false;
332 $wgEnotifMaxRecips = 0;
333 $wgEnotifMinorEdits = false;
334 $wgEnotifRevealEditorAddress = false;
335 $wgEnotifUseJobQ = false;
336 $wgEnotifUseRealName = false;
337 $wgEnotifUserTalk = false;
338 $wgEnotifWatchlist = false;
339 unset( $wgGroupPermissions['user']['sendemail'] );
340 $wgUseEnotif = false;
341 $wgUserEmailUseReplyTo = false;
342 $wgUsersNotifiedOnAllChanges = array();
345 // Doesn't make sense to have if disabled.
346 if ( !$wgEnotifMinorEdits ) {
347 $wgHiddenPrefs[] = 'enotifminoredits';
350 if ( $wgMetaNamespace === false ) {
351 $wgMetaNamespace = str_replace( ' ', '_', $wgSitename );
354 // Default value is either the suhosin limit or -1 for unlimited
355 if ( $wgResourceLoaderMaxQueryLength === false ) {
356 $maxValueLength = ini_get( 'suhosin.get.max_value_length' );
357 $wgResourceLoaderMaxQueryLength = $maxValueLength > 0 ? $maxValueLength : -1;
361 * Definitions of the NS_ constants are in Defines.php
362 * @private
364 $wgCanonicalNamespaceNames = array(
365 NS_MEDIA => 'Media',
366 NS_SPECIAL => 'Special',
367 NS_TALK => 'Talk',
368 NS_USER => 'User',
369 NS_USER_TALK => 'User_talk',
370 NS_PROJECT => 'Project',
371 NS_PROJECT_TALK => 'Project_talk',
372 NS_FILE => 'File',
373 NS_FILE_TALK => 'File_talk',
374 NS_MEDIAWIKI => 'MediaWiki',
375 NS_MEDIAWIKI_TALK => 'MediaWiki_talk',
376 NS_TEMPLATE => 'Template',
377 NS_TEMPLATE_TALK => 'Template_talk',
378 NS_HELP => 'Help',
379 NS_HELP_TALK => 'Help_talk',
380 NS_CATEGORY => 'Category',
381 NS_CATEGORY_TALK => 'Category_talk',
384 /// @todo UGLY UGLY
385 if ( is_array( $wgExtraNamespaces ) ) {
386 $wgCanonicalNamespaceNames = $wgCanonicalNamespaceNames + $wgExtraNamespaces;
389 // These are now the same, always
390 // To determine the user language, use $wgLang->getCode()
391 $wgContLanguageCode = $wgLanguageCode;
393 // Easy to forget to falsify $wgShowIPinHeader for static caches.
394 // If file cache or squid cache is on, just disable this (DWIMD).
395 // Do the same for $wgDebugToolbar.
396 if ( $wgUseFileCache || $wgUseSquid ) {
397 $wgShowIPinHeader = false;
398 $wgDebugToolbar = false;
401 // We always output HTML5 since 1.22, overriding these is no longer supported
402 // we set them here for extensions that depend on its value.
403 $wgHtml5 = true;
404 $wgXhtmlDefaultNamespace = 'http://www.w3.org/1999/xhtml';
405 $wgJsMimeType = 'text/javascript';
407 if ( !$wgHtml5Version && $wgAllowRdfaAttributes ) {
408 // see http://www.w3.org/TR/rdfa-in-html/#document-conformance
409 if ( $wgMimeType == 'application/xhtml+xml' ) {
410 $wgHtml5Version = 'XHTML+RDFa 1.0';
411 } else {
412 $wgHtml5Version = 'HTML+RDFa 1.0';
416 // Blacklisted file extensions shouldn't appear on the "allowed" list
417 $wgFileExtensions = array_values( array_diff ( $wgFileExtensions, $wgFileBlacklist ) );
419 if ( $wgInvalidateCacheOnLocalSettingsChange ) {
420 // @codingStandardsIgnoreStart Generic.PHP.NoSilencedErrors.Discouraged - No GlobalFunction here yet.
421 $wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis', @filemtime( "$IP/LocalSettings.php" ) ) );
422 // @codingStandardsIgnoreEnd
425 if ( $wgNewUserLog ) {
426 // Add a new log type
427 $wgLogTypes[] = 'newusers';
428 $wgLogNames['newusers'] = 'newuserlogpage';
429 $wgLogHeaders['newusers'] = 'newuserlogpagetext';
430 $wgLogActionsHandlers['newusers/newusers'] = 'NewUsersLogFormatter';
431 $wgLogActionsHandlers['newusers/create'] = 'NewUsersLogFormatter';
432 $wgLogActionsHandlers['newusers/create2'] = 'NewUsersLogFormatter';
433 $wgLogActionsHandlers['newusers/byemail'] = 'NewUsersLogFormatter';
434 $wgLogActionsHandlers['newusers/autocreate'] = 'NewUsersLogFormatter';
437 if ( $wgPageLanguageUseDB ) {
438 $wgLogTypes[] = 'pagelang';
439 $wgLogActionsHandlers['pagelang/pagelang'] = 'PageLangLogFormatter';
442 if ( $wgCookieSecure === 'detect' ) {
443 $wgCookieSecure = ( WebRequest::detectProtocol() === 'https' );
446 // Back compatibility for $wgRateLimitLog deprecated with 1.23
447 if ( $wgRateLimitLog && !array_key_exists( 'ratelimit', $wgDebugLogGroups ) ) {
448 $wgDebugLogGroups['ratelimit'] = $wgRateLimitLog;
451 if ( $wgProfileOnly ) {
452 $wgDebugLogGroups['profileoutput'] = $wgDebugLogFile;
453 $wgDebugLogFile = '';
456 wfProfileOut( $fname . '-defaults' );
458 // Disable MWDebug for command line mode, this prevents MWDebug from eating up
459 // all the memory from logging SQL queries on maintenance scripts
460 global $wgCommandLineMode;
461 if ( $wgDebugToolbar && !$wgCommandLineMode ) {
462 wfProfileIn( $fname . '-debugtoolbar' );
463 MWDebug::init();
464 wfProfileOut( $fname . '-debugtoolbar' );
467 if ( !class_exists( 'AutoLoader' ) ) {
468 require_once "$IP/includes/AutoLoader.php";
471 wfProfileIn( $fname . '-exception' );
472 MWExceptionHandler::installHandler();
473 wfProfileOut( $fname . '-exception' );
475 wfProfileIn( $fname . '-includes' );
476 require_once "$IP/includes/normal/UtfNormalUtil.php";
477 require_once "$IP/includes/GlobalFunctions.php";
478 require_once "$IP/includes/normal/UtfNormalDefines.php";
479 wfProfileOut( $fname . '-includes' );
481 wfProfileIn( $fname . '-defaults2' );
483 if ( $wgCanonicalServer === false ) {
484 $wgCanonicalServer = wfExpandUrl( $wgServer, PROTO_HTTP );
487 // Set server name
488 $serverParts = wfParseUrl( $wgCanonicalServer );
489 if ( $wgServerName !== false ) {
490 wfWarn( '$wgServerName should be derived from $wgCanonicalServer, '
491 . 'not customized. Overwriting $wgServerName.' );
493 $wgServerName = $serverParts['host'];
494 unset( $serverParts );
496 // Set defaults for configuration variables
497 // that are derived from the server name by default
498 if ( $wgEmergencyContact === false ) {
499 $wgEmergencyContact = 'wikiadmin@' . $wgServerName;
502 if ( $wgPasswordSender === false ) {
503 $wgPasswordSender = 'apache@' . $wgServerName;
506 if ( $wgSecureLogin && substr( $wgServer, 0, 2 ) !== '//' ) {
507 $wgSecureLogin = false;
508 wfWarn( 'Secure login was enabled on a server that only supports '
509 . 'HTTP or HTTPS. Disabling secure login.' );
512 // Now that GlobalFunctions is loaded, set defaults that depend
513 // on it.
514 if ( $wgTmpDirectory === false ) {
515 wfProfileIn( $fname . '-tempDir' );
516 $wgTmpDirectory = wfTempDir();
517 wfProfileOut( $fname . '-tempDir' );
520 wfProfileOut( $fname . '-defaults2' );
521 wfProfileIn( $fname . '-misc1' );
523 // Raise the memory limit if it's too low
524 wfMemoryLimit();
527 * Set up the timezone, suppressing the pseudo-security warning in PHP 5.1+
528 * that happens whenever you use a date function without the timezone being
529 * explicitly set. Inspired by phpMyAdmin's treatment of the problem.
531 if ( is_null( $wgLocaltimezone ) ) {
532 wfSuppressWarnings();
533 $wgLocaltimezone = date_default_timezone_get();
534 wfRestoreWarnings();
537 date_default_timezone_set( $wgLocaltimezone );
538 if ( is_null( $wgLocalTZoffset ) ) {
539 $wgLocalTZoffset = date( 'Z' ) / 60;
542 // Useful debug output
543 if ( $wgCommandLineMode ) {
544 $wgRequest = new FauxRequest( array() );
546 wfDebug( "\n\nStart command line script $self\n" );
547 } else {
548 // Can't stub this one, it sets up $_GET and $_REQUEST in its constructor
549 $wgRequest = new WebRequest;
551 $debug = "\n\nStart request {$wgRequest->getMethod()} {$wgRequest->getRequestURL()}\n";
553 if ( $wgDebugPrintHttpHeaders ) {
554 $debug .= "HTTP HEADERS:\n";
556 foreach ( $wgRequest->getAllHeaders() as $name => $value ) {
557 $debug .= "$name: $value\n";
560 wfDebug( $debug );
563 wfProfileOut( $fname . '-misc1' );
564 wfProfileIn( $fname . '-memcached' );
566 $wgMemc = wfGetMainCache();
567 $messageMemc = wfGetMessageCacheStorage();
568 $parserMemc = wfGetParserCacheStorage();
569 $wgLangConvMemc = wfGetLangConverterCacheStorage();
571 wfDebugLog( 'caches', 'main: ' . get_class( $wgMemc ) .
572 ', message: ' . get_class( $messageMemc ) .
573 ', parser: ' . get_class( $parserMemc ) );
575 wfProfileOut( $fname . '-memcached' );
577 // Most of the config is out, some might want to run hooks here.
578 wfRunHooks( 'SetupAfterCache' );
580 wfProfileIn( $fname . '-session' );
582 if ( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode ) {
583 // If session.auto_start is there, we can't touch session name
584 if ( !wfIniGetBool( 'session.auto_start' ) ) {
585 session_name( $wgSessionName ? $wgSessionName : $wgCookiePrefix . '_session' );
588 if ( $wgRequest->checkSessionCookie() || isset( $_COOKIE[$wgCookiePrefix . 'Token'] ) ) {
589 wfSetupSession();
593 wfProfileOut( $fname . '-session' );
594 wfProfileIn( $fname . '-globals' );
597 * @var Language $wgContLang
599 $wgContLang = Language::factory( $wgLanguageCode );
600 $wgContLang->initEncoding();
601 $wgContLang->initContLang();
603 // Now that variant lists may be available...
604 $wgRequest->interpolateTitle();
607 * @var User $wgUser
609 $wgUser = RequestContext::getMain()->getUser(); // BackCompat
612 * @var Language $wgLang
614 $wgLang = new StubUserLang;
617 * @var OutputPage $wgOut
619 $wgOut = RequestContext::getMain()->getOutput(); // BackCompat
622 * @var Parser $wgParser
624 $wgParser = new StubObject( 'wgParser', $wgParserConf['class'], array( $wgParserConf ) );
626 if ( !is_object( $wgAuth ) ) {
627 $wgAuth = new AuthPlugin;
628 wfRunHooks( 'AuthPluginSetup', array( &$wgAuth ) );
632 * @var Title $wgTitle
634 $wgTitle = null;
637 * @deprecated since 1.24 Use DeferredUpdates::addUpdate instead
638 * @var array
640 $wgDeferredUpdateList = array();
642 wfProfileOut( $fname . '-globals' );
643 wfProfileIn( $fname . '-extensions' );
645 // Extension setup functions for extensions other than skins
646 // Entries should be added to this variable during the inclusion
647 // of the extension file. This allows the extension to perform
648 // any necessary initialisation in the fully initialised environment
649 foreach ( $wgExtensionFunctions as $func ) {
650 // Allow closures in PHP 5.3+
651 if ( is_object( $func ) && $func instanceof Closure ) {
652 $profName = $fname . '-extensions-closure';
653 } elseif ( is_array( $func ) ) {
654 if ( is_object( $func[0] ) ) {
655 $profName = $fname . '-extensions-' . get_class( $func[0] ) . '::' . $func[1];
656 } else {
657 $profName = $fname . '-extensions-' . implode( '::', $func );
659 } else {
660 $profName = $fname . '-extensions-' . strval( $func );
663 wfProfileIn( $profName );
664 call_user_func( $func );
665 wfProfileOut( $profName );
668 wfDebug( "Fully initialised\n" );
669 $wgFullyInitialised = true;
671 wfProfileOut( $fname . '-extensions' );
672 wfProfileOut( $fname );