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 $ps_setup = Profiler
::instance()->scopedProfileIn( $fname );
38 // If any extensions are still queued, force load them
39 ExtensionRegistry
::getInstance()->loadFromQueue();
41 // Check to see if we are at the file scope
42 if ( !isset( $wgVersion ) ) {
43 echo "Error, Setup.php must be included from the file scope, after DefaultSettings.php\n";
47 // Set various default paths sensibly...
48 $ps_default = Profiler
::instance()->scopedProfileIn( $fname . '-defaults' );
50 if ( $wgScript === false ) {
51 $wgScript = "$wgScriptPath/index$wgScriptExtension";
53 if ( $wgLoadScript === false ) {
54 $wgLoadScript = "$wgScriptPath/load$wgScriptExtension";
57 if ( $wgArticlePath === false ) {
58 if ( $wgUsePathInfo ) {
59 $wgArticlePath = "$wgScript/$1";
61 $wgArticlePath = "$wgScript?title=$1";
65 if ( !empty( $wgActionPaths ) && !isset( $wgActionPaths['view'] ) ) {
66 // 'view' is assumed the default action path everywhere in the code
67 // but is rarely filled in $wgActionPaths
68 $wgActionPaths['view'] = $wgArticlePath;
71 if ( $wgStylePath === false ) {
72 $wgStylePath = "$wgScriptPath/skins";
74 if ( $wgLocalStylePath === false ) {
75 $wgLocalStylePath = "$wgScriptPath/skins";
77 if ( $wgStyleDirectory === false ) {
78 $wgStyleDirectory = "$IP/skins";
80 if ( $wgExtensionAssetsPath === false ) {
81 $wgExtensionAssetsPath = "$wgScriptPath/extensions";
83 if ( $wgResourceBasePath === null ) {
84 $wgResourceBasePath = $wgScriptPath;
87 if ( $wgLogo === false ) {
88 $wgLogo = "$wgResourceBasePath/resources/assets/wiki.png";
91 if ( $wgUploadPath === false ) {
92 $wgUploadPath = "$wgScriptPath/images";
94 if ( $wgUploadDirectory === false ) {
95 $wgUploadDirectory = "$IP/images";
97 if ( $wgReadOnlyFile === false ) {
98 $wgReadOnlyFile = "{$wgUploadDirectory}/lock_yBgMBwiR";
100 if ( $wgFileCacheDirectory === false ) {
101 $wgFileCacheDirectory = "{$wgUploadDirectory}/cache";
103 if ( $wgDeletedDirectory === false ) {
104 $wgDeletedDirectory = "{$wgUploadDirectory}/deleted";
107 if ( $wgGitInfoCacheDirectory === false && $wgCacheDirectory !== false ) {
108 $wgGitInfoCacheDirectory = "{$wgCacheDirectory}/gitinfo";
111 // Fix path to icon images after they were moved in 1.24
112 if ( $wgRightsIcon ) {
113 $wgRightsIcon = str_replace(
114 "{$wgStylePath}/common/images/",
115 "{$wgResourceBasePath}/resources/assets/licenses/",
120 if ( isset( $wgFooterIcons['copyright'] )
121 && isset( $wgFooterIcons['copyright']['copyright'] )
122 && $wgFooterIcons['copyright']['copyright'] === array()
124 if ( $wgCopyrightIcon ) {
125 $wgFooterIcons['copyright']['copyright'] = $wgCopyrightIcon;
126 } elseif ( $wgRightsIcon ||
$wgRightsText ) {
127 $wgFooterIcons['copyright']['copyright'] = array(
128 'url' => $wgRightsUrl,
129 'src' => $wgRightsIcon,
130 'alt' => $wgRightsText,
133 unset( $wgFooterIcons['copyright']['copyright'] );
137 if ( isset( $wgFooterIcons['poweredby'] )
138 && isset( $wgFooterIcons['poweredby']['mediawiki'] )
139 && $wgFooterIcons['poweredby']['mediawiki']['src'] === null
141 $wgFooterIcons['poweredby']['mediawiki']['src'] =
142 "$wgResourceBasePath/resources/assets/poweredby_mediawiki_88x31.png";
143 $wgFooterIcons['poweredby']['mediawiki']['srcset'] =
144 "$wgResourceBasePath/resources/assets/poweredby_mediawiki_132x47.png 1.5x, " .
145 "$wgResourceBasePath/resources/assets/poweredby_mediawiki_176x62.png 2x";
149 * Unconditional protection for NS_MEDIAWIKI since otherwise it's too easy for a
150 * sysadmin to set $wgNamespaceProtection incorrectly and leave the wiki insecure.
152 * Note that this is the definition of editinterface and it can be granted to
153 * all users if desired.
155 $wgNamespaceProtection[NS_MEDIAWIKI
] = 'editinterface';
158 * The canonical names of namespaces 6 and 7 are, as of v1.14, "File"
159 * and "File_talk". The old names "Image" and "Image_talk" are
160 * retained as aliases for backwards compatibility.
162 $wgNamespaceAliases['Image'] = NS_FILE
;
163 $wgNamespaceAliases['Image_talk'] = NS_FILE_TALK
;
166 * Initialise $wgLockManagers to include basic FS version
168 $wgLockManagers[] = array(
169 'name' => 'fsLockManager',
170 'class' => 'FSLockManager',
171 'lockDirectory' => "{$wgUploadDirectory}/lockdir",
173 $wgLockManagers[] = array(
174 'name' => 'nullLockManager',
175 'class' => 'NullLockManager',
179 * Initialise $wgLocalFileRepo from backwards-compatible settings
181 if ( !$wgLocalFileRepo ) {
182 $wgLocalFileRepo = array(
183 'class' => 'LocalRepo',
185 'directory' => $wgUploadDirectory,
186 'scriptDirUrl' => $wgScriptPath,
187 'scriptExtension' => $wgScriptExtension,
188 'url' => $wgUploadBaseUrl ?
$wgUploadBaseUrl . $wgUploadPath : $wgUploadPath,
189 'hashLevels' => $wgHashedUploadDirectory ?
2 : 0,
190 'thumbScriptUrl' => $wgThumbnailScriptPath,
191 'transformVia404' => !$wgGenerateThumbnailOnParse,
192 'deletedDir' => $wgDeletedDirectory,
193 'deletedHashLevels' => $wgHashedUploadDirectory ?
3 : 0
197 * Initialise shared repo from backwards-compatible settings
199 if ( $wgUseSharedUploads ) {
200 if ( $wgSharedUploadDBname ) {
201 $wgForeignFileRepos[] = array(
202 'class' => 'ForeignDBRepo',
204 'directory' => $wgSharedUploadDirectory,
205 'url' => $wgSharedUploadPath,
206 'hashLevels' => $wgHashedSharedUploadDirectory ?
2 : 0,
207 'thumbScriptUrl' => $wgSharedThumbnailScriptPath,
208 'transformVia404' => !$wgGenerateThumbnailOnParse,
209 'dbType' => $wgDBtype,
210 'dbServer' => $wgDBserver,
211 'dbUser' => $wgDBuser,
212 'dbPassword' => $wgDBpassword,
213 'dbName' => $wgSharedUploadDBname,
214 'dbFlags' => ( $wgDebugDumpSql ? DBO_DEBUG
: 0 ) | DBO_DEFAULT
,
215 'tablePrefix' => $wgSharedUploadDBprefix,
216 'hasSharedCache' => $wgCacheSharedUploads,
217 'descBaseUrl' => $wgRepositoryBaseUrl,
218 'fetchDescription' => $wgFetchCommonsDescriptions,
221 $wgForeignFileRepos[] = array(
222 'class' => 'FileRepo',
224 'directory' => $wgSharedUploadDirectory,
225 'url' => $wgSharedUploadPath,
226 'hashLevels' => $wgHashedSharedUploadDirectory ?
2 : 0,
227 'thumbScriptUrl' => $wgSharedThumbnailScriptPath,
228 'transformVia404' => !$wgGenerateThumbnailOnParse,
229 'descBaseUrl' => $wgRepositoryBaseUrl,
230 'fetchDescription' => $wgFetchCommonsDescriptions,
234 if ( $wgUseInstantCommons ) {
235 $wgForeignFileRepos[] = array(
236 'class' => 'ForeignAPIRepo',
237 'name' => 'wikimediacommons',
238 'apibase' => WebRequest
::detectProtocol() === 'https' ?
239 'https://commons.wikimedia.org/w/api.php' :
240 'http://commons.wikimedia.org/w/api.php',
242 'fetchDescription' => true,
243 'descriptionCacheExpiry' => 43200,
244 'apiThumbCacheExpiry' => 86400,
248 * Add on default file backend config for file repos.
249 * FileBackendGroup will handle initializing the backends.
251 if ( !isset( $wgLocalFileRepo['backend'] ) ) {
252 $wgLocalFileRepo['backend'] = $wgLocalFileRepo['name'] . '-backend';
254 foreach ( $wgForeignFileRepos as &$repo ) {
255 if ( !isset( $repo['directory'] ) && $repo['class'] === 'ForeignAPIRepo' ) {
256 $repo['directory'] = $wgUploadDirectory; // b/c
258 if ( !isset( $repo['backend'] ) ) {
259 $repo['backend'] = $repo['name'] . '-backend';
262 unset( $repo ); // no global pollution; destroy reference
264 if ( $wgRCFilterByAge ) {
265 // Trim down $wgRCLinkDays so that it only lists links which are valid
266 // as determined by $wgRCMaxAge.
267 // Note that we allow 1 link higher than the max for things like 56 days but a 60 day link.
268 sort( $wgRCLinkDays );
270 // @codingStandardsIgnoreStart Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed
271 for ( $i = 0; $i < count( $wgRCLinkDays ); $i++
) {
272 // @codingStandardsIgnoreEnd
273 if ( $wgRCLinkDays[$i] >= $wgRCMaxAge / ( 3600 * 24 ) ) {
274 $wgRCLinkDays = array_slice( $wgRCLinkDays, 0, $i +
1, false );
281 $wgSkipSkins[] = $wgSkipSkin;
285 // Use a closure to avoid leaking into global state
286 call_user_func( function () use ( $wgValidSkinNames ) {
287 $factory = SkinFactory
::getDefaultInstance();
288 foreach ( $wgValidSkinNames as $name => $skin ) {
289 $factory->register( $name, $skin, function () use ( $name, $skin ) {
290 $class = "Skin$skin";
291 return new $class( $name );
294 // Register a hidden "fallback" skin
295 $factory->register( 'fallback', 'Fallback', function () {
296 return new SkinFallback
;
298 // Register a hidden skin for api output
299 $factory->register( 'apioutput', 'ApiOutput', function () {
303 $wgSkipSkins[] = 'fallback';
304 $wgSkipSkins[] = 'apioutput';
306 if ( $wgLocalInterwiki ) {
307 array_unshift( $wgLocalInterwikis, $wgLocalInterwiki );
310 // Set default shared prefix
311 if ( $wgSharedPrefix === false ) {
312 $wgSharedPrefix = $wgDBprefix;
315 // Set default shared schema
316 if ( $wgSharedSchema === false ) {
317 $wgSharedSchema = $wgDBmwschema;
320 if ( !$wgCookiePrefix ) {
321 if ( $wgSharedDB && $wgSharedPrefix && in_array( 'user', $wgSharedTables ) ) {
322 $wgCookiePrefix = $wgSharedDB . '_' . $wgSharedPrefix;
323 } elseif ( $wgSharedDB && in_array( 'user', $wgSharedTables ) ) {
324 $wgCookiePrefix = $wgSharedDB;
325 } elseif ( $wgDBprefix ) {
326 $wgCookiePrefix = $wgDBname . '_' . $wgDBprefix;
328 $wgCookiePrefix = $wgDBname;
331 $wgCookiePrefix = strtr( $wgCookiePrefix, '=,; +."\'\\[', '__________' );
333 if ( $wgEnableEmail ) {
334 $wgUseEnotif = $wgEnotifUserTalk ||
$wgEnotifWatchlist;
336 // Disable all other email settings automatically if $wgEnableEmail
337 // is set to false. - bug 63678
338 $wgAllowHTMLEmail = false;
339 $wgEmailAuthentication = false; // do not require auth if you're not sending email anyway
340 $wgEnableUserEmail = false;
341 $wgEnotifFromEditor = false;
342 $wgEnotifImpersonal = false;
343 $wgEnotifMaxRecips = 0;
344 $wgEnotifMinorEdits = false;
345 $wgEnotifRevealEditorAddress = false;
346 $wgEnotifUseJobQ = false;
347 $wgEnotifUseRealName = false;
348 $wgEnotifUserTalk = false;
349 $wgEnotifWatchlist = false;
350 unset( $wgGroupPermissions['user']['sendemail'] );
351 $wgUseEnotif = false;
352 $wgUserEmailUseReplyTo = false;
353 $wgUsersNotifiedOnAllChanges = array();
356 // Doesn't make sense to have if disabled.
357 if ( !$wgEnotifMinorEdits ) {
358 $wgHiddenPrefs[] = 'enotifminoredits';
361 if ( $wgMetaNamespace === false ) {
362 $wgMetaNamespace = str_replace( ' ', '_', $wgSitename );
365 // Default value is either the suhosin limit or -1 for unlimited
366 if ( $wgResourceLoaderMaxQueryLength === false ) {
367 $maxValueLength = ini_get( 'suhosin.get.max_value_length' );
368 $wgResourceLoaderMaxQueryLength = $maxValueLength > 0 ?
$maxValueLength : -1;
372 * Definitions of the NS_ constants are in Defines.php
375 $wgCanonicalNamespaceNames = array(
377 NS_SPECIAL
=> 'Special',
380 NS_USER_TALK
=> 'User_talk',
381 NS_PROJECT
=> 'Project',
382 NS_PROJECT_TALK
=> 'Project_talk',
384 NS_FILE_TALK
=> 'File_talk',
385 NS_MEDIAWIKI
=> 'MediaWiki',
386 NS_MEDIAWIKI_TALK
=> 'MediaWiki_talk',
387 NS_TEMPLATE
=> 'Template',
388 NS_TEMPLATE_TALK
=> 'Template_talk',
390 NS_HELP_TALK
=> 'Help_talk',
391 NS_CATEGORY
=> 'Category',
392 NS_CATEGORY_TALK
=> 'Category_talk',
396 if ( is_array( $wgExtraNamespaces ) ) {
397 $wgCanonicalNamespaceNames = $wgCanonicalNamespaceNames +
$wgExtraNamespaces;
400 // These are now the same, always
401 // To determine the user language, use $wgLang->getCode()
402 $wgContLanguageCode = $wgLanguageCode;
404 // Easy to forget to falsify $wgShowIPinHeader for static caches.
405 // If file cache or squid cache is on, just disable this (DWIMD).
406 // Do the same for $wgDebugToolbar.
407 if ( $wgUseFileCache ||
$wgUseSquid ) {
408 $wgShowIPinHeader = false;
409 $wgDebugToolbar = false;
412 // We always output HTML5 since 1.22, overriding these is no longer supported
413 // we set them here for extensions that depend on its value.
415 $wgXhtmlDefaultNamespace = 'http://www.w3.org/1999/xhtml';
416 $wgJsMimeType = 'text/javascript';
418 if ( !$wgHtml5Version && $wgAllowRdfaAttributes ) {
419 // see http://www.w3.org/TR/rdfa-in-html/#document-conformance
420 if ( $wgMimeType == 'application/xhtml+xml' ) {
421 $wgHtml5Version = 'XHTML+RDFa 1.0';
423 $wgHtml5Version = 'HTML+RDFa 1.0';
427 // Blacklisted file extensions shouldn't appear on the "allowed" list
428 $wgFileExtensions = array_values( array_diff ( $wgFileExtensions, $wgFileBlacklist ) );
430 if ( $wgInvalidateCacheOnLocalSettingsChange ) {
431 // @codingStandardsIgnoreStart Generic.PHP.NoSilencedErrors.Discouraged - No GlobalFunction here yet.
432 $wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis', @filemtime
( "$IP/LocalSettings.php" ) ) );
433 // @codingStandardsIgnoreEnd
436 if ( $wgNewUserLog ) {
437 // Add a new log type
438 $wgLogTypes[] = 'newusers';
439 $wgLogNames['newusers'] = 'newuserlogpage';
440 $wgLogHeaders['newusers'] = 'newuserlogpagetext';
441 $wgLogActionsHandlers['newusers/newusers'] = 'NewUsersLogFormatter';
442 $wgLogActionsHandlers['newusers/create'] = 'NewUsersLogFormatter';
443 $wgLogActionsHandlers['newusers/create2'] = 'NewUsersLogFormatter';
444 $wgLogActionsHandlers['newusers/byemail'] = 'NewUsersLogFormatter';
445 $wgLogActionsHandlers['newusers/autocreate'] = 'NewUsersLogFormatter';
448 if ( $wgPageLanguageUseDB ) {
449 $wgLogTypes[] = 'pagelang';
450 $wgLogActionsHandlers['pagelang/pagelang'] = 'PageLangLogFormatter';
453 if ( $wgCookieSecure === 'detect' ) {
454 $wgCookieSecure = ( WebRequest
::detectProtocol() === 'https' );
457 // Back compatibility for $wgRateLimitLog deprecated with 1.23
458 if ( $wgRateLimitLog && !array_key_exists( 'ratelimit', $wgDebugLogGroups ) ) {
459 $wgDebugLogGroups['ratelimit'] = $wgRateLimitLog;
462 if ( $wgProfileOnly ) {
463 $wgDebugLogGroups['profileoutput'] = $wgDebugLogFile;
464 $wgDebugLogFile = '';
467 Profiler
::instance()->scopedProfileOut( $ps_default );
469 // Disable MWDebug for command line mode, this prevents MWDebug from eating up
470 // all the memory from logging SQL queries on maintenance scripts
471 global $wgCommandLineMode;
472 if ( $wgDebugToolbar && !$wgCommandLineMode ) {
476 if ( !class_exists( 'AutoLoader' ) ) {
477 require_once "$IP/includes/AutoLoader.php";
480 MWExceptionHandler
::installHandler();
482 require_once "$IP/includes/libs/normal/UtfNormalUtil.php";
484 $ps_default2 = Profiler
::instance()->scopedProfileIn( $fname . '-defaults2' );
486 if ( $wgCanonicalServer === false ) {
487 $wgCanonicalServer = wfExpandUrl( $wgServer, PROTO_HTTP
);
491 $serverParts = wfParseUrl( $wgCanonicalServer );
492 if ( $wgServerName !== false ) {
493 wfWarn( '$wgServerName should be derived from $wgCanonicalServer, '
494 . 'not customized. Overwriting $wgServerName.' );
496 $wgServerName = $serverParts['host'];
497 unset( $serverParts );
499 // Set defaults for configuration variables
500 // that are derived from the server name by default
501 if ( $wgEmergencyContact === false ) {
502 $wgEmergencyContact = 'wikiadmin@' . $wgServerName;
505 if ( $wgPasswordSender === false ) {
506 $wgPasswordSender = 'apache@' . $wgServerName;
509 if ( $wgSecureLogin && substr( $wgServer, 0, 2 ) !== '//' ) {
510 $wgSecureLogin = false;
511 wfWarn( 'Secure login was enabled on a server that only supports '
512 . 'HTTP or HTTPS. Disabling secure login.' );
515 // Now that GlobalFunctions is loaded, set defaults that depend on it.
516 if ( $wgTmpDirectory === false ) {
517 $ps_tmpdir = Profiler
::instance()->scopedProfileIn( $fname . '-tempDir' );
518 $wgTmpDirectory = wfTempDir();
519 Profiler
::instance()->scopedProfileOut( $ps_tmpdir );
522 // We don't use counters anymore. Left here for extensions still
523 // expecting this to exist. Should be removed sometime 1.26 or later.
524 $wgDisableCounters = true;
526 Profiler
::instance()->scopedProfileOut( $ps_default2 );
528 $ps_misc = Profiler
::instance()->scopedProfileIn( $fname . '-misc1' );
530 // Raise the memory limit if it's too low
534 * Set up the timezone, suppressing the pseudo-security warning in PHP 5.1+
535 * that happens whenever you use a date function without the timezone being
536 * explicitly set. Inspired by phpMyAdmin's treatment of the problem.
538 if ( is_null( $wgLocaltimezone ) ) {
539 wfSuppressWarnings();
540 $wgLocaltimezone = date_default_timezone_get();
544 date_default_timezone_set( $wgLocaltimezone );
545 if ( is_null( $wgLocalTZoffset ) ) {
546 $wgLocalTZoffset = date( 'Z' ) / 60;
549 // Useful debug output
550 if ( $wgCommandLineMode ) {
551 $wgRequest = new FauxRequest( array() );
553 wfDebug( "\n\nStart command line script $self\n" );
555 // Can't stub this one, it sets up $_GET and $_REQUEST in its constructor
556 $wgRequest = new WebRequest
;
558 $debug = "\n\nStart request {$wgRequest->getMethod()} {$wgRequest->getRequestURL()}\n";
560 if ( $wgDebugPrintHttpHeaders ) {
561 $debug .= "HTTP HEADERS:\n";
563 foreach ( $wgRequest->getAllHeaders() as $name => $value ) {
564 $debug .= "$name: $value\n";
570 Profiler
::instance()->scopedProfileOut( $ps_misc );
571 $ps_memcached = Profiler
::instance()->scopedProfileIn( $fname . '-memcached' );
573 $wgMemc = wfGetMainCache();
574 $messageMemc = wfGetMessageCacheStorage();
575 $parserMemc = wfGetParserCacheStorage();
577 wfDebugLog( 'caches', 'main: ' . get_class( $wgMemc ) .
578 ', message: ' . get_class( $messageMemc ) .
579 ', parser: ' . get_class( $parserMemc ) );
581 Profiler
::instance()->scopedProfileOut( $ps_memcached );
583 // Most of the config is out, some might want to run hooks here.
584 Hooks
::run( 'SetupAfterCache' );
586 $ps_session = Profiler
::instance()->scopedProfileIn( $fname . '-session' );
588 if ( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode ) {
589 // If session.auto_start is there, we can't touch session name
590 if ( !wfIniGetBool( 'session.auto_start' ) ) {
591 session_name( $wgSessionName ?
$wgSessionName : $wgCookiePrefix . '_session' );
594 if ( $wgRequest->checkSessionCookie() ||
isset( $_COOKIE[$wgCookiePrefix . 'Token'] ) ) {
599 Profiler
::instance()->scopedProfileOut( $ps_session );
600 $ps_globals = Profiler
::instance()->scopedProfileIn( $fname . '-globals' );
603 * @var Language $wgContLang
605 $wgContLang = Language
::factory( $wgLanguageCode );
606 $wgContLang->initEncoding();
607 $wgContLang->initContLang();
609 // Now that variant lists may be available...
610 $wgRequest->interpolateTitle();
615 $wgUser = RequestContext
::getMain()->getUser(); // BackCompat
618 * @var Language $wgLang
620 $wgLang = new StubUserLang
;
623 * @var OutputPage $wgOut
625 $wgOut = RequestContext
::getMain()->getOutput(); // BackCompat
628 * @var Parser $wgParser
630 $wgParser = new StubObject( 'wgParser', $wgParserConf['class'], array( $wgParserConf ) );
632 if ( !is_object( $wgAuth ) ) {
633 $wgAuth = new AuthPlugin
;
634 Hooks
::run( 'AuthPluginSetup', array( &$wgAuth ) );
638 * @var Title $wgTitle
643 * @deprecated since 1.24 Use DeferredUpdates::addUpdate instead
646 $wgDeferredUpdateList = array();
648 Profiler
::instance()->scopedProfileOut( $ps_globals );
649 $ps_extensions = Profiler
::instance()->scopedProfileIn( $fname . '-extensions' );
651 // Extension setup functions for extensions other than skins
652 // Entries should be added to this variable during the inclusion
653 // of the extension file. This allows the extension to perform
654 // any necessary initialisation in the fully initialised environment
655 foreach ( $wgExtensionFunctions as $func ) {
656 // Allow closures in PHP 5.3+
657 if ( is_object( $func ) && $func instanceof Closure
) {
658 $profName = $fname . '-extensions-closure';
659 } elseif ( is_array( $func ) ) {
660 if ( is_object( $func[0] ) ) {
661 $profName = $fname . '-extensions-' . get_class( $func[0] ) . '::' . $func[1];
663 $profName = $fname . '-extensions-' . implode( '::', $func );
666 $profName = $fname . '-extensions-' . strval( $func );
669 $ps_ext_func = Profiler
::instance()->scopedProfileIn( $profName );
670 call_user_func( $func );
671 Profiler
::instance()->scopedProfileOut( $ps_ext_func );
674 wfDebug( "Fully initialised\n" );
675 $wgFullyInitialised = true;
677 Profiler
::instance()->scopedProfileOut( $ps_extensions );
678 Profiler
::instance()->scopedProfileOut( $ps_setup );