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 );
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";
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";
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( $wgFooterIcons['copyright'] )
114 && isset( $wgFooterIcons['copyright']['copyright'] )
115 && $wgFooterIcons['copyright']['copyright'] === array()
117 if ( $wgCopyrightIcon ) {
118 $wgFooterIcons['copyright']['copyright'] = $wgCopyrightIcon;
119 } elseif ( $wgRightsIcon ||
$wgRightsText ) {
120 $wgFooterIcons['copyright']['copyright'] = array(
121 'url' => $wgRightsUrl,
122 'src' => $wgRightsIcon,
123 'alt' => $wgRightsText,
126 unset( $wgFooterIcons['copyright']['copyright'] );
130 if ( isset( $wgFooterIcons['poweredby'] )
131 && isset( $wgFooterIcons['poweredby']['mediawiki'] )
132 && $wgFooterIcons['poweredby']['mediawiki']['src'] === null
134 $wgFooterIcons['poweredby']['mediawiki']['src'] =
135 "$wgStylePath/common/images/poweredby_mediawiki_88x31.png";
139 * Unconditional protection for NS_MEDIAWIKI since otherwise it's too easy for a
140 * sysadmin to set $wgNamespaceProtection incorrectly and leave the wiki insecure.
142 * Note that this is the definition of editinterface and it can be granted to
143 * all users if desired.
145 $wgNamespaceProtection[NS_MEDIAWIKI
] = 'editinterface';
148 * The canonical names of namespaces 6 and 7 are, as of v1.14, "File"
149 * and "File_talk". The old names "Image" and "Image_talk" are
150 * retained as aliases for backwards compatibility.
152 $wgNamespaceAliases['Image'] = NS_FILE
;
153 $wgNamespaceAliases['Image_talk'] = NS_FILE_TALK
;
156 * Initialise $wgLockManagers to include basic FS version
158 $wgLockManagers[] = array(
159 'name' => 'fsLockManager',
160 'class' => 'FSLockManager',
161 'lockDirectory' => "{$wgUploadDirectory}/lockdir",
163 $wgLockManagers[] = array(
164 'name' => 'nullLockManager',
165 'class' => 'NullLockManager',
169 * Initialise $wgLocalFileRepo from backwards-compatible settings
171 if ( !$wgLocalFileRepo ) {
172 $wgLocalFileRepo = array(
173 'class' => 'LocalRepo',
175 'directory' => $wgUploadDirectory,
176 'scriptDirUrl' => $wgScriptPath,
177 'scriptExtension' => $wgScriptExtension,
178 'url' => $wgUploadBaseUrl ?
$wgUploadBaseUrl . $wgUploadPath : $wgUploadPath,
179 'hashLevels' => $wgHashedUploadDirectory ?
2 : 0,
180 'thumbScriptUrl' => $wgThumbnailScriptPath,
181 'transformVia404' => !$wgGenerateThumbnailOnParse,
182 'deletedDir' => $wgDeletedDirectory,
183 'deletedHashLevels' => $wgHashedUploadDirectory ?
3 : 0
187 * Initialise shared repo from backwards-compatible settings
189 if ( $wgUseSharedUploads ) {
190 if ( $wgSharedUploadDBname ) {
191 $wgForeignFileRepos[] = array(
192 'class' => 'ForeignDBRepo',
194 'directory' => $wgSharedUploadDirectory,
195 'url' => $wgSharedUploadPath,
196 'hashLevels' => $wgHashedSharedUploadDirectory ?
2 : 0,
197 'thumbScriptUrl' => $wgSharedThumbnailScriptPath,
198 'transformVia404' => !$wgGenerateThumbnailOnParse,
199 'dbType' => $wgDBtype,
200 'dbServer' => $wgDBserver,
201 'dbUser' => $wgDBuser,
202 'dbPassword' => $wgDBpassword,
203 'dbName' => $wgSharedUploadDBname,
204 'dbFlags' => ( $wgDebugDumpSql ? DBO_DEBUG
: 0 ) | DBO_DEFAULT
,
205 'tablePrefix' => $wgSharedUploadDBprefix,
206 'hasSharedCache' => $wgCacheSharedUploads,
207 'descBaseUrl' => $wgRepositoryBaseUrl,
208 'fetchDescription' => $wgFetchCommonsDescriptions,
211 $wgForeignFileRepos[] = array(
212 'class' => 'FileRepo',
214 'directory' => $wgSharedUploadDirectory,
215 'url' => $wgSharedUploadPath,
216 'hashLevels' => $wgHashedSharedUploadDirectory ?
2 : 0,
217 'thumbScriptUrl' => $wgSharedThumbnailScriptPath,
218 'transformVia404' => !$wgGenerateThumbnailOnParse,
219 'descBaseUrl' => $wgRepositoryBaseUrl,
220 'fetchDescription' => $wgFetchCommonsDescriptions,
224 if ( $wgUseInstantCommons ) {
225 $wgForeignFileRepos[] = array(
226 'class' => 'ForeignAPIRepo',
227 'name' => 'wikimediacommons',
228 'apibase' => WebRequest
::detectProtocol() === 'https' ?
229 'https://commons.wikimedia.org/w/api.php' :
230 'http://commons.wikimedia.org/w/api.php',
232 'fetchDescription' => true,
233 'descriptionCacheExpiry' => 43200,
234 'apiThumbCacheExpiry' => 86400,
238 * Add on default file backend config for file repos.
239 * FileBackendGroup will handle initializing the backends.
241 if ( !isset( $wgLocalFileRepo['backend'] ) ) {
242 $wgLocalFileRepo['backend'] = $wgLocalFileRepo['name'] . '-backend';
244 foreach ( $wgForeignFileRepos as &$repo ) {
245 if ( !isset( $repo['directory'] ) && $repo['class'] === 'ForeignAPIRepo' ) {
246 $repo['directory'] = $wgUploadDirectory; // b/c
248 if ( !isset( $repo['backend'] ) ) {
249 $repo['backend'] = $repo['name'] . '-backend';
252 unset( $repo ); // no global pollution; destroy reference
254 if ( $wgRCFilterByAge ) {
255 // Trim down $wgRCLinkDays so that it only lists links which are valid
256 // as determined by $wgRCMaxAge.
257 // Note that we allow 1 link higher than the max for things like 56 days but a 60 day link.
258 sort( $wgRCLinkDays );
260 // @codingStandardsIgnoreStart Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed
261 for ( $i = 0; $i < count( $wgRCLinkDays ); $i++
) {
262 // @codingStandardsIgnoreEnd
263 if ( $wgRCLinkDays[$i] >= $wgRCMaxAge / ( 3600 * 24 ) ) {
264 $wgRCLinkDays = array_slice( $wgRCLinkDays, 0, $i +
1, false );
271 $wgSkipSkins[] = $wgSkipSkin;
274 if ( $wgLocalInterwiki ) {
275 array_unshift( $wgLocalInterwikis, $wgLocalInterwiki );
278 // Set default shared prefix
279 if ( $wgSharedPrefix === false ) {
280 $wgSharedPrefix = $wgDBprefix;
283 if ( !$wgCookiePrefix ) {
284 if ( $wgSharedDB && $wgSharedPrefix && in_array( 'user', $wgSharedTables ) ) {
285 $wgCookiePrefix = $wgSharedDB . '_' . $wgSharedPrefix;
286 } elseif ( $wgSharedDB && in_array( 'user', $wgSharedTables ) ) {
287 $wgCookiePrefix = $wgSharedDB;
288 } elseif ( $wgDBprefix ) {
289 $wgCookiePrefix = $wgDBname . '_' . $wgDBprefix;
291 $wgCookiePrefix = $wgDBname;
294 $wgCookiePrefix = strtr( $wgCookiePrefix, '=,; +."\'\\[', '__________' );
296 if ( $wgEnableEmail ) {
297 $wgUseEnotif = $wgEnotifUserTalk ||
$wgEnotifWatchlist;
299 // Disable all other email settings automatically if $wgEnableEmail
300 // is set to false. - bug 63678
301 $wgAllowHTMLEmail = false;
302 $wgEmailAuthentication = false; // do not require auth if you're not sending email anyway
303 $wgEnableUserEmail = false;
304 $wgEnotifFromEditor = false;
305 $wgEnotifImpersonal = false;
306 $wgEnotifMaxRecips = 0;
307 $wgEnotifMinorEdits = false;
308 $wgEnotifRevealEditorAddress = false;
309 $wgEnotifUseJobQ = false;
310 $wgEnotifUseRealName = false;
311 $wgEnotifUserTalk = false;
312 $wgEnotifWatchlist = false;
313 unset( $wgGroupPermissions['user']['sendemail'] );
314 $wgUseEnotif = false;
315 $wgUserEmailUseReplyTo = false;
316 $wgUsersNotifiedOnAllChanges = array();
319 // Doesn't make sense to have if disabled.
320 if ( !$wgEnotifMinorEdits ) {
321 $wgHiddenPrefs[] = 'enotifminoredits';
324 if ( $wgMetaNamespace === false ) {
325 $wgMetaNamespace = str_replace( ' ', '_', $wgSitename );
328 // Default value is either the suhosin limit or -1 for unlimited
329 if ( $wgResourceLoaderMaxQueryLength === false ) {
330 $maxValueLength = ini_get( 'suhosin.get.max_value_length' );
331 $wgResourceLoaderMaxQueryLength = $maxValueLength > 0 ?
$maxValueLength : -1;
335 * Definitions of the NS_ constants are in Defines.php
338 $wgCanonicalNamespaceNames = array(
340 NS_SPECIAL
=> 'Special',
343 NS_USER_TALK
=> 'User_talk',
344 NS_PROJECT
=> 'Project',
345 NS_PROJECT_TALK
=> 'Project_talk',
347 NS_FILE_TALK
=> 'File_talk',
348 NS_MEDIAWIKI
=> 'MediaWiki',
349 NS_MEDIAWIKI_TALK
=> 'MediaWiki_talk',
350 NS_TEMPLATE
=> 'Template',
351 NS_TEMPLATE_TALK
=> 'Template_talk',
353 NS_HELP_TALK
=> 'Help_talk',
354 NS_CATEGORY
=> 'Category',
355 NS_CATEGORY_TALK
=> 'Category_talk',
359 if ( is_array( $wgExtraNamespaces ) ) {
360 $wgCanonicalNamespaceNames = $wgCanonicalNamespaceNames +
$wgExtraNamespaces;
363 // These are now the same, always
364 // To determine the user language, use $wgLang->getCode()
365 $wgContLanguageCode = $wgLanguageCode;
367 // Easy to forget to falsify $wgShowIPinHeader for static caches.
368 // If file cache or squid cache is on, just disable this (DWIMD).
369 // Do the same for $wgDebugToolbar.
370 if ( $wgUseFileCache ||
$wgUseSquid ) {
371 $wgShowIPinHeader = false;
372 $wgDebugToolbar = false;
375 // We always output HTML5 since 1.22, overriding these is no longer supported
376 // we set them here for extensions that depend on its value.
378 $wgXhtmlDefaultNamespace = 'http://www.w3.org/1999/xhtml';
379 $wgJsMimeType = 'text/javascript';
381 if ( !$wgHtml5Version && $wgAllowRdfaAttributes ) {
382 // see http://www.w3.org/TR/rdfa-in-html/#document-conformance
383 if ( $wgMimeType == 'application/xhtml+xml' ) {
384 $wgHtml5Version = 'XHTML+RDFa 1.0';
386 $wgHtml5Version = 'HTML+RDFa 1.0';
390 // Blacklisted file extensions shouldn't appear on the "allowed" list
391 $wgFileExtensions = array_values( array_diff ( $wgFileExtensions, $wgFileBlacklist ) );
393 if ( $wgInvalidateCacheOnLocalSettingsChange ) {
394 // @codingStandardsIgnoreStart Generic.PHP.NoSilencedErrors.Discouraged - No GlobalFunction here yet.
395 $wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis', @filemtime
( "$IP/LocalSettings.php" ) ) );
396 // @codingStandardsIgnoreEnd
399 if ( $wgNewUserLog ) {
400 // Add a new log type
401 $wgLogTypes[] = 'newusers';
402 $wgLogNames['newusers'] = 'newuserlogpage';
403 $wgLogHeaders['newusers'] = 'newuserlogpagetext';
404 $wgLogActionsHandlers['newusers/newusers'] = 'NewUsersLogFormatter';
405 $wgLogActionsHandlers['newusers/create'] = 'NewUsersLogFormatter';
406 $wgLogActionsHandlers['newusers/create2'] = 'NewUsersLogFormatter';
407 $wgLogActionsHandlers['newusers/byemail'] = 'NewUsersLogFormatter';
408 $wgLogActionsHandlers['newusers/autocreate'] = 'NewUsersLogFormatter';
411 if ( $wgPageLanguageUseDB ) {
412 $wgLogTypes[] = 'pagelang';
413 $wgLogActionsHandlers['pagelang/pagelang'] = 'PageLangLogFormatter';
416 if ( $wgCookieSecure === 'detect' ) {
417 $wgCookieSecure = ( WebRequest
::detectProtocol() === 'https' );
420 if ( $wgRC2UDPAddress ) {
421 $wgRCFeeds['default'] = array(
422 'formatter' => 'IRCColourfulRCFeedFormatter',
423 'uri' => "udp://$wgRC2UDPAddress:$wgRC2UDPPort/$wgRC2UDPPrefix",
424 'add_interwiki_prefix' => &$wgRC2UDPInterwikiPrefix,
425 'omit_bots' => &$wgRC2UDPOmitBots,
429 wfProfileOut( $fname . '-defaults' );
431 // Disable MWDebug for command line mode, this prevents MWDebug from eating up
432 // all the memory from logging SQL queries on maintenance scripts
433 global $wgCommandLineMode;
434 if ( $wgDebugToolbar && !$wgCommandLineMode ) {
435 wfProfileIn( $fname . '-debugtoolbar' );
437 wfProfileOut( $fname . '-debugtoolbar' );
440 if ( !class_exists( 'AutoLoader' ) ) {
441 require_once "$IP/includes/AutoLoader.php";
444 wfProfileIn( $fname . '-exception' );
445 MWExceptionHandler
::installHandler();
446 wfProfileOut( $fname . '-exception' );
448 wfProfileIn( $fname . '-includes' );
449 require_once "$IP/includes/normal/UtfNormalUtil.php";
450 require_once "$IP/includes/GlobalFunctions.php";
451 require_once "$IP/includes/normal/UtfNormalDefines.php";
452 wfProfileOut( $fname . '-includes' );
454 wfProfileIn( $fname . '-defaults2' );
456 if ( $wgCanonicalServer === false ) {
457 $wgCanonicalServer = wfExpandUrl( $wgServer, PROTO_HTTP
);
461 $serverParts = wfParseUrl( $wgCanonicalServer );
462 if ( $wgServerName !== false ) {
463 wfWarn( '$wgServerName should be derived from $wgCanonicalServer, '
464 . 'not customized. Overwriting $wgServerName.' );
466 $wgServerName = $serverParts['host'];
467 unset( $serverParts );
469 // Set defaults for configuration variables
470 // that are derived from the server name by default
471 if ( $wgEmergencyContact === false ) {
472 $wgEmergencyContact = 'wikiadmin@' . $wgServerName;
475 if ( $wgPasswordSender === false ) {
476 $wgPasswordSender = 'apache@' . $wgServerName;
479 if ( $wgSecureLogin && substr( $wgServer, 0, 2 ) !== '//' ) {
480 $wgSecureLogin = false;
481 wfWarn( 'Secure login was enabled on a server that only supports '
482 . 'HTTP or HTTPS. Disabling secure login.' );
485 // Now that GlobalFunctions is loaded, set defaults that depend
487 if ( $wgTmpDirectory === false ) {
488 wfProfileIn( $fname . '-tempDir' );
489 $wgTmpDirectory = wfTempDir();
490 wfProfileOut( $fname . '-tempDir' );
493 // $wgHTCPMulticastRouting got renamed to $wgHTCPRouting in MediaWiki 1.22
494 // ensure back compatibility.
495 if ( !$wgHTCPRouting && $wgHTCPMulticastRouting ) {
496 $wgHTCPRouting = $wgHTCPMulticastRouting;
499 // Initialize $wgHTCPRouting from backwards-compatible settings that
500 // comes from pre 1.20 version.
501 if ( !$wgHTCPRouting && $wgHTCPMulticastAddress ) {
502 $wgHTCPRouting = array(
504 'host' => $wgHTCPMulticastAddress,
505 'port' => $wgHTCPPort,
510 // Back compatibility for $wgRateLimitLog deprecated with 1.23
511 if ( $wgRateLimitLog && !array_key_exists( 'ratelimit', $wgDebugLogGroups ) ) {
512 $wgDebugLogGroups['ratelimit'] = $wgRateLimitLog;
515 if ( $wgProfileOnly ) {
516 $wgDebugLogGroups['profileoutput'] = $wgDebugLogFile;
517 $wgDebugLogFile = '';
520 wfProfileOut( $fname . '-defaults2' );
521 wfProfileIn( $fname . '-misc1' );
523 // Raise the memory limit if it's too low
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();
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" );
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";
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 session.auto_start is there, we can't touch session name
583 if ( !wfIniGetBool( 'session.auto_start' ) ) {
584 session_name( $wgSessionName ?
$wgSessionName : $wgCookiePrefix . '_session' );
587 if ( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode &&
588 ( $wgRequest->checkSessionCookie() ||
isset( $_COOKIE[$wgCookiePrefix . 'Token'] ) )
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();
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
636 $wgDeferredUpdateList = array();
638 wfProfileOut( $fname . '-globals' );
639 wfProfileIn( $fname . '-extensions' );
641 // Extension setup functions for extensions other than skins
642 // Entries should be added to this variable during the inclusion
643 // of the extension file. This allows the extension to perform
644 // any necessary initialisation in the fully initialised environment
645 foreach ( $wgExtensionFunctions as $func ) {
646 // Allow closures in PHP 5.3+
647 if ( is_object( $func ) && $func instanceof Closure
) {
648 $profName = $fname . '-extensions-closure';
649 } elseif ( is_array( $func ) ) {
650 if ( is_object( $func[0] ) ) {
651 $profName = $fname . '-extensions-' . get_class( $func[0] ) . '::' . $func[1];
653 $profName = $fname . '-extensions-' . implode( '::', $func );
656 $profName = $fname . '-extensions-' . strval( $func );
659 wfProfileIn( $profName );
660 call_user_func( $func );
661 wfProfileOut( $profName );
664 wfDebug( "Fully initialised\n" );
665 $wgFullyInitialised = true;
667 wfProfileOut( $fname . '-extensions' );
668 wfProfileOut( $fname );