Merge "Link to existing login help page by default from helplogin-url"
[lhc/web/wiklou.git] / includes / Setup.php
1 <?php
2 /**
3 * Include most things that's need to customize the site.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
19 *
20 * @file
21 */
22
23 /**
24 * This file is not a valid entry point, perform no further processing unless
25 * MEDIAWIKI is defined
26 */
27 if ( !defined( 'MEDIAWIKI' ) ) {
28 exit( 1 );
29 }
30
31 # The main wiki script and things like database
32 # conversion and maintenance scripts all share a
33 # common setup of including lots of classes and
34 # setting up a few globals.
35 #
36
37 $fname = 'Setup.php';
38 wfProfileIn( $fname );
39 wfProfileIn( $fname . '-defaults' );
40
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";
44 die( 1 );
45 }
46
47 // Set various default paths sensibly...
48 if ( $wgScript === false ) {
49 $wgScript = "$wgScriptPath/index$wgScriptExtension";
50 }
51 if ( $wgLoadScript === false ) {
52 $wgLoadScript = "$wgScriptPath/load$wgScriptExtension";
53 }
54
55 if ( $wgArticlePath === false ) {
56 if ( $wgUsePathInfo ) {
57 $wgArticlePath = "$wgScript/$1";
58 } else {
59 $wgArticlePath = "$wgScript?title=$1";
60 }
61 }
62
63 if ( !empty( $wgActionPaths ) && !isset( $wgActionPaths['view'] ) ) {
64 # 'view' is assumed the default action path everywhere in the code
65 # but is rarely filled in $wgActionPaths
66 $wgActionPaths['view'] = $wgArticlePath;
67 }
68
69 if ( $wgStylePath === false ) {
70 $wgStylePath = "$wgScriptPath/skins";
71 }
72 if ( $wgLocalStylePath === false ) {
73 $wgLocalStylePath = "$wgScriptPath/skins";
74 }
75 if ( $wgStyleDirectory === false ) {
76 $wgStyleDirectory = "$IP/skins";
77 }
78 if ( $wgExtensionAssetsPath === false ) {
79 $wgExtensionAssetsPath = "$wgScriptPath/extensions";
80 }
81
82 if ( $wgLogo === false ) {
83 $wgLogo = "$wgStylePath/common/images/wiki.png";
84 }
85
86 if ( $wgUploadPath === false ) {
87 $wgUploadPath = "$wgScriptPath/images";
88 }
89 if ( $wgUploadDirectory === false ) {
90 $wgUploadDirectory = "$IP/images";
91 }
92 if ( $wgReadOnlyFile === false ) {
93 $wgReadOnlyFile = "{$wgUploadDirectory}/lock_yBgMBwiR";
94 }
95 if ( $wgFileCacheDirectory === false ) {
96 $wgFileCacheDirectory = "{$wgUploadDirectory}/cache";
97 }
98 if ( $wgDeletedDirectory === false ) {
99 $wgDeletedDirectory = "{$wgUploadDirectory}/deleted";
100 }
101
102 if ( isset( $wgFileStore['deleted']['directory'] ) ) {
103 $wgDeletedDirectory = $wgFileStore['deleted']['directory'];
104 }
105
106 if ( isset( $wgFooterIcons['copyright'] )
107 && isset( $wgFooterIcons['copyright']['copyright'] )
108 && $wgFooterIcons['copyright']['copyright'] === array()
109 ) {
110 if ( isset( $wgCopyrightIcon ) && $wgCopyrightIcon ) {
111 $wgFooterIcons['copyright']['copyright'] = $wgCopyrightIcon;
112 } elseif ( $wgRightsIcon || $wgRightsText ) {
113 $wgFooterIcons['copyright']['copyright'] = array(
114 'url' => $wgRightsUrl,
115 'src' => $wgRightsIcon,
116 'alt' => $wgRightsText,
117 );
118 } else {
119 unset( $wgFooterIcons['copyright']['copyright'] );
120 }
121 }
122
123 if ( isset( $wgFooterIcons['poweredby'] )
124 && isset( $wgFooterIcons['poweredby']['mediawiki'] )
125 && $wgFooterIcons['poweredby']['mediawiki']['src'] === null
126 ) {
127 $wgFooterIcons['poweredby']['mediawiki']['src'] = "$wgStylePath/common/images/poweredby_mediawiki_88x31.png";
128 }
129
130 /**
131 * Unconditional protection for NS_MEDIAWIKI since otherwise it's too easy for a
132 * sysadmin to set $wgNamespaceProtection incorrectly and leave the wiki insecure.
133 *
134 * Note that this is the definition of editinterface and it can be granted to
135 * all users if desired.
136 */
137 $wgNamespaceProtection[NS_MEDIAWIKI] = 'editinterface';
138
139 /**
140 * The canonical names of namespaces 6 and 7 are, as of v1.14, "File"
141 * and "File_talk". The old names "Image" and "Image_talk" are
142 * retained as aliases for backwards compatibility.
143 */
144 $wgNamespaceAliases['Image'] = NS_FILE;
145 $wgNamespaceAliases['Image_talk'] = NS_FILE_TALK;
146
147 /**
148 * Initialise $wgLockManagers to include basic FS version
149 */
150 $wgLockManagers[] = array(
151 'name' => 'fsLockManager',
152 'class' => 'FSLockManager',
153 'lockDirectory' => "{$wgUploadDirectory}/lockdir",
154 );
155 $wgLockManagers[] = array(
156 'name' => 'nullLockManager',
157 'class' => 'NullLockManager',
158 );
159
160 /**
161 * Initialise $wgLocalFileRepo from backwards-compatible settings
162 */
163 if ( !$wgLocalFileRepo ) {
164 if ( isset( $wgFileStore['deleted']['hash'] ) ) {
165 $deletedHashLevel = $wgFileStore['deleted']['hash'];
166 } else {
167 $deletedHashLevel = $wgHashedUploadDirectory ? 3 : 0;
168 }
169 $wgLocalFileRepo = array(
170 'class' => 'LocalRepo',
171 'name' => 'local',
172 'directory' => $wgUploadDirectory,
173 'scriptDirUrl' => $wgScriptPath,
174 'scriptExtension' => $wgScriptExtension,
175 'url' => $wgUploadBaseUrl ? $wgUploadBaseUrl . $wgUploadPath : $wgUploadPath,
176 'hashLevels' => $wgHashedUploadDirectory ? 2 : 0,
177 'thumbScriptUrl' => $wgThumbnailScriptPath,
178 'transformVia404' => !$wgGenerateThumbnailOnParse,
179 'deletedDir' => $wgDeletedDirectory,
180 'deletedHashLevels' => $deletedHashLevel
181 );
182 }
183 /**
184 * Initialise shared repo from backwards-compatible settings
185 */
186 if ( $wgUseSharedUploads ) {
187 if ( $wgSharedUploadDBname ) {
188 $wgForeignFileRepos[] = array(
189 'class' => 'ForeignDBRepo',
190 'name' => 'shared',
191 'directory' => $wgSharedUploadDirectory,
192 'url' => $wgSharedUploadPath,
193 'hashLevels' => $wgHashedSharedUploadDirectory ? 2 : 0,
194 'thumbScriptUrl' => $wgSharedThumbnailScriptPath,
195 'transformVia404' => !$wgGenerateThumbnailOnParse,
196 'dbType' => $wgDBtype,
197 'dbServer' => $wgDBserver,
198 'dbUser' => $wgDBuser,
199 'dbPassword' => $wgDBpassword,
200 'dbName' => $wgSharedUploadDBname,
201 'dbFlags' => ( $wgDebugDumpSql ? DBO_DEBUG : 0 ) | DBO_DEFAULT,
202 'tablePrefix' => $wgSharedUploadDBprefix,
203 'hasSharedCache' => $wgCacheSharedUploads,
204 'descBaseUrl' => $wgRepositoryBaseUrl,
205 'fetchDescription' => $wgFetchCommonsDescriptions,
206 );
207 } else {
208 $wgForeignFileRepos[] = array(
209 'class' => 'FileRepo',
210 'name' => 'shared',
211 'directory' => $wgSharedUploadDirectory,
212 'url' => $wgSharedUploadPath,
213 'hashLevels' => $wgHashedSharedUploadDirectory ? 2 : 0,
214 'thumbScriptUrl' => $wgSharedThumbnailScriptPath,
215 'transformVia404' => !$wgGenerateThumbnailOnParse,
216 'descBaseUrl' => $wgRepositoryBaseUrl,
217 'fetchDescription' => $wgFetchCommonsDescriptions,
218 );
219 }
220 }
221 if ( $wgUseInstantCommons ) {
222 $wgForeignFileRepos[] = array(
223 'class' => 'ForeignAPIRepo',
224 'name' => 'wikimediacommons',
225 'apibase' => WebRequest::detectProtocol() === 'https' ?
226 'https://commons.wikimedia.org/w/api.php' :
227 'http://commons.wikimedia.org/w/api.php',
228 'hashLevels' => 2,
229 'fetchDescription' => true,
230 'descriptionCacheExpiry' => 43200,
231 'apiThumbCacheExpiry' => 86400,
232 );
233 }
234 /*
235 * Add on default file backend config for file repos.
236 * FileBackendGroup will handle initializing the backends.
237 */
238 if ( !isset( $wgLocalFileRepo['backend'] ) ) {
239 $wgLocalFileRepo['backend'] = $wgLocalFileRepo['name'] . '-backend';
240 }
241 foreach ( $wgForeignFileRepos as &$repo ) {
242 if ( !isset( $repo['directory'] ) && $repo['class'] === 'ForeignAPIRepo' ) {
243 $repo['directory'] = $wgUploadDirectory; // b/c
244 }
245 if ( !isset( $repo['backend'] ) ) {
246 $repo['backend'] = $repo['name'] . '-backend';
247 }
248 }
249 unset( $repo ); // no global pollution; destroy reference
250
251 if ( $wgRCFilterByAge ) {
252 # # Trim down $wgRCLinkDays so that it only lists links which are valid
253 # # as determined by $wgRCMaxAge.
254 # # Note that we allow 1 link higher than the max for things like 56 days but a 60 day link.
255 sort( $wgRCLinkDays );
256 for ( $i = 0; $i < count( $wgRCLinkDays ); $i++ ) {
257 if ( $wgRCLinkDays[$i] >= $wgRCMaxAge / ( 3600 * 24 ) ) {
258 $wgRCLinkDays = array_slice( $wgRCLinkDays, 0, $i + 1, false );
259 break;
260 }
261 }
262 }
263
264 if ( $wgSkipSkin ) {
265 $wgSkipSkins[] = $wgSkipSkin;
266 }
267
268 if ( $wgLocalInterwiki ) {
269 array_unshift( $wgLocalInterwikis, $wgLocalInterwiki );
270 }
271
272 # Set default shared prefix
273 if ( $wgSharedPrefix === false ) {
274 $wgSharedPrefix = $wgDBprefix;
275 }
276
277 if ( !$wgCookiePrefix ) {
278 if ( $wgSharedDB && $wgSharedPrefix && in_array( 'user', $wgSharedTables ) ) {
279 $wgCookiePrefix = $wgSharedDB . '_' . $wgSharedPrefix;
280 } elseif ( $wgSharedDB && in_array( 'user', $wgSharedTables ) ) {
281 $wgCookiePrefix = $wgSharedDB;
282 } elseif ( $wgDBprefix ) {
283 $wgCookiePrefix = $wgDBname . '_' . $wgDBprefix;
284 } else {
285 $wgCookiePrefix = $wgDBname;
286 }
287 }
288 $wgCookiePrefix = strtr( $wgCookiePrefix, '=,; +."\'\\[', '__________' );
289
290 $wgUseEnotif = $wgEnotifUserTalk || $wgEnotifWatchlist;
291
292 if ( $wgMetaNamespace === false ) {
293 $wgMetaNamespace = str_replace( ' ', '_', $wgSitename );
294 }
295
296 // Default value is either the suhosin limit or -1 for unlimited
297 if ( $wgResourceLoaderMaxQueryLength === false ) {
298 $maxValueLength = ini_get( 'suhosin.get.max_value_length' );
299 $wgResourceLoaderMaxQueryLength = $maxValueLength > 0 ? $maxValueLength : -1;
300 }
301
302 /**
303 * Definitions of the NS_ constants are in Defines.php
304 * @private
305 */
306 $wgCanonicalNamespaceNames = array(
307 NS_MEDIA => 'Media',
308 NS_SPECIAL => 'Special',
309 NS_TALK => 'Talk',
310 NS_USER => 'User',
311 NS_USER_TALK => 'User_talk',
312 NS_PROJECT => 'Project',
313 NS_PROJECT_TALK => 'Project_talk',
314 NS_FILE => 'File',
315 NS_FILE_TALK => 'File_talk',
316 NS_MEDIAWIKI => 'MediaWiki',
317 NS_MEDIAWIKI_TALK => 'MediaWiki_talk',
318 NS_TEMPLATE => 'Template',
319 NS_TEMPLATE_TALK => 'Template_talk',
320 NS_HELP => 'Help',
321 NS_HELP_TALK => 'Help_talk',
322 NS_CATEGORY => 'Category',
323 NS_CATEGORY_TALK => 'Category_talk',
324 );
325
326 /// @todo UGLY UGLY
327 if ( is_array( $wgExtraNamespaces ) ) {
328 $wgCanonicalNamespaceNames = $wgCanonicalNamespaceNames + $wgExtraNamespaces;
329 }
330
331 # These are now the same, always
332 # To determine the user language, use $wgLang->getCode()
333 $wgContLanguageCode = $wgLanguageCode;
334
335 # Easy to forget to falsify $wgShowIPinHeader for static caches.
336 # If file cache or squid cache is on, just disable this (DWIMD).
337 # Do the same for $wgDebugToolbar.
338 if ( $wgUseFileCache || $wgUseSquid ) {
339 $wgShowIPinHeader = false;
340 $wgDebugToolbar = false;
341 }
342
343 # Doesn't make sense to have if disabled.
344 if ( !$wgEnotifMinorEdits ) {
345 $wgHiddenPrefs[] = 'enotifminoredits';
346 }
347
348 # We always output HTML5 since 1.22, overriding these is no longer supported
349 # we set them here for extensions that depend on its value.
350 $wgHtml5 = true;
351 $wgXhtmlDefaultNamespace = 'http://www.w3.org/1999/xhtml';
352 $wgJsMimeType = 'text/javascript';
353
354 if ( !$wgHtml5Version && $wgAllowRdfaAttributes ) {
355 # see http://www.w3.org/TR/rdfa-in-html/#document-conformance
356 if ( $wgMimeType == 'application/xhtml+xml' ) {
357 $wgHtml5Version = 'XHTML+RDFa 1.0';
358 } else {
359 $wgHtml5Version = 'HTML+RDFa 1.0';
360 }
361 }
362
363 # Blacklisted file extensions shouldn't appear on the "allowed" list
364 $wgFileExtensions = array_values( array_diff ( $wgFileExtensions, $wgFileBlacklist ) );
365
366 if ( $wgArticleCountMethod === null ) {
367 $wgArticleCountMethod = $wgUseCommaCount ? 'comma' : 'link';
368 }
369
370 if ( $wgInvalidateCacheOnLocalSettingsChange ) {
371 $wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis', @filemtime( "$IP/LocalSettings.php" ) ) );
372 }
373
374 if ( $wgNewUserLog ) {
375 # Add a new log type
376 $wgLogTypes[] = 'newusers';
377 $wgLogNames['newusers'] = 'newuserlogpage';
378 $wgLogHeaders['newusers'] = 'newuserlogpagetext';
379 $wgLogActionsHandlers['newusers/newusers'] = 'NewUsersLogFormatter';
380 $wgLogActionsHandlers['newusers/create'] = 'NewUsersLogFormatter';
381 $wgLogActionsHandlers['newusers/create2'] = 'NewUsersLogFormatter';
382 $wgLogActionsHandlers['newusers/byemail'] = 'NewUsersLogFormatter';
383 $wgLogActionsHandlers['newusers/autocreate'] = 'NewUsersLogFormatter';
384 }
385
386 if ( $wgCookieSecure === 'detect' ) {
387 $wgCookieSecure = ( WebRequest::detectProtocol() === 'https' );
388 }
389
390 if ( $wgRC2UDPAddress ) {
391 $wgRCFeeds['default'] = array(
392 'formatter' => 'IRCColourfulRCFeedFormatter',
393 'uri' => "udp://$wgRC2UDPAddress:$wgRC2UDPPort/$wgRC2UDPPrefix",
394 'add_interwiki_prefix' => &$wgRC2UDPInterwikiPrefix,
395 'omit_bots' => &$wgRC2UDPOmitBots,
396 );
397 }
398
399 wfProfileOut( $fname . '-defaults' );
400
401 // Disable MWDebug for command line mode, this prevents MWDebug from eating up
402 // all the memory from logging SQL queries on maintenance scripts
403 global $wgCommandLineMode;
404 if ( $wgDebugToolbar && !$wgCommandLineMode ) {
405 wfProfileIn( $fname . '-debugtoolbar' );
406 MWDebug::init();
407 wfProfileOut( $fname . '-debugtoolbar' );
408 }
409
410 if ( !class_exists( 'AutoLoader' ) ) {
411 require_once "$IP/includes/AutoLoader.php";
412 }
413
414 wfProfileIn( $fname . '-exception' );
415 MWExceptionHandler::installHandler();
416 wfProfileOut( $fname . '-exception' );
417
418 wfProfileIn( $fname . '-includes' );
419 require_once "$IP/includes/normal/UtfNormalUtil.php";
420 require_once "$IP/includes/GlobalFunctions.php";
421 require_once "$IP/includes/normal/UtfNormalDefines.php";
422 wfProfileOut( $fname . '-includes' );
423
424 wfProfileIn( $fname . '-defaults2' );
425 if ( $wgSecureLogin && substr( $wgServer, 0, 2 ) !== '//' ) {
426 $wgSecureLogin = false;
427 wfWarn( 'Secure login was enabled on a server that only supports HTTP or HTTPS. Disabling secure login.' );
428 }
429
430 # Now that GlobalFunctions is loaded, set defaults that depend
431 # on it.
432 if ( $wgTmpDirectory === false ) {
433 wfProfileIn( $fname . '-tempDir' );
434 $wgTmpDirectory = wfTempDir();
435 wfProfileOut( $fname . '-tempDir' );
436 }
437
438 if ( $wgCanonicalServer === false ) {
439 $wgCanonicalServer = wfExpandUrl( $wgServer, PROTO_HTTP );
440 }
441
442 // $wgHTCPMulticastRouting got renamed to $wgHTCPRouting in MediaWiki 1.22
443 // ensure back compatibility.
444 if ( !$wgHTCPRouting && $wgHTCPMulticastRouting ) {
445 $wgHTCPRouting = $wgHTCPMulticastRouting;
446 }
447
448 // Initialize $wgHTCPRouting from backwards-compatible settings that
449 // comes from pre 1.20 version.
450 if ( !$wgHTCPRouting && $wgHTCPMulticastAddress ) {
451 $wgHTCPRouting = array(
452 '' => array(
453 'host' => $wgHTCPMulticastAddress,
454 'port' => $wgHTCPPort,
455 )
456 );
457 }
458
459 // Back compatibility for $wgRateLimitLog deprecated with 1.23
460 if ( $wgRateLimitLog && ! array_key_exists( 'ratelimit', $wgDebugLogGroups ) ) {
461 $wgDebugLogGroups['ratelimit'] = $wgRateLimitLog;
462 }
463
464 wfProfileOut( $fname . '-defaults2' );
465 wfProfileIn( $fname . '-misc1' );
466
467 # Raise the memory limit if it's too low
468 wfMemoryLimit();
469
470 /**
471 * Set up the timezone, suppressing the pseudo-security warning in PHP 5.1+
472 * that happens whenever you use a date function without the timezone being
473 * explicitly set. Inspired by phpMyAdmin's treatment of the problem.
474 */
475 if ( is_null( $wgLocaltimezone ) ) {
476 wfSuppressWarnings();
477 $wgLocaltimezone = date_default_timezone_get();
478 wfRestoreWarnings();
479 }
480
481 date_default_timezone_set( $wgLocaltimezone );
482 if ( is_null( $wgLocalTZoffset ) ) {
483 $wgLocalTZoffset = date( 'Z' ) / 60;
484 }
485
486 # Useful debug output
487 if ( $wgCommandLineMode ) {
488 $wgRequest = new FauxRequest( array() );
489
490 wfDebug( "\n\nStart command line script $self\n" );
491 } else {
492 # Can't stub this one, it sets up $_GET and $_REQUEST in its constructor
493 $wgRequest = new WebRequest;
494
495 $debug = "\n\nStart request {$wgRequest->getMethod()} {$wgRequest->getRequestURL()}\n";
496
497 if ( $wgDebugPrintHttpHeaders ) {
498 $debug .= "HTTP HEADERS:\n";
499
500 foreach ( $wgRequest->getAllHeaders() as $name => $value ) {
501 $debug .= "$name: $value\n";
502 }
503 }
504 wfDebug( $debug );
505 }
506
507 wfProfileOut( $fname . '-misc1' );
508 wfProfileIn( $fname . '-memcached' );
509
510 $wgMemc = wfGetMainCache();
511 $messageMemc = wfGetMessageCacheStorage();
512 $parserMemc = wfGetParserCacheStorage();
513 $wgLangConvMemc = wfGetLangConverterCacheStorage();
514
515 wfDebugLog( 'caches', get_class( $wgMemc ) . '[main] ' .
516 get_class( $messageMemc ) . '[message] ' .
517 get_class( $parserMemc ) . '[parser]' );
518
519 wfProfileOut( $fname . '-memcached' );
520
521 # # Most of the config is out, some might want to run hooks here.
522 wfRunHooks( 'SetupAfterCache' );
523
524 wfProfileIn( $fname . '-session' );
525
526 # If session.auto_start is there, we can't touch session name
527 if ( !wfIniGetBool( 'session.auto_start' ) ) {
528 session_name( $wgSessionName ? $wgSessionName : $wgCookiePrefix . '_session' );
529 }
530
531 if ( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode ) {
532 if ( $wgRequest->checkSessionCookie() || isset( $_COOKIE[$wgCookiePrefix . 'Token'] ) ) {
533 wfSetupSession();
534 $wgSessionStarted = true;
535 } else {
536 $wgSessionStarted = false;
537 }
538 }
539
540 wfProfileOut( $fname . '-session' );
541 wfProfileIn( $fname . '-globals' );
542
543 $wgContLang = Language::factory( $wgLanguageCode );
544 $wgContLang->initEncoding();
545 $wgContLang->initContLang();
546
547 // Now that variant lists may be available...
548 $wgRequest->interpolateTitle();
549 $wgUser = RequestContext::getMain()->getUser(); # BackCompat
550
551 /**
552 * @var $wgLang Language
553 */
554 $wgLang = new StubUserLang;
555
556 /**
557 * @var OutputPage
558 */
559 $wgOut = RequestContext::getMain()->getOutput(); # BackCompat
560
561 /**
562 * @var $wgParser Parser
563 */
564 $wgParser = new StubObject( 'wgParser', $wgParserConf['class'], array( $wgParserConf ) );
565
566 if ( !is_object( $wgAuth ) ) {
567 $wgAuth = new AuthPlugin;
568 wfRunHooks( 'AuthPluginSetup', array( &$wgAuth ) );
569 }
570
571 # Placeholders in case of DB error
572 $wgTitle = null;
573
574 $wgDeferredUpdateList = array();
575
576 wfProfileOut( $fname . '-globals' );
577 wfProfileIn( $fname . '-extensions' );
578
579 # Extension setup functions for extensions other than skins
580 # Entries should be added to this variable during the inclusion
581 # of the extension file. This allows the extension to perform
582 # any necessary initialisation in the fully initialised environment
583 foreach ( $wgExtensionFunctions as $func ) {
584 # Allow closures in PHP 5.3+
585 if ( is_object( $func ) && $func instanceof Closure ) {
586 $profName = $fname . '-extensions-closure';
587 } elseif ( is_array( $func ) ) {
588 if ( is_object( $func[0] ) ) {
589 $profName = $fname . '-extensions-' . get_class( $func[0] ) . '::' . $func[1];
590 } else {
591 $profName = $fname . '-extensions-' . implode( '::', $func );
592 }
593 } else {
594 $profName = $fname . '-extensions-' . strval( $func );
595 }
596
597 wfProfileIn( $profName );
598 call_user_func( $func );
599 wfProfileOut( $profName );
600 }
601
602 wfDebug( "Fully initialised\n" );
603 $wgFullyInitialised = true;
604
605 wfProfileOut( $fname . '-extensions' );
606 wfProfileOut( $fname );