Merge "Remove ParserOptions::setSkin() (deprecated since 1.19)"
[mediawiki.git] / includes / Setup.php
blob78655a45def1170c91949bae4e126d590c230b82
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";
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";
89 if ( $wgLogo === false ) {
90 $wgLogo = "$wgStylePath/common/images/wiki.png";
93 if ( $wgUploadPath === false ) {
94 $wgUploadPath = "$wgScriptPath/images";
96 if ( $wgUploadDirectory === false ) {
97 $wgUploadDirectory = "$IP/images";
99 if ( $wgReadOnlyFile === false ) {
100 $wgReadOnlyFile = "{$wgUploadDirectory}/lock_yBgMBwiR";
102 if ( $wgFileCacheDirectory === false ) {
103 $wgFileCacheDirectory = "{$wgUploadDirectory}/cache";
105 if ( $wgDeletedDirectory === false ) {
106 $wgDeletedDirectory = "{$wgUploadDirectory}/deleted";
109 if ( $wgGitInfoCacheDirectory === false && $wgCacheDirectory !== false ) {
110 $wgGitInfoCacheDirectory = "{$wgCacheDirectory}/gitinfo";
113 if ( isset( $wgFileStore['deleted']['directory'] ) ) {
114 $wgDeletedDirectory = $wgFileStore['deleted']['directory'];
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 "$wgStylePath/common/images/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 if ( isset( $wgFileStore['deleted']['hash'] ) ) {
177 $deletedHashLevel = $wgFileStore['deleted']['hash'];
178 } else {
179 $deletedHashLevel = $wgHashedUploadDirectory ? 3 : 0;
181 $wgLocalFileRepo = array(
182 'class' => 'LocalRepo',
183 'name' => 'local',
184 'directory' => $wgUploadDirectory,
185 'scriptDirUrl' => $wgScriptPath,
186 'scriptExtension' => $wgScriptExtension,
187 'url' => $wgUploadBaseUrl ? $wgUploadBaseUrl . $wgUploadPath : $wgUploadPath,
188 'hashLevels' => $wgHashedUploadDirectory ? 2 : 0,
189 'thumbScriptUrl' => $wgThumbnailScriptPath,
190 'transformVia404' => !$wgGenerateThumbnailOnParse,
191 'deletedDir' => $wgDeletedDirectory,
192 'deletedHashLevels' => $deletedHashLevel
196 * Initialise shared repo from backwards-compatible settings
198 if ( $wgUseSharedUploads ) {
199 if ( $wgSharedUploadDBname ) {
200 $wgForeignFileRepos[] = array(
201 'class' => 'ForeignDBRepo',
202 'name' => 'shared',
203 'directory' => $wgSharedUploadDirectory,
204 'url' => $wgSharedUploadPath,
205 'hashLevels' => $wgHashedSharedUploadDirectory ? 2 : 0,
206 'thumbScriptUrl' => $wgSharedThumbnailScriptPath,
207 'transformVia404' => !$wgGenerateThumbnailOnParse,
208 'dbType' => $wgDBtype,
209 'dbServer' => $wgDBserver,
210 'dbUser' => $wgDBuser,
211 'dbPassword' => $wgDBpassword,
212 'dbName' => $wgSharedUploadDBname,
213 'dbFlags' => ( $wgDebugDumpSql ? DBO_DEBUG : 0 ) | DBO_DEFAULT,
214 'tablePrefix' => $wgSharedUploadDBprefix,
215 'hasSharedCache' => $wgCacheSharedUploads,
216 'descBaseUrl' => $wgRepositoryBaseUrl,
217 'fetchDescription' => $wgFetchCommonsDescriptions,
219 } else {
220 $wgForeignFileRepos[] = array(
221 'class' => 'FileRepo',
222 'name' => 'shared',
223 'directory' => $wgSharedUploadDirectory,
224 'url' => $wgSharedUploadPath,
225 'hashLevels' => $wgHashedSharedUploadDirectory ? 2 : 0,
226 'thumbScriptUrl' => $wgSharedThumbnailScriptPath,
227 'transformVia404' => !$wgGenerateThumbnailOnParse,
228 'descBaseUrl' => $wgRepositoryBaseUrl,
229 'fetchDescription' => $wgFetchCommonsDescriptions,
233 if ( $wgUseInstantCommons ) {
234 $wgForeignFileRepos[] = array(
235 'class' => 'ForeignAPIRepo',
236 'name' => 'wikimediacommons',
237 'apibase' => WebRequest::detectProtocol() === 'https' ?
238 'https://commons.wikimedia.org/w/api.php' :
239 'http://commons.wikimedia.org/w/api.php',
240 'hashLevels' => 2,
241 'fetchDescription' => true,
242 'descriptionCacheExpiry' => 43200,
243 'apiThumbCacheExpiry' => 86400,
247 * Add on default file backend config for file repos.
248 * FileBackendGroup will handle initializing the backends.
250 if ( !isset( $wgLocalFileRepo['backend'] ) ) {
251 $wgLocalFileRepo['backend'] = $wgLocalFileRepo['name'] . '-backend';
253 foreach ( $wgForeignFileRepos as &$repo ) {
254 if ( !isset( $repo['directory'] ) && $repo['class'] === 'ForeignAPIRepo' ) {
255 $repo['directory'] = $wgUploadDirectory; // b/c
257 if ( !isset( $repo['backend'] ) ) {
258 $repo['backend'] = $repo['name'] . '-backend';
261 unset( $repo ); // no global pollution; destroy reference
263 if ( $wgRCFilterByAge ) {
264 // Trim down $wgRCLinkDays so that it only lists links which are valid
265 // as determined by $wgRCMaxAge.
266 // Note that we allow 1 link higher than the max for things like 56 days but a 60 day link.
267 sort( $wgRCLinkDays );
269 // @codingStandardsIgnoreStart Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed
270 for ( $i = 0; $i < count( $wgRCLinkDays ); $i++ ) {
271 // @codingStandardsIgnoreEnd
272 if ( $wgRCLinkDays[$i] >= $wgRCMaxAge / ( 3600 * 24 ) ) {
273 $wgRCLinkDays = array_slice( $wgRCLinkDays, 0, $i + 1, false );
274 break;
279 if ( $wgSkipSkin ) {
280 $wgSkipSkins[] = $wgSkipSkin;
283 if ( $wgLocalInterwiki ) {
284 array_unshift( $wgLocalInterwikis, $wgLocalInterwiki );
287 // Set default shared prefix
288 if ( $wgSharedPrefix === false ) {
289 $wgSharedPrefix = $wgDBprefix;
292 if ( !$wgCookiePrefix ) {
293 if ( $wgSharedDB && $wgSharedPrefix && in_array( 'user', $wgSharedTables ) ) {
294 $wgCookiePrefix = $wgSharedDB . '_' . $wgSharedPrefix;
295 } elseif ( $wgSharedDB && in_array( 'user', $wgSharedTables ) ) {
296 $wgCookiePrefix = $wgSharedDB;
297 } elseif ( $wgDBprefix ) {
298 $wgCookiePrefix = $wgDBname . '_' . $wgDBprefix;
299 } else {
300 $wgCookiePrefix = $wgDBname;
303 $wgCookiePrefix = strtr( $wgCookiePrefix, '=,; +."\'\\[', '__________' );
305 $wgUseEnotif = $wgEnotifUserTalk || $wgEnotifWatchlist;
307 if ( $wgMetaNamespace === false ) {
308 $wgMetaNamespace = str_replace( ' ', '_', $wgSitename );
311 // Default value is either the suhosin limit or -1 for unlimited
312 if ( $wgResourceLoaderMaxQueryLength === false ) {
313 $maxValueLength = ini_get( 'suhosin.get.max_value_length' );
314 $wgResourceLoaderMaxQueryLength = $maxValueLength > 0 ? $maxValueLength : -1;
318 * Definitions of the NS_ constants are in Defines.php
319 * @private
321 $wgCanonicalNamespaceNames = array(
322 NS_MEDIA => 'Media',
323 NS_SPECIAL => 'Special',
324 NS_TALK => 'Talk',
325 NS_USER => 'User',
326 NS_USER_TALK => 'User_talk',
327 NS_PROJECT => 'Project',
328 NS_PROJECT_TALK => 'Project_talk',
329 NS_FILE => 'File',
330 NS_FILE_TALK => 'File_talk',
331 NS_MEDIAWIKI => 'MediaWiki',
332 NS_MEDIAWIKI_TALK => 'MediaWiki_talk',
333 NS_TEMPLATE => 'Template',
334 NS_TEMPLATE_TALK => 'Template_talk',
335 NS_HELP => 'Help',
336 NS_HELP_TALK => 'Help_talk',
337 NS_CATEGORY => 'Category',
338 NS_CATEGORY_TALK => 'Category_talk',
341 /// @todo UGLY UGLY
342 if ( is_array( $wgExtraNamespaces ) ) {
343 $wgCanonicalNamespaceNames = $wgCanonicalNamespaceNames + $wgExtraNamespaces;
346 // These are now the same, always
347 // To determine the user language, use $wgLang->getCode()
348 $wgContLanguageCode = $wgLanguageCode;
350 // Easy to forget to falsify $wgShowIPinHeader for static caches.
351 // If file cache or squid cache is on, just disable this (DWIMD).
352 // Do the same for $wgDebugToolbar.
353 if ( $wgUseFileCache || $wgUseSquid ) {
354 $wgShowIPinHeader = false;
355 $wgDebugToolbar = false;
358 // Doesn't make sense to have if disabled.
359 if ( !$wgEnotifMinorEdits ) {
360 $wgHiddenPrefs[] = 'enotifminoredits';
363 // We always output HTML5 since 1.22, overriding these is no longer supported
364 // we set them here for extensions that depend on its value.
365 $wgHtml5 = true;
366 $wgXhtmlDefaultNamespace = 'http://www.w3.org/1999/xhtml';
367 $wgJsMimeType = 'text/javascript';
369 if ( !$wgHtml5Version && $wgAllowRdfaAttributes ) {
370 // see http://www.w3.org/TR/rdfa-in-html/#document-conformance
371 if ( $wgMimeType == 'application/xhtml+xml' ) {
372 $wgHtml5Version = 'XHTML+RDFa 1.0';
373 } else {
374 $wgHtml5Version = 'HTML+RDFa 1.0';
378 // Blacklisted file extensions shouldn't appear on the "allowed" list
379 $wgFileExtensions = array_values( array_diff ( $wgFileExtensions, $wgFileBlacklist ) );
381 if ( $wgArticleCountMethod === null ) {
382 $wgArticleCountMethod = $wgUseCommaCount ? 'comma' : 'link';
385 if ( $wgInvalidateCacheOnLocalSettingsChange ) {
386 // @codingStandardsIgnoreStart Generic.PHP.NoSilencedErrors.Discouraged - No GlobalFunction here yet.
387 $wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis', @filemtime( "$IP/LocalSettings.php" ) ) );
388 // @codingStandardsIgnoreEnd
391 if ( $wgNewUserLog ) {
392 // Add a new log type
393 $wgLogTypes[] = 'newusers';
394 $wgLogNames['newusers'] = 'newuserlogpage';
395 $wgLogHeaders['newusers'] = 'newuserlogpagetext';
396 $wgLogActionsHandlers['newusers/newusers'] = 'NewUsersLogFormatter';
397 $wgLogActionsHandlers['newusers/create'] = 'NewUsersLogFormatter';
398 $wgLogActionsHandlers['newusers/create2'] = 'NewUsersLogFormatter';
399 $wgLogActionsHandlers['newusers/byemail'] = 'NewUsersLogFormatter';
400 $wgLogActionsHandlers['newusers/autocreate'] = 'NewUsersLogFormatter';
403 if ( $wgPageLanguageUseDB ) {
404 $wgLogTypes[] = 'pagelang';
405 $wgLogActionsHandlers['pagelang/pagelang'] = 'PageLangLogFormatter';
408 if ( $wgCookieSecure === 'detect' ) {
409 $wgCookieSecure = ( WebRequest::detectProtocol() === 'https' );
412 if ( $wgRC2UDPAddress ) {
413 $wgRCFeeds['default'] = array(
414 'formatter' => 'IRCColourfulRCFeedFormatter',
415 'uri' => "udp://$wgRC2UDPAddress:$wgRC2UDPPort/$wgRC2UDPPrefix",
416 'add_interwiki_prefix' => &$wgRC2UDPInterwikiPrefix,
417 'omit_bots' => &$wgRC2UDPOmitBots,
421 wfProfileOut( $fname . '-defaults' );
423 // Disable MWDebug for command line mode, this prevents MWDebug from eating up
424 // all the memory from logging SQL queries on maintenance scripts
425 global $wgCommandLineMode;
426 if ( $wgDebugToolbar && !$wgCommandLineMode ) {
427 wfProfileIn( $fname . '-debugtoolbar' );
428 MWDebug::init();
429 wfProfileOut( $fname . '-debugtoolbar' );
432 if ( !class_exists( 'AutoLoader' ) ) {
433 require_once "$IP/includes/AutoLoader.php";
436 wfProfileIn( $fname . '-exception' );
437 MWExceptionHandler::installHandler();
438 wfProfileOut( $fname . '-exception' );
440 wfProfileIn( $fname . '-includes' );
441 require_once "$IP/includes/normal/UtfNormalUtil.php";
442 require_once "$IP/includes/GlobalFunctions.php";
443 require_once "$IP/includes/normal/UtfNormalDefines.php";
444 wfProfileOut( $fname . '-includes' );
446 wfProfileIn( $fname . '-defaults2' );
448 if ( $wgCanonicalServer === false ) {
449 $wgCanonicalServer = wfExpandUrl( $wgServer, PROTO_HTTP );
452 // Set server name
453 $serverParts = wfParseUrl( $wgCanonicalServer );
454 if ( $wgServerName !== false ) {
455 wfWarn( '$wgServerName should be derived from $wgCanonicalServer, '
456 . 'not customized. Overwriting $wgServerName.' );
458 $wgServerName = $serverParts['host'];
459 unset( $serverParts );
461 // Set defaults for configuration variables
462 // that are derived from the server name by default
463 if ( $wgEmergencyContact === false ) {
464 $wgEmergencyContact = 'wikiadmin@' . $wgServerName;
467 if ( $wgPasswordSender === false ) {
468 $wgPasswordSender = 'apache@' . $wgServerName;
471 if ( $wgSecureLogin && substr( $wgServer, 0, 2 ) !== '//' ) {
472 $wgSecureLogin = false;
473 wfWarn( 'Secure login was enabled on a server that only supports '
474 . 'HTTP or HTTPS. Disabling secure login.' );
477 // Now that GlobalFunctions is loaded, set defaults that depend
478 // on it.
479 if ( $wgTmpDirectory === false ) {
480 wfProfileIn( $fname . '-tempDir' );
481 $wgTmpDirectory = wfTempDir();
482 wfProfileOut( $fname . '-tempDir' );
485 // $wgHTCPMulticastRouting got renamed to $wgHTCPRouting in MediaWiki 1.22
486 // ensure back compatibility.
487 if ( !$wgHTCPRouting && $wgHTCPMulticastRouting ) {
488 $wgHTCPRouting = $wgHTCPMulticastRouting;
491 // Initialize $wgHTCPRouting from backwards-compatible settings that
492 // comes from pre 1.20 version.
493 if ( !$wgHTCPRouting && $wgHTCPMulticastAddress ) {
494 $wgHTCPRouting = array(
495 '' => array(
496 'host' => $wgHTCPMulticastAddress,
497 'port' => $wgHTCPPort,
502 // Back compatibility for $wgRateLimitLog deprecated with 1.23
503 if ( $wgRateLimitLog && ! array_key_exists( 'ratelimit', $wgDebugLogGroups ) ) {
504 $wgDebugLogGroups['ratelimit'] = $wgRateLimitLog;
507 if ( $wgProfileOnly ) {
508 $wgDebugLogGroups['profileoutput'] = $wgDebugLogFile;
509 $wgDebugLogFile = '';
512 wfProfileOut( $fname . '-defaults2' );
513 wfProfileIn( $fname . '-misc1' );
515 // Raise the memory limit if it's too low
516 wfMemoryLimit();
519 * Set up the timezone, suppressing the pseudo-security warning in PHP 5.1+
520 * that happens whenever you use a date function without the timezone being
521 * explicitly set. Inspired by phpMyAdmin's treatment of the problem.
523 if ( is_null( $wgLocaltimezone ) ) {
524 wfSuppressWarnings();
525 $wgLocaltimezone = date_default_timezone_get();
526 wfRestoreWarnings();
529 date_default_timezone_set( $wgLocaltimezone );
530 if ( is_null( $wgLocalTZoffset ) ) {
531 $wgLocalTZoffset = date( 'Z' ) / 60;
534 // Useful debug output
535 if ( $wgCommandLineMode ) {
536 $wgRequest = new FauxRequest( array() );
538 wfDebug( "\n\nStart command line script $self\n" );
539 } else {
540 // Can't stub this one, it sets up $_GET and $_REQUEST in its constructor
541 $wgRequest = new WebRequest;
543 $debug = "\n\nStart request {$wgRequest->getMethod()} {$wgRequest->getRequestURL()}\n";
545 if ( $wgDebugPrintHttpHeaders ) {
546 $debug .= "HTTP HEADERS:\n";
548 foreach ( $wgRequest->getAllHeaders() as $name => $value ) {
549 $debug .= "$name: $value\n";
552 wfDebug( $debug );
555 wfProfileOut( $fname . '-misc1' );
556 wfProfileIn( $fname . '-memcached' );
558 $wgMemc = wfGetMainCache();
559 $messageMemc = wfGetMessageCacheStorage();
560 $parserMemc = wfGetParserCacheStorage();
561 $wgLangConvMemc = wfGetLangConverterCacheStorage();
563 wfDebugLog( 'caches', 'main: ' . get_class( $wgMemc ) .
564 ', message: ' . get_class( $messageMemc ) .
565 ', parser: ' . get_class( $parserMemc ) );
567 wfProfileOut( $fname . '-memcached' );
569 // Most of the config is out, some might want to run hooks here.
570 wfRunHooks( 'SetupAfterCache' );
572 wfProfileIn( $fname . '-session' );
574 // If session.auto_start is there, we can't touch session name
575 if ( !wfIniGetBool( 'session.auto_start' ) ) {
576 session_name( $wgSessionName ? $wgSessionName : $wgCookiePrefix . '_session' );
579 if ( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode &&
580 ( $wgRequest->checkSessionCookie() || isset( $_COOKIE[$wgCookiePrefix . 'Token'] ) )
582 wfSetupSession();
585 wfProfileOut( $fname . '-session' );
586 wfProfileIn( $fname . '-globals' );
589 * @var Language $wgContLang
591 $wgContLang = Language::factory( $wgLanguageCode );
592 $wgContLang->initEncoding();
593 $wgContLang->initContLang();
595 // Now that variant lists may be available...
596 $wgRequest->interpolateTitle();
599 * @var User $wgUser
601 $wgUser = RequestContext::getMain()->getUser(); // BackCompat
604 * @var Language $wgLang
606 $wgLang = new StubUserLang;
609 * @var OutputPage $wgOut
611 $wgOut = RequestContext::getMain()->getOutput(); // BackCompat
614 * @var Parser $wgParser
616 $wgParser = new StubObject( 'wgParser', $wgParserConf['class'], array( $wgParserConf ) );
618 if ( !is_object( $wgAuth ) ) {
619 $wgAuth = new AuthPlugin;
620 wfRunHooks( 'AuthPluginSetup', array( &$wgAuth ) );
624 * @var Title $wgTitle
626 $wgTitle = null;
628 $wgDeferredUpdateList = array();
630 wfProfileOut( $fname . '-globals' );
631 wfProfileIn( $fname . '-extensions' );
633 // Extension setup functions for extensions other than skins
634 // Entries should be added to this variable during the inclusion
635 // of the extension file. This allows the extension to perform
636 // any necessary initialisation in the fully initialised environment
637 foreach ( $wgExtensionFunctions as $func ) {
638 // Allow closures in PHP 5.3+
639 if ( is_object( $func ) && $func instanceof Closure ) {
640 $profName = $fname . '-extensions-closure';
641 } elseif ( is_array( $func ) ) {
642 if ( is_object( $func[0] ) ) {
643 $profName = $fname . '-extensions-' . get_class( $func[0] ) . '::' . $func[1];
644 } else {
645 $profName = $fname . '-extensions-' . implode( '::', $func );
647 } else {
648 $profName = $fname . '-extensions-' . strval( $func );
651 wfProfileIn( $profName );
652 call_user_func( $func );
653 wfProfileOut( $profName );
656 wfDebug( "Fully initialised\n" );
657 $wgFullyInitialised = true;
659 wfProfileOut( $fname . '-extensions' );
660 wfProfileOut( $fname );