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
28 * This file is not a valid entry point, perform no further processing unless
29 * MEDIAWIKI is defined
31 if ( !defined( 'MEDIAWIKI' ) ) {
36 wfProfileIn( $fname );
38 // If any extensions are still queued, force load them
39 ExtensionRegistry
::getInstance()->loadFromQueue();
41 wfProfileIn( $fname . '-defaults' );
43 // Check to see if we are at the file scope
44 if ( !isset( $wgVersion ) ) {
45 echo "Error, Setup.php must be included from the file scope, after DefaultSettings.php\n";
49 // Set various default paths sensibly...
51 if ( $wgScript === false ) {
52 $wgScript = "$wgScriptPath/index$wgScriptExtension";
54 if ( $wgLoadScript === false ) {
55 $wgLoadScript = "$wgScriptPath/load$wgScriptExtension";
58 if ( $wgArticlePath === false ) {
59 if ( $wgUsePathInfo ) {
60 $wgArticlePath = "$wgScript/$1";
62 $wgArticlePath = "$wgScript?title=$1";
66 if ( !empty( $wgActionPaths ) && !isset( $wgActionPaths['view'] ) ) {
67 // 'view' is assumed the default action path everywhere in the code
68 // but is rarely filled in $wgActionPaths
69 $wgActionPaths['view'] = $wgArticlePath;
72 if ( $wgStylePath === false ) {
73 $wgStylePath = "$wgScriptPath/skins";
75 if ( $wgLocalStylePath === false ) {
76 $wgLocalStylePath = "$wgScriptPath/skins";
78 if ( $wgStyleDirectory === false ) {
79 $wgStyleDirectory = "$IP/skins";
81 if ( $wgExtensionAssetsPath === false ) {
82 $wgExtensionAssetsPath = "$wgScriptPath/extensions";
84 if ( $wgResourceBasePath === null ) {
85 $wgResourceBasePath = $wgScriptPath;
88 if ( $wgLogo === false ) {
89 $wgLogo = "$wgResourceBasePath/resources/assets/wiki.png";
92 if ( $wgUploadPath === false ) {
93 $wgUploadPath = "$wgScriptPath/images";
95 if ( $wgUploadDirectory === false ) {
96 $wgUploadDirectory = "$IP/images";
98 if ( $wgReadOnlyFile === false ) {
99 $wgReadOnlyFile = "{$wgUploadDirectory}/lock_yBgMBwiR";
101 if ( $wgFileCacheDirectory === false ) {
102 $wgFileCacheDirectory = "{$wgUploadDirectory}/cache";
104 if ( $wgDeletedDirectory === false ) {
105 $wgDeletedDirectory = "{$wgUploadDirectory}/deleted";
108 if ( $wgGitInfoCacheDirectory === false && $wgCacheDirectory !== false ) {
109 $wgGitInfoCacheDirectory = "{$wgCacheDirectory}/gitinfo";
112 // Fix path to icon images after they were moved in 1.24
113 if ( $wgRightsIcon ) {
114 $wgRightsIcon = str_replace(
115 "{$wgStylePath}/common/images/",
116 "{$wgResourceBasePath}/resources/assets/licenses/",
121 if ( isset( $wgFooterIcons['copyright'] )
122 && isset( $wgFooterIcons['copyright']['copyright'] )
123 && $wgFooterIcons['copyright']['copyright'] === array()
125 if ( $wgCopyrightIcon ) {
126 $wgFooterIcons['copyright']['copyright'] = $wgCopyrightIcon;
127 } elseif ( $wgRightsIcon ||
$wgRightsText ) {
128 $wgFooterIcons['copyright']['copyright'] = array(
129 'url' => $wgRightsUrl,
130 'src' => $wgRightsIcon,
131 'alt' => $wgRightsText,
134 unset( $wgFooterIcons['copyright']['copyright'] );
138 if ( isset( $wgFooterIcons['poweredby'] )
139 && isset( $wgFooterIcons['poweredby']['mediawiki'] )
140 && $wgFooterIcons['poweredby']['mediawiki']['src'] === null
142 $wgFooterIcons['poweredby']['mediawiki']['src'] =
143 "$wgResourceBasePath/resources/assets/poweredby_mediawiki_88x31.png";
147 * Unconditional protection for NS_MEDIAWIKI since otherwise it's too easy for a
148 * sysadmin to set $wgNamespaceProtection incorrectly and leave the wiki insecure.
150 * Note that this is the definition of editinterface and it can be granted to
151 * all users if desired.
153 $wgNamespaceProtection[NS_MEDIAWIKI
] = 'editinterface';
156 * The canonical names of namespaces 6 and 7 are, as of v1.14, "File"
157 * and "File_talk". The old names "Image" and "Image_talk" are
158 * retained as aliases for backwards compatibility.
160 $wgNamespaceAliases['Image'] = NS_FILE
;
161 $wgNamespaceAliases['Image_talk'] = NS_FILE_TALK
;
164 * Initialise $wgLockManagers to include basic FS version
166 $wgLockManagers[] = array(
167 'name' => 'fsLockManager',
168 'class' => 'FSLockManager',
169 'lockDirectory' => "{$wgUploadDirectory}/lockdir",
171 $wgLockManagers[] = array(
172 'name' => 'nullLockManager',
173 'class' => 'NullLockManager',
177 * Initialise $wgLocalFileRepo from backwards-compatible settings
179 if ( !$wgLocalFileRepo ) {
180 $wgLocalFileRepo = array(
181 'class' => 'LocalRepo',
183 'directory' => $wgUploadDirectory,
184 'scriptDirUrl' => $wgScriptPath,
185 'scriptExtension' => $wgScriptExtension,
186 'url' => $wgUploadBaseUrl ?
$wgUploadBaseUrl . $wgUploadPath : $wgUploadPath,
187 'hashLevels' => $wgHashedUploadDirectory ?
2 : 0,
188 'thumbScriptUrl' => $wgThumbnailScriptPath,
189 'transformVia404' => !$wgGenerateThumbnailOnParse,
190 'deletedDir' => $wgDeletedDirectory,
191 'deletedHashLevels' => $wgHashedUploadDirectory ?
3 : 0
195 * Initialise shared repo from backwards-compatible settings
197 if ( $wgUseSharedUploads ) {
198 if ( $wgSharedUploadDBname ) {
199 $wgForeignFileRepos[] = array(
200 'class' => 'ForeignDBRepo',
202 'directory' => $wgSharedUploadDirectory,
203 'url' => $wgSharedUploadPath,
204 'hashLevels' => $wgHashedSharedUploadDirectory ?
2 : 0,
205 'thumbScriptUrl' => $wgSharedThumbnailScriptPath,
206 'transformVia404' => !$wgGenerateThumbnailOnParse,
207 'dbType' => $wgDBtype,
208 'dbServer' => $wgDBserver,
209 'dbUser' => $wgDBuser,
210 'dbPassword' => $wgDBpassword,
211 'dbName' => $wgSharedUploadDBname,
212 'dbFlags' => ( $wgDebugDumpSql ? DBO_DEBUG
: 0 ) | DBO_DEFAULT
,
213 'tablePrefix' => $wgSharedUploadDBprefix,
214 'hasSharedCache' => $wgCacheSharedUploads,
215 'descBaseUrl' => $wgRepositoryBaseUrl,
216 'fetchDescription' => $wgFetchCommonsDescriptions,
219 $wgForeignFileRepos[] = array(
220 'class' => 'FileRepo',
222 'directory' => $wgSharedUploadDirectory,
223 'url' => $wgSharedUploadPath,
224 'hashLevels' => $wgHashedSharedUploadDirectory ?
2 : 0,
225 'thumbScriptUrl' => $wgSharedThumbnailScriptPath,
226 'transformVia404' => !$wgGenerateThumbnailOnParse,
227 'descBaseUrl' => $wgRepositoryBaseUrl,
228 'fetchDescription' => $wgFetchCommonsDescriptions,
232 if ( $wgUseInstantCommons ) {
233 $wgForeignFileRepos[] = array(
234 'class' => 'ForeignAPIRepo',
235 'name' => 'wikimediacommons',
236 'apibase' => WebRequest
::detectProtocol() === 'https' ?
237 'https://commons.wikimedia.org/w/api.php' :
238 'http://commons.wikimedia.org/w/api.php',
240 'fetchDescription' => true,
241 'descriptionCacheExpiry' => 43200,
242 'apiThumbCacheExpiry' => 86400,
246 * Add on default file backend config for file repos.
247 * FileBackendGroup will handle initializing the backends.
249 if ( !isset( $wgLocalFileRepo['backend'] ) ) {
250 $wgLocalFileRepo['backend'] = $wgLocalFileRepo['name'] . '-backend';
252 foreach ( $wgForeignFileRepos as &$repo ) {
253 if ( !isset( $repo['directory'] ) && $repo['class'] === 'ForeignAPIRepo' ) {
254 $repo['directory'] = $wgUploadDirectory; // b/c
256 if ( !isset( $repo['backend'] ) ) {
257 $repo['backend'] = $repo['name'] . '-backend';
260 unset( $repo ); // no global pollution; destroy reference
262 if ( $wgRCFilterByAge ) {
263 // Trim down $wgRCLinkDays so that it only lists links which are valid
264 // as determined by $wgRCMaxAge.
265 // Note that we allow 1 link higher than the max for things like 56 days but a 60 day link.
266 sort( $wgRCLinkDays );
268 // @codingStandardsIgnoreStart Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed
269 for ( $i = 0; $i < count( $wgRCLinkDays ); $i++
) {
270 // @codingStandardsIgnoreEnd
271 if ( $wgRCLinkDays[$i] >= $wgRCMaxAge / ( 3600 * 24 ) ) {
272 $wgRCLinkDays = array_slice( $wgRCLinkDays, 0, $i +
1, false );
279 $wgSkipSkins[] = $wgSkipSkin;
283 // Use a closure to avoid leaking into global state
284 call_user_func( function () use ( $wgValidSkinNames ) {
285 $factory = SkinFactory
::getDefaultInstance();
286 foreach ( $wgValidSkinNames as $name => $skin ) {
287 $factory->register( $name, $skin, function () use ( $name, $skin ) {
288 $class = "Skin$skin";
289 return new $class( $name );
292 // Register a hidden "fallback" skin
293 $factory->register( 'fallback', 'Fallback', function () {
294 return new SkinFallback
;
296 // Register a hidden skin for api output
297 $factory->register( 'apioutput', 'ApiOutput', function () {
301 $wgSkipSkins[] = 'fallback';
302 $wgSkipSkins[] = 'apioutput';
304 if ( $wgLocalInterwiki ) {
305 array_unshift( $wgLocalInterwikis, $wgLocalInterwiki );
308 // Set default shared prefix
309 if ( $wgSharedPrefix === false ) {
310 $wgSharedPrefix = $wgDBprefix;
313 // Set default shared schema
314 if ( $wgSharedSchema === false ) {
315 $wgSharedSchema = $wgDBmwschema;
318 if ( !$wgCookiePrefix ) {
319 if ( $wgSharedDB && $wgSharedPrefix && in_array( 'user', $wgSharedTables ) ) {
320 $wgCookiePrefix = $wgSharedDB . '_' . $wgSharedPrefix;
321 } elseif ( $wgSharedDB && in_array( 'user', $wgSharedTables ) ) {
322 $wgCookiePrefix = $wgSharedDB;
323 } elseif ( $wgDBprefix ) {
324 $wgCookiePrefix = $wgDBname . '_' . $wgDBprefix;
326 $wgCookiePrefix = $wgDBname;
329 $wgCookiePrefix = strtr( $wgCookiePrefix, '=,; +."\'\\[', '__________' );
331 if ( $wgEnableEmail ) {
332 $wgUseEnotif = $wgEnotifUserTalk ||
$wgEnotifWatchlist;
334 // Disable all other email settings automatically if $wgEnableEmail
335 // is set to false. - bug 63678
336 $wgAllowHTMLEmail = false;
337 $wgEmailAuthentication = false; // do not require auth if you're not sending email anyway
338 $wgEnableUserEmail = false;
339 $wgEnotifFromEditor = false;
340 $wgEnotifImpersonal = false;
341 $wgEnotifMaxRecips = 0;
342 $wgEnotifMinorEdits = false;
343 $wgEnotifRevealEditorAddress = false;
344 $wgEnotifUseJobQ = false;
345 $wgEnotifUseRealName = false;
346 $wgEnotifUserTalk = false;
347 $wgEnotifWatchlist = false;
348 unset( $wgGroupPermissions['user']['sendemail'] );
349 $wgUseEnotif = false;
350 $wgUserEmailUseReplyTo = false;
351 $wgUsersNotifiedOnAllChanges = array();
354 // Doesn't make sense to have if disabled.
355 if ( !$wgEnotifMinorEdits ) {
356 $wgHiddenPrefs[] = 'enotifminoredits';
359 if ( $wgMetaNamespace === false ) {
360 $wgMetaNamespace = str_replace( ' ', '_', $wgSitename );
363 // Default value is either the suhosin limit or -1 for unlimited
364 if ( $wgResourceLoaderMaxQueryLength === false ) {
365 $maxValueLength = ini_get( 'suhosin.get.max_value_length' );
366 $wgResourceLoaderMaxQueryLength = $maxValueLength > 0 ?
$maxValueLength : -1;
370 * Definitions of the NS_ constants are in Defines.php
373 $wgCanonicalNamespaceNames = array(
375 NS_SPECIAL
=> 'Special',
378 NS_USER_TALK
=> 'User_talk',
379 NS_PROJECT
=> 'Project',
380 NS_PROJECT_TALK
=> 'Project_talk',
382 NS_FILE_TALK
=> 'File_talk',
383 NS_MEDIAWIKI
=> 'MediaWiki',
384 NS_MEDIAWIKI_TALK
=> 'MediaWiki_talk',
385 NS_TEMPLATE
=> 'Template',
386 NS_TEMPLATE_TALK
=> 'Template_talk',
388 NS_HELP_TALK
=> 'Help_talk',
389 NS_CATEGORY
=> 'Category',
390 NS_CATEGORY_TALK
=> 'Category_talk',
394 if ( is_array( $wgExtraNamespaces ) ) {
395 $wgCanonicalNamespaceNames = $wgCanonicalNamespaceNames +
$wgExtraNamespaces;
398 // These are now the same, always
399 // To determine the user language, use $wgLang->getCode()
400 $wgContLanguageCode = $wgLanguageCode;
402 // Easy to forget to falsify $wgShowIPinHeader for static caches.
403 // If file cache or squid cache is on, just disable this (DWIMD).
404 // Do the same for $wgDebugToolbar.
405 if ( $wgUseFileCache ||
$wgUseSquid ) {
406 $wgShowIPinHeader = false;
407 $wgDebugToolbar = false;
410 // We always output HTML5 since 1.22, overriding these is no longer supported
411 // we set them here for extensions that depend on its value.
413 $wgXhtmlDefaultNamespace = 'http://www.w3.org/1999/xhtml';
414 $wgJsMimeType = 'text/javascript';
416 if ( !$wgHtml5Version && $wgAllowRdfaAttributes ) {
417 // see http://www.w3.org/TR/rdfa-in-html/#document-conformance
418 if ( $wgMimeType == 'application/xhtml+xml' ) {
419 $wgHtml5Version = 'XHTML+RDFa 1.0';
421 $wgHtml5Version = 'HTML+RDFa 1.0';
425 // Blacklisted file extensions shouldn't appear on the "allowed" list
426 $wgFileExtensions = array_values( array_diff ( $wgFileExtensions, $wgFileBlacklist ) );
428 if ( $wgInvalidateCacheOnLocalSettingsChange ) {
429 // @codingStandardsIgnoreStart Generic.PHP.NoSilencedErrors.Discouraged - No GlobalFunction here yet.
430 $wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis', @filemtime
( "$IP/LocalSettings.php" ) ) );
431 // @codingStandardsIgnoreEnd
434 if ( $wgNewUserLog ) {
435 // Add a new log type
436 $wgLogTypes[] = 'newusers';
437 $wgLogNames['newusers'] = 'newuserlogpage';
438 $wgLogHeaders['newusers'] = 'newuserlogpagetext';
439 $wgLogActionsHandlers['newusers/newusers'] = 'NewUsersLogFormatter';
440 $wgLogActionsHandlers['newusers/create'] = 'NewUsersLogFormatter';
441 $wgLogActionsHandlers['newusers/create2'] = 'NewUsersLogFormatter';
442 $wgLogActionsHandlers['newusers/byemail'] = 'NewUsersLogFormatter';
443 $wgLogActionsHandlers['newusers/autocreate'] = 'NewUsersLogFormatter';
446 if ( $wgPageLanguageUseDB ) {
447 $wgLogTypes[] = 'pagelang';
448 $wgLogActionsHandlers['pagelang/pagelang'] = 'PageLangLogFormatter';
451 if ( $wgCookieSecure === 'detect' ) {
452 $wgCookieSecure = ( WebRequest
::detectProtocol() === 'https' );
455 // Back compatibility for $wgRateLimitLog deprecated with 1.23
456 if ( $wgRateLimitLog && !array_key_exists( 'ratelimit', $wgDebugLogGroups ) ) {
457 $wgDebugLogGroups['ratelimit'] = $wgRateLimitLog;
460 if ( $wgProfileOnly ) {
461 $wgDebugLogGroups['profileoutput'] = $wgDebugLogFile;
462 $wgDebugLogFile = '';
465 wfProfileOut( $fname . '-defaults' );
467 // Disable MWDebug for command line mode, this prevents MWDebug from eating up
468 // all the memory from logging SQL queries on maintenance scripts
469 global $wgCommandLineMode;
470 if ( $wgDebugToolbar && !$wgCommandLineMode ) {
471 wfProfileIn( $fname . '-debugtoolbar' );
473 wfProfileOut( $fname . '-debugtoolbar' );
476 if ( !class_exists( 'AutoLoader' ) ) {
477 require_once "$IP/includes/AutoLoader.php";
480 wfProfileIn( $fname . '-exception' );
481 MWExceptionHandler
::installHandler();
482 wfProfileOut( $fname . '-exception' );
484 wfProfileIn( $fname . '-includes' );
485 require_once "$IP/includes/normal/UtfNormalUtil.php";
486 require_once "$IP/includes/normal/UtfNormalDefines.php";
487 wfProfileOut( $fname . '-includes' );
489 wfProfileIn( $fname . '-defaults2' );
491 if ( $wgCanonicalServer === false ) {
492 $wgCanonicalServer = wfExpandUrl( $wgServer, PROTO_HTTP
);
496 $serverParts = wfParseUrl( $wgCanonicalServer );
497 if ( $wgServerName !== false ) {
498 wfWarn( '$wgServerName should be derived from $wgCanonicalServer, '
499 . 'not customized. Overwriting $wgServerName.' );
501 $wgServerName = $serverParts['host'];
502 unset( $serverParts );
504 // Set defaults for configuration variables
505 // that are derived from the server name by default
506 if ( $wgEmergencyContact === false ) {
507 $wgEmergencyContact = 'wikiadmin@' . $wgServerName;
510 if ( $wgPasswordSender === false ) {
511 $wgPasswordSender = 'apache@' . $wgServerName;
514 if ( $wgSecureLogin && substr( $wgServer, 0, 2 ) !== '//' ) {
515 $wgSecureLogin = false;
516 wfWarn( 'Secure login was enabled on a server that only supports '
517 . 'HTTP or HTTPS. Disabling secure login.' );
520 // Now that GlobalFunctions is loaded, set defaults that depend
522 if ( $wgTmpDirectory === false ) {
523 wfProfileIn( $fname . '-tempDir' );
524 $wgTmpDirectory = wfTempDir();
525 wfProfileOut( $fname . '-tempDir' );
528 // We don't use counters anymore. Left here for extensions still
529 // expecting this to exist. Should be removed sometime 1.26 or later.
530 $wgDisableCounters = true;
532 wfProfileOut( $fname . '-defaults2' );
533 wfProfileIn( $fname . '-misc1' );
535 // Raise the memory limit if it's too low
539 * Set up the timezone, suppressing the pseudo-security warning in PHP 5.1+
540 * that happens whenever you use a date function without the timezone being
541 * explicitly set. Inspired by phpMyAdmin's treatment of the problem.
543 if ( is_null( $wgLocaltimezone ) ) {
544 wfSuppressWarnings();
545 $wgLocaltimezone = date_default_timezone_get();
549 date_default_timezone_set( $wgLocaltimezone );
550 if ( is_null( $wgLocalTZoffset ) ) {
551 $wgLocalTZoffset = date( 'Z' ) / 60;
554 // Useful debug output
555 if ( $wgCommandLineMode ) {
556 $wgRequest = new FauxRequest( array() );
558 wfDebug( "\n\nStart command line script $self\n" );
560 // Can't stub this one, it sets up $_GET and $_REQUEST in its constructor
561 $wgRequest = new WebRequest
;
563 $debug = "\n\nStart request {$wgRequest->getMethod()} {$wgRequest->getRequestURL()}\n";
565 if ( $wgDebugPrintHttpHeaders ) {
566 $debug .= "HTTP HEADERS:\n";
568 foreach ( $wgRequest->getAllHeaders() as $name => $value ) {
569 $debug .= "$name: $value\n";
575 wfProfileOut( $fname . '-misc1' );
576 wfProfileIn( $fname . '-memcached' );
578 $wgMemc = wfGetMainCache();
579 $messageMemc = wfGetMessageCacheStorage();
580 $parserMemc = wfGetParserCacheStorage();
581 $wgLangConvMemc = wfGetLangConverterCacheStorage();
583 wfDebugLog( 'caches', 'main: ' . get_class( $wgMemc ) .
584 ', message: ' . get_class( $messageMemc ) .
585 ', parser: ' . get_class( $parserMemc ) );
587 wfProfileOut( $fname . '-memcached' );
589 // Most of the config is out, some might want to run hooks here.
590 Hooks
::run( 'SetupAfterCache' );
592 wfProfileIn( $fname . '-session' );
594 if ( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode ) {
595 // If session.auto_start is there, we can't touch session name
596 if ( !wfIniGetBool( 'session.auto_start' ) ) {
597 session_name( $wgSessionName ?
$wgSessionName : $wgCookiePrefix . '_session' );
600 if ( $wgRequest->checkSessionCookie() ||
isset( $_COOKIE[$wgCookiePrefix . 'Token'] ) ) {
605 wfProfileOut( $fname . '-session' );
606 wfProfileIn( $fname . '-globals' );
609 * @var Language $wgContLang
611 $wgContLang = Language
::factory( $wgLanguageCode );
612 $wgContLang->initEncoding();
613 $wgContLang->initContLang();
615 // Now that variant lists may be available...
616 $wgRequest->interpolateTitle();
621 $wgUser = RequestContext
::getMain()->getUser(); // BackCompat
624 * @var Language $wgLang
626 $wgLang = new StubUserLang
;
629 * @var OutputPage $wgOut
631 $wgOut = RequestContext
::getMain()->getOutput(); // BackCompat
634 * @var Parser $wgParser
636 $wgParser = new StubObject( 'wgParser', $wgParserConf['class'], array( $wgParserConf ) );
638 if ( !is_object( $wgAuth ) ) {
639 $wgAuth = new AuthPlugin
;
640 Hooks
::run( 'AuthPluginSetup', array( &$wgAuth ) );
644 * @var Title $wgTitle
649 * @deprecated since 1.24 Use DeferredUpdates::addUpdate instead
652 $wgDeferredUpdateList = array();
654 wfProfileOut( $fname . '-globals' );
655 wfProfileIn( $fname . '-extensions' );
657 // Extension setup functions for extensions other than skins
658 // Entries should be added to this variable during the inclusion
659 // of the extension file. This allows the extension to perform
660 // any necessary initialisation in the fully initialised environment
661 foreach ( $wgExtensionFunctions as $func ) {
662 // Allow closures in PHP 5.3+
663 if ( is_object( $func ) && $func instanceof Closure
) {
664 $profName = $fname . '-extensions-closure';
665 } elseif ( is_array( $func ) ) {
666 if ( is_object( $func[0] ) ) {
667 $profName = $fname . '-extensions-' . get_class( $func[0] ) . '::' . $func[1];
669 $profName = $fname . '-extensions-' . implode( '::', $func );
672 $profName = $fname . '-extensions-' . strval( $func );
675 wfProfileIn( $profName );
676 call_user_func( $func );
677 wfProfileOut( $profName );
680 wfDebug( "Fully initialised\n" );
681 $wgFullyInitialised = true;
683 wfProfileOut( $fname . '-extensions' );
684 wfProfileOut( $fname );