Deprecates $wgRateLimitLog in favor of debug log
[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 # Set default shared prefix
269 if ( $wgSharedPrefix === false ) {
270 $wgSharedPrefix = $wgDBprefix;
271 }
272
273 if ( !$wgCookiePrefix ) {
274 if ( $wgSharedDB && $wgSharedPrefix && in_array( 'user', $wgSharedTables ) ) {
275 $wgCookiePrefix = $wgSharedDB . '_' . $wgSharedPrefix;
276 } elseif ( $wgSharedDB && in_array( 'user', $wgSharedTables ) ) {
277 $wgCookiePrefix = $wgSharedDB;
278 } elseif ( $wgDBprefix ) {
279 $wgCookiePrefix = $wgDBname . '_' . $wgDBprefix;
280 } else {
281 $wgCookiePrefix = $wgDBname;
282 }
283 }
284 $wgCookiePrefix = strtr( $wgCookiePrefix, '=,; +."\'\\[', '__________' );
285
286 $wgUseEnotif = $wgEnotifUserTalk || $wgEnotifWatchlist;
287
288 if ( $wgMetaNamespace === false ) {
289 $wgMetaNamespace = str_replace( ' ', '_', $wgSitename );
290 }
291
292 // Default value is either the suhosin limit or -1 for unlimited
293 if ( $wgResourceLoaderMaxQueryLength === false ) {
294 $maxValueLength = ini_get( 'suhosin.get.max_value_length' );
295 $wgResourceLoaderMaxQueryLength = $maxValueLength > 0 ? $maxValueLength : -1;
296 }
297
298 /**
299 * Definitions of the NS_ constants are in Defines.php
300 * @private
301 */
302 $wgCanonicalNamespaceNames = array(
303 NS_MEDIA => 'Media',
304 NS_SPECIAL => 'Special',
305 NS_TALK => 'Talk',
306 NS_USER => 'User',
307 NS_USER_TALK => 'User_talk',
308 NS_PROJECT => 'Project',
309 NS_PROJECT_TALK => 'Project_talk',
310 NS_FILE => 'File',
311 NS_FILE_TALK => 'File_talk',
312 NS_MEDIAWIKI => 'MediaWiki',
313 NS_MEDIAWIKI_TALK => 'MediaWiki_talk',
314 NS_TEMPLATE => 'Template',
315 NS_TEMPLATE_TALK => 'Template_talk',
316 NS_HELP => 'Help',
317 NS_HELP_TALK => 'Help_talk',
318 NS_CATEGORY => 'Category',
319 NS_CATEGORY_TALK => 'Category_talk',
320 );
321
322 /// @todo UGLY UGLY
323 if ( is_array( $wgExtraNamespaces ) ) {
324 $wgCanonicalNamespaceNames = $wgCanonicalNamespaceNames + $wgExtraNamespaces;
325 }
326
327 # These are now the same, always
328 # To determine the user language, use $wgLang->getCode()
329 $wgContLanguageCode = $wgLanguageCode;
330
331 # Easy to forget to falsify $wgShowIPinHeader for static caches.
332 # If file cache or squid cache is on, just disable this (DWIMD).
333 # Do the same for $wgDebugToolbar.
334 if ( $wgUseFileCache || $wgUseSquid ) {
335 $wgShowIPinHeader = false;
336 $wgDebugToolbar = false;
337 }
338
339 # Doesn't make sense to have if disabled.
340 if ( !$wgEnotifMinorEdits ) {
341 $wgHiddenPrefs[] = 'enotifminoredits';
342 }
343
344 # We always output HTML5 since 1.22, overriding these is no longer supported
345 # we set them here for extensions that depend on its value.
346 $wgHtml5 = true;
347 $wgXhtmlDefaultNamespace = 'http://www.w3.org/1999/xhtml';
348 $wgJsMimeType = 'text/javascript';
349
350 if ( !$wgHtml5Version && $wgAllowRdfaAttributes ) {
351 # see http://www.w3.org/TR/rdfa-in-html/#document-conformance
352 if ( $wgMimeType == 'application/xhtml+xml' ) {
353 $wgHtml5Version = 'XHTML+RDFa 1.0';
354 } else {
355 $wgHtml5Version = 'HTML+RDFa 1.0';
356 }
357 }
358
359 # Blacklisted file extensions shouldn't appear on the "allowed" list
360 $wgFileExtensions = array_values( array_diff ( $wgFileExtensions, $wgFileBlacklist ) );
361
362 if ( $wgArticleCountMethod === null ) {
363 $wgArticleCountMethod = $wgUseCommaCount ? 'comma' : 'link';
364 }
365
366 if ( $wgInvalidateCacheOnLocalSettingsChange ) {
367 $wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis', @filemtime( "$IP/LocalSettings.php" ) ) );
368 }
369
370 if ( $wgNewUserLog ) {
371 # Add a new log type
372 $wgLogTypes[] = 'newusers';
373 $wgLogNames['newusers'] = 'newuserlogpage';
374 $wgLogHeaders['newusers'] = 'newuserlogpagetext';
375 $wgLogActionsHandlers['newusers/newusers'] = 'NewUsersLogFormatter';
376 $wgLogActionsHandlers['newusers/create'] = 'NewUsersLogFormatter';
377 $wgLogActionsHandlers['newusers/create2'] = 'NewUsersLogFormatter';
378 $wgLogActionsHandlers['newusers/byemail'] = 'NewUsersLogFormatter';
379 $wgLogActionsHandlers['newusers/autocreate'] = 'NewUsersLogFormatter';
380 }
381
382 if ( $wgCookieSecure === 'detect' ) {
383 $wgCookieSecure = ( WebRequest::detectProtocol() === 'https' );
384 }
385
386 if ( $wgRC2UDPAddress ) {
387 $wgRCFeeds['default'] = array(
388 'formatter' => 'IRCColourfulRCFeedFormatter',
389 'uri' => "udp://$wgRC2UDPAddress:$wgRC2UDPPort/$wgRC2UDPPrefix",
390 'add_interwiki_prefix' => &$wgRC2UDPInterwikiPrefix,
391 'omit_bots' => &$wgRC2UDPOmitBots,
392 );
393 }
394
395 wfProfileOut( $fname . '-defaults' );
396
397 // Disable MWDebug for command line mode, this prevents MWDebug from eating up
398 // all the memory from logging SQL queries on maintenance scripts
399 global $wgCommandLineMode;
400 if ( $wgDebugToolbar && !$wgCommandLineMode ) {
401 wfProfileIn( $fname . '-debugtoolbar' );
402 MWDebug::init();
403 wfProfileOut( $fname . '-debugtoolbar' );
404 }
405
406 if ( !class_exists( 'AutoLoader' ) ) {
407 require_once "$IP/includes/AutoLoader.php";
408 }
409
410 wfProfileIn( $fname . '-exception' );
411 MWExceptionHandler::installHandler();
412 wfProfileOut( $fname . '-exception' );
413
414 wfProfileIn( $fname . '-includes' );
415 require_once "$IP/includes/normal/UtfNormalUtil.php";
416 require_once "$IP/includes/GlobalFunctions.php";
417 require_once "$IP/includes/normal/UtfNormalDefines.php";
418 wfProfileOut( $fname . '-includes' );
419
420 wfProfileIn( $fname . '-defaults2' );
421 if ( $wgSecureLogin && substr( $wgServer, 0, 2 ) !== '//' ) {
422 $wgSecureLogin = false;
423 wfWarn( 'Secure login was enabled on a server that only supports HTTP or HTTPS. Disabling secure login.' );
424 }
425
426 # Now that GlobalFunctions is loaded, set defaults that depend
427 # on it.
428 if ( $wgTmpDirectory === false ) {
429 wfProfileIn( $fname . '-tempDir' );
430 $wgTmpDirectory = wfTempDir();
431 wfProfileOut( $fname . '-tempDir' );
432 }
433
434 if ( $wgCanonicalServer === false ) {
435 $wgCanonicalServer = wfExpandUrl( $wgServer, PROTO_HTTP );
436 }
437
438 // $wgHTCPMulticastRouting got renamed to $wgHTCPRouting in MediaWiki 1.22
439 // ensure back compatibility.
440 if ( !$wgHTCPRouting && $wgHTCPMulticastRouting ) {
441 $wgHTCPRouting = $wgHTCPMulticastRouting;
442 }
443
444 // Initialize $wgHTCPRouting from backwards-compatible settings that
445 // comes from pre 1.20 version.
446 if ( !$wgHTCPRouting && $wgHTCPMulticastAddress ) {
447 $wgHTCPRouting = array(
448 '' => array(
449 'host' => $wgHTCPMulticastAddress,
450 'port' => $wgHTCPPort,
451 )
452 );
453 }
454
455 // Back compatibility for $wgRateLimitLog deprecated with 1.23
456 if ( $wgRateLimitLog && ! array_key_exists( 'ratelimit', $wgDebugLogGroups ) ) {
457 $wgDebugLogGroups['ratelimit'] = $wgRateLimitLog;
458 }
459
460 wfProfileOut( $fname . '-defaults2' );
461 wfProfileIn( $fname . '-misc1' );
462
463 # Raise the memory limit if it's too low
464 wfMemoryLimit();
465
466 /**
467 * Set up the timezone, suppressing the pseudo-security warning in PHP 5.1+
468 * that happens whenever you use a date function without the timezone being
469 * explicitly set. Inspired by phpMyAdmin's treatment of the problem.
470 */
471 if ( is_null( $wgLocaltimezone ) ) {
472 wfSuppressWarnings();
473 $wgLocaltimezone = date_default_timezone_get();
474 wfRestoreWarnings();
475 }
476
477 date_default_timezone_set( $wgLocaltimezone );
478 if ( is_null( $wgLocalTZoffset ) ) {
479 $wgLocalTZoffset = date( 'Z' ) / 60;
480 }
481
482 # Useful debug output
483 if ( $wgCommandLineMode ) {
484 $wgRequest = new FauxRequest( array() );
485
486 wfDebug( "\n\nStart command line script $self\n" );
487 } else {
488 # Can't stub this one, it sets up $_GET and $_REQUEST in its constructor
489 $wgRequest = new WebRequest;
490
491 $debug = "\n\nStart request {$wgRequest->getMethod()} {$wgRequest->getRequestURL()}\n";
492
493 if ( $wgDebugPrintHttpHeaders ) {
494 $debug .= "HTTP HEADERS:\n";
495
496 foreach ( $wgRequest->getAllHeaders() as $name => $value ) {
497 $debug .= "$name: $value\n";
498 }
499 }
500 wfDebug( $debug );
501 }
502
503 wfProfileOut( $fname . '-misc1' );
504 wfProfileIn( $fname . '-memcached' );
505
506 $wgMemc = wfGetMainCache();
507 $messageMemc = wfGetMessageCacheStorage();
508 $parserMemc = wfGetParserCacheStorage();
509 $wgLangConvMemc = wfGetLangConverterCacheStorage();
510
511 wfDebug( 'CACHES: ' . get_class( $wgMemc ) . '[main] ' .
512 get_class( $messageMemc ) . '[message] ' .
513 get_class( $parserMemc ) . "[parser]\n" );
514
515 wfProfileOut( $fname . '-memcached' );
516
517 # # Most of the config is out, some might want to run hooks here.
518 wfRunHooks( 'SetupAfterCache' );
519
520 wfProfileIn( $fname . '-session' );
521
522 # If session.auto_start is there, we can't touch session name
523 if ( !wfIniGetBool( 'session.auto_start' ) ) {
524 session_name( $wgSessionName ? $wgSessionName : $wgCookiePrefix . '_session' );
525 }
526
527 if ( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode ) {
528 if ( $wgRequest->checkSessionCookie() || isset( $_COOKIE[$wgCookiePrefix . 'Token'] ) ) {
529 wfSetupSession();
530 $wgSessionStarted = true;
531 } else {
532 $wgSessionStarted = false;
533 }
534 }
535
536 wfProfileOut( $fname . '-session' );
537 wfProfileIn( $fname . '-globals' );
538
539 $wgContLang = Language::factory( $wgLanguageCode );
540 $wgContLang->initEncoding();
541 $wgContLang->initContLang();
542
543 // Now that variant lists may be available...
544 $wgRequest->interpolateTitle();
545 $wgUser = RequestContext::getMain()->getUser(); # BackCompat
546
547 /**
548 * @var $wgLang Language
549 */
550 $wgLang = new StubUserLang;
551
552 /**
553 * @var OutputPage
554 */
555 $wgOut = RequestContext::getMain()->getOutput(); # BackCompat
556
557 /**
558 * @var $wgParser Parser
559 */
560 $wgParser = new StubObject( 'wgParser', $wgParserConf['class'], array( $wgParserConf ) );
561
562 if ( !is_object( $wgAuth ) ) {
563 $wgAuth = new AuthPlugin;
564 wfRunHooks( 'AuthPluginSetup', array( &$wgAuth ) );
565 }
566
567 # Placeholders in case of DB error
568 $wgTitle = null;
569
570 $wgDeferredUpdateList = array();
571
572 wfProfileOut( $fname . '-globals' );
573 wfProfileIn( $fname . '-extensions' );
574
575 # Extension setup functions for extensions other than skins
576 # Entries should be added to this variable during the inclusion
577 # of the extension file. This allows the extension to perform
578 # any necessary initialisation in the fully initialised environment
579 foreach ( $wgExtensionFunctions as $func ) {
580 # Allow closures in PHP 5.3+
581 if ( is_object( $func ) && $func instanceof Closure ) {
582 $profName = $fname . '-extensions-closure';
583 } elseif ( is_array( $func ) ) {
584 if ( is_object( $func[0] ) ) {
585 $profName = $fname . '-extensions-' . get_class( $func[0] ) . '::' . $func[1];
586 } else {
587 $profName = $fname . '-extensions-' . implode( '::', $func );
588 }
589 } else {
590 $profName = $fname . '-extensions-' . strval( $func );
591 }
592
593 wfProfileIn( $profName );
594 call_user_func( $func );
595 wfProfileOut( $profName );
596 }
597
598 wfDebug( "Fully initialised\n" );
599 $wgFullyInitialised = true;
600
601 wfProfileOut( $fname . '-extensions' );
602 wfProfileOut( $fname );