38a16c56d13190f21ab9d6edc9cae900b8e07b17
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 $deletedHashLevel = $wgHashedUploadDirectory ?
3 : 0;
173 $wgLocalFileRepo = array(
174 'class' => 'LocalRepo',
176 'directory' => $wgUploadDirectory,
177 'scriptDirUrl' => $wgScriptPath,
178 'scriptExtension' => $wgScriptExtension,
179 'url' => $wgUploadBaseUrl ?
$wgUploadBaseUrl . $wgUploadPath : $wgUploadPath,
180 'hashLevels' => $wgHashedUploadDirectory ?
2 : 0,
181 'thumbScriptUrl' => $wgThumbnailScriptPath,
182 'transformVia404' => !$wgGenerateThumbnailOnParse,
183 'deletedDir' => $wgDeletedDirectory,
184 'deletedHashLevels' => $deletedHashLevel
188 * Initialise shared repo from backwards-compatible settings
190 if ( $wgUseSharedUploads ) {
191 if ( $wgSharedUploadDBname ) {
192 $wgForeignFileRepos[] = array(
193 'class' => 'ForeignDBRepo',
195 'directory' => $wgSharedUploadDirectory,
196 'url' => $wgSharedUploadPath,
197 'hashLevels' => $wgHashedSharedUploadDirectory ?
2 : 0,
198 'thumbScriptUrl' => $wgSharedThumbnailScriptPath,
199 'transformVia404' => !$wgGenerateThumbnailOnParse,
200 'dbType' => $wgDBtype,
201 'dbServer' => $wgDBserver,
202 'dbUser' => $wgDBuser,
203 'dbPassword' => $wgDBpassword,
204 'dbName' => $wgSharedUploadDBname,
205 'dbFlags' => ( $wgDebugDumpSql ? DBO_DEBUG
: 0 ) | DBO_DEFAULT
,
206 'tablePrefix' => $wgSharedUploadDBprefix,
207 'hasSharedCache' => $wgCacheSharedUploads,
208 'descBaseUrl' => $wgRepositoryBaseUrl,
209 'fetchDescription' => $wgFetchCommonsDescriptions,
212 $wgForeignFileRepos[] = array(
213 'class' => 'FileRepo',
215 'directory' => $wgSharedUploadDirectory,
216 'url' => $wgSharedUploadPath,
217 'hashLevels' => $wgHashedSharedUploadDirectory ?
2 : 0,
218 'thumbScriptUrl' => $wgSharedThumbnailScriptPath,
219 'transformVia404' => !$wgGenerateThumbnailOnParse,
220 'descBaseUrl' => $wgRepositoryBaseUrl,
221 'fetchDescription' => $wgFetchCommonsDescriptions,
225 if ( $wgUseInstantCommons ) {
226 $wgForeignFileRepos[] = array(
227 'class' => 'ForeignAPIRepo',
228 'name' => 'wikimediacommons',
229 'apibase' => WebRequest
::detectProtocol() === 'https' ?
230 'https://commons.wikimedia.org/w/api.php' :
231 'http://commons.wikimedia.org/w/api.php',
233 'fetchDescription' => true,
234 'descriptionCacheExpiry' => 43200,
235 'apiThumbCacheExpiry' => 86400,
239 * Add on default file backend config for file repos.
240 * FileBackendGroup will handle initializing the backends.
242 if ( !isset( $wgLocalFileRepo['backend'] ) ) {
243 $wgLocalFileRepo['backend'] = $wgLocalFileRepo['name'] . '-backend';
245 foreach ( $wgForeignFileRepos as &$repo ) {
246 if ( !isset( $repo['directory'] ) && $repo['class'] === 'ForeignAPIRepo' ) {
247 $repo['directory'] = $wgUploadDirectory; // b/c
249 if ( !isset( $repo['backend'] ) ) {
250 $repo['backend'] = $repo['name'] . '-backend';
253 unset( $repo ); // no global pollution; destroy reference
255 if ( $wgRCFilterByAge ) {
256 // Trim down $wgRCLinkDays so that it only lists links which are valid
257 // as determined by $wgRCMaxAge.
258 // Note that we allow 1 link higher than the max for things like 56 days but a 60 day link.
259 sort( $wgRCLinkDays );
261 // @codingStandardsIgnoreStart Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed
262 for ( $i = 0; $i < count( $wgRCLinkDays ); $i++
) {
263 // @codingStandardsIgnoreEnd
264 if ( $wgRCLinkDays[$i] >= $wgRCMaxAge / ( 3600 * 24 ) ) {
265 $wgRCLinkDays = array_slice( $wgRCLinkDays, 0, $i +
1, false );
272 $wgSkipSkins[] = $wgSkipSkin;
275 if ( $wgLocalInterwiki ) {
276 array_unshift( $wgLocalInterwikis, $wgLocalInterwiki );
279 // Set default shared prefix
280 if ( $wgSharedPrefix === false ) {
281 $wgSharedPrefix = $wgDBprefix;
284 if ( !$wgCookiePrefix ) {
285 if ( $wgSharedDB && $wgSharedPrefix && in_array( 'user', $wgSharedTables ) ) {
286 $wgCookiePrefix = $wgSharedDB . '_' . $wgSharedPrefix;
287 } elseif ( $wgSharedDB && in_array( 'user', $wgSharedTables ) ) {
288 $wgCookiePrefix = $wgSharedDB;
289 } elseif ( $wgDBprefix ) {
290 $wgCookiePrefix = $wgDBname . '_' . $wgDBprefix;
292 $wgCookiePrefix = $wgDBname;
295 $wgCookiePrefix = strtr( $wgCookiePrefix, '=,; +."\'\\[', '__________' );
297 $wgUseEnotif = $wgEnotifUserTalk ||
$wgEnotifWatchlist;
299 if ( $wgMetaNamespace === false ) {
300 $wgMetaNamespace = str_replace( ' ', '_', $wgSitename );
303 // Default value is either the suhosin limit or -1 for unlimited
304 if ( $wgResourceLoaderMaxQueryLength === false ) {
305 $maxValueLength = ini_get( 'suhosin.get.max_value_length' );
306 $wgResourceLoaderMaxQueryLength = $maxValueLength > 0 ?
$maxValueLength : -1;
310 * Definitions of the NS_ constants are in Defines.php
313 $wgCanonicalNamespaceNames = array(
315 NS_SPECIAL
=> 'Special',
318 NS_USER_TALK
=> 'User_talk',
319 NS_PROJECT
=> 'Project',
320 NS_PROJECT_TALK
=> 'Project_talk',
322 NS_FILE_TALK
=> 'File_talk',
323 NS_MEDIAWIKI
=> 'MediaWiki',
324 NS_MEDIAWIKI_TALK
=> 'MediaWiki_talk',
325 NS_TEMPLATE
=> 'Template',
326 NS_TEMPLATE_TALK
=> 'Template_talk',
328 NS_HELP_TALK
=> 'Help_talk',
329 NS_CATEGORY
=> 'Category',
330 NS_CATEGORY_TALK
=> 'Category_talk',
334 if ( is_array( $wgExtraNamespaces ) ) {
335 $wgCanonicalNamespaceNames = $wgCanonicalNamespaceNames +
$wgExtraNamespaces;
338 // These are now the same, always
339 // To determine the user language, use $wgLang->getCode()
340 $wgContLanguageCode = $wgLanguageCode;
342 // Easy to forget to falsify $wgShowIPinHeader for static caches.
343 // If file cache or squid cache is on, just disable this (DWIMD).
344 // Do the same for $wgDebugToolbar.
345 if ( $wgUseFileCache ||
$wgUseSquid ) {
346 $wgShowIPinHeader = false;
347 $wgDebugToolbar = false;
350 // Doesn't make sense to have if disabled.
351 if ( !$wgEnotifMinorEdits ) {
352 $wgHiddenPrefs[] = 'enotifminoredits';
355 // We always output HTML5 since 1.22, overriding these is no longer supported
356 // we set them here for extensions that depend on its value.
358 $wgXhtmlDefaultNamespace = 'http://www.w3.org/1999/xhtml';
359 $wgJsMimeType = 'text/javascript';
361 if ( !$wgHtml5Version && $wgAllowRdfaAttributes ) {
362 // see http://www.w3.org/TR/rdfa-in-html/#document-conformance
363 if ( $wgMimeType == 'application/xhtml+xml' ) {
364 $wgHtml5Version = 'XHTML+RDFa 1.0';
366 $wgHtml5Version = 'HTML+RDFa 1.0';
370 // Blacklisted file extensions shouldn't appear on the "allowed" list
371 $wgFileExtensions = array_values( array_diff ( $wgFileExtensions, $wgFileBlacklist ) );
373 if ( $wgArticleCountMethod === null ) {
374 $wgArticleCountMethod = $wgUseCommaCount ?
'comma' : 'link';
377 if ( $wgInvalidateCacheOnLocalSettingsChange ) {
378 // @codingStandardsIgnoreStart Generic.PHP.NoSilencedErrors.Discouraged - No GlobalFunction here yet.
379 $wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis', @filemtime
( "$IP/LocalSettings.php" ) ) );
380 // @codingStandardsIgnoreEnd
383 if ( $wgNewUserLog ) {
384 // Add a new log type
385 $wgLogTypes[] = 'newusers';
386 $wgLogNames['newusers'] = 'newuserlogpage';
387 $wgLogHeaders['newusers'] = 'newuserlogpagetext';
388 $wgLogActionsHandlers['newusers/newusers'] = 'NewUsersLogFormatter';
389 $wgLogActionsHandlers['newusers/create'] = 'NewUsersLogFormatter';
390 $wgLogActionsHandlers['newusers/create2'] = 'NewUsersLogFormatter';
391 $wgLogActionsHandlers['newusers/byemail'] = 'NewUsersLogFormatter';
392 $wgLogActionsHandlers['newusers/autocreate'] = 'NewUsersLogFormatter';
395 if ( $wgPageLanguageUseDB ) {
396 $wgLogTypes[] = 'pagelang';
397 $wgLogActionsHandlers['pagelang/pagelang'] = 'PageLangLogFormatter';
400 if ( $wgCookieSecure === 'detect' ) {
401 $wgCookieSecure = ( WebRequest
::detectProtocol() === 'https' );
404 if ( $wgRC2UDPAddress ) {
405 $wgRCFeeds['default'] = array(
406 'formatter' => 'IRCColourfulRCFeedFormatter',
407 'uri' => "udp://$wgRC2UDPAddress:$wgRC2UDPPort/$wgRC2UDPPrefix",
408 'add_interwiki_prefix' => &$wgRC2UDPInterwikiPrefix,
409 'omit_bots' => &$wgRC2UDPOmitBots,
413 wfProfileOut( $fname . '-defaults' );
415 // Disable MWDebug for command line mode, this prevents MWDebug from eating up
416 // all the memory from logging SQL queries on maintenance scripts
417 global $wgCommandLineMode;
418 if ( $wgDebugToolbar && !$wgCommandLineMode ) {
419 wfProfileIn( $fname . '-debugtoolbar' );
421 wfProfileOut( $fname . '-debugtoolbar' );
424 if ( !class_exists( 'AutoLoader' ) ) {
425 require_once "$IP/includes/AutoLoader.php";
428 wfProfileIn( $fname . '-exception' );
429 MWExceptionHandler
::installHandler();
430 wfProfileOut( $fname . '-exception' );
432 wfProfileIn( $fname . '-includes' );
433 require_once "$IP/includes/normal/UtfNormalUtil.php";
434 require_once "$IP/includes/GlobalFunctions.php";
435 require_once "$IP/includes/normal/UtfNormalDefines.php";
436 wfProfileOut( $fname . '-includes' );
438 wfProfileIn( $fname . '-defaults2' );
440 if ( $wgCanonicalServer === false ) {
441 $wgCanonicalServer = wfExpandUrl( $wgServer, PROTO_HTTP
);
445 $serverParts = wfParseUrl( $wgCanonicalServer );
446 if ( $wgServerName !== false ) {
447 wfWarn( '$wgServerName should be derived from $wgCanonicalServer, '
448 . 'not customized. Overwriting $wgServerName.' );
450 $wgServerName = $serverParts['host'];
451 unset( $serverParts );
453 // Set defaults for configuration variables
454 // that are derived from the server name by default
455 if ( $wgEmergencyContact === false ) {
456 $wgEmergencyContact = 'wikiadmin@' . $wgServerName;
459 if ( $wgPasswordSender === false ) {
460 $wgPasswordSender = 'apache@' . $wgServerName;
463 if ( $wgSecureLogin && substr( $wgServer, 0, 2 ) !== '//' ) {
464 $wgSecureLogin = false;
465 wfWarn( 'Secure login was enabled on a server that only supports '
466 . 'HTTP or HTTPS. Disabling secure login.' );
469 // Now that GlobalFunctions is loaded, set defaults that depend
471 if ( $wgTmpDirectory === false ) {
472 wfProfileIn( $fname . '-tempDir' );
473 $wgTmpDirectory = wfTempDir();
474 wfProfileOut( $fname . '-tempDir' );
477 // $wgHTCPMulticastRouting got renamed to $wgHTCPRouting in MediaWiki 1.22
478 // ensure back compatibility.
479 if ( !$wgHTCPRouting && $wgHTCPMulticastRouting ) {
480 $wgHTCPRouting = $wgHTCPMulticastRouting;
483 // Initialize $wgHTCPRouting from backwards-compatible settings that
484 // comes from pre 1.20 version.
485 if ( !$wgHTCPRouting && $wgHTCPMulticastAddress ) {
486 $wgHTCPRouting = array(
488 'host' => $wgHTCPMulticastAddress,
489 'port' => $wgHTCPPort,
494 // Back compatibility for $wgRateLimitLog deprecated with 1.23
495 if ( $wgRateLimitLog && ! array_key_exists( 'ratelimit', $wgDebugLogGroups ) ) {
496 $wgDebugLogGroups['ratelimit'] = $wgRateLimitLog;
499 if ( $wgProfileOnly ) {
500 $wgDebugLogGroups['profileoutput'] = $wgDebugLogFile;
501 $wgDebugLogFile = '';
504 wfProfileOut( $fname . '-defaults2' );
505 wfProfileIn( $fname . '-misc1' );
507 // Raise the memory limit if it's too low
511 * Set up the timezone, suppressing the pseudo-security warning in PHP 5.1+
512 * that happens whenever you use a date function without the timezone being
513 * explicitly set. Inspired by phpMyAdmin's treatment of the problem.
515 if ( is_null( $wgLocaltimezone ) ) {
516 wfSuppressWarnings();
517 $wgLocaltimezone = date_default_timezone_get();
521 date_default_timezone_set( $wgLocaltimezone );
522 if ( is_null( $wgLocalTZoffset ) ) {
523 $wgLocalTZoffset = date( 'Z' ) / 60;
526 // Useful debug output
527 if ( $wgCommandLineMode ) {
528 $wgRequest = new FauxRequest( array() );
530 wfDebug( "\n\nStart command line script $self\n" );
532 // Can't stub this one, it sets up $_GET and $_REQUEST in its constructor
533 $wgRequest = new WebRequest
;
535 $debug = "\n\nStart request {$wgRequest->getMethod()} {$wgRequest->getRequestURL()}\n";
537 if ( $wgDebugPrintHttpHeaders ) {
538 $debug .= "HTTP HEADERS:\n";
540 foreach ( $wgRequest->getAllHeaders() as $name => $value ) {
541 $debug .= "$name: $value\n";
547 wfProfileOut( $fname . '-misc1' );
548 wfProfileIn( $fname . '-memcached' );
550 $wgMemc = wfGetMainCache();
551 $messageMemc = wfGetMessageCacheStorage();
552 $parserMemc = wfGetParserCacheStorage();
553 $wgLangConvMemc = wfGetLangConverterCacheStorage();
555 wfDebugLog( 'caches', 'main: ' . get_class( $wgMemc ) .
556 ', message: ' . get_class( $messageMemc ) .
557 ', parser: ' . get_class( $parserMemc ) );
559 wfProfileOut( $fname . '-memcached' );
561 // Most of the config is out, some might want to run hooks here.
562 wfRunHooks( 'SetupAfterCache' );
564 wfProfileIn( $fname . '-session' );
566 // If session.auto_start is there, we can't touch session name
567 if ( !wfIniGetBool( 'session.auto_start' ) ) {
568 session_name( $wgSessionName ?
$wgSessionName : $wgCookiePrefix . '_session' );
571 if ( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode &&
572 ( $wgRequest->checkSessionCookie() ||
isset( $_COOKIE[$wgCookiePrefix . 'Token'] ) )
577 wfProfileOut( $fname . '-session' );
578 wfProfileIn( $fname . '-globals' );
581 * @var Language $wgContLang
583 $wgContLang = Language
::factory( $wgLanguageCode );
584 $wgContLang->initEncoding();
585 $wgContLang->initContLang();
587 // Now that variant lists may be available...
588 $wgRequest->interpolateTitle();
593 $wgUser = RequestContext
::getMain()->getUser(); // BackCompat
596 * @var Language $wgLang
598 $wgLang = new StubUserLang
;
601 * @var OutputPage $wgOut
603 $wgOut = RequestContext
::getMain()->getOutput(); // BackCompat
606 * @var Parser $wgParser
608 $wgParser = new StubObject( 'wgParser', $wgParserConf['class'], array( $wgParserConf ) );
610 if ( !is_object( $wgAuth ) ) {
611 $wgAuth = new AuthPlugin
;
612 wfRunHooks( 'AuthPluginSetup', array( &$wgAuth ) );
616 * @var Title $wgTitle
620 $wgDeferredUpdateList = array();
622 // Disable all other email settings automatically if $wgEnableEmail
623 // is set to false. - bug 63678
624 if ( !$wgEnableEmail ) {
625 $wgAllowHTMLEmail = false;
626 $wgEmailAuthentication = false; // do not require auth if you're not sending email anyway
627 $wgEnableUserEmail = false;
628 $wgEnotifFromEditor = false;
629 $wgEnotifImpersonal = false;
630 $wgEnotifMaxRecips = 0;
631 $wgEnotifMinorEdits = false;
632 $wgEnotifRevealEditorAddress = false;
633 $wgEnotifUseJobQ = false;
634 $wgEnotifUseRealName = false;
635 $wgEnotifUserTalk = false;
636 $wgEnotifWatchlist = false;
637 unset( $wgGroupPermissions['user']['sendemail'] );
638 $wgUserEmailUseReplyTo = false;
639 $wgUsersNotifiedOnAllChanges = 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];
657 $profName = $fname . '-extensions-' . implode( '::', $func );
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 );