31 if ( !defined(
'MEDIAWIKI' ) ) {
40 if ( !isset( $wgVersion ) ) {
41 echo
"Error, Setup.php must be included from the file scope, after DefaultSettings.php\n";
46 if ( $wgScript ===
false ) {
47 $wgScript =
"$wgScriptPath/index$wgScriptExtension";
49 if ( $wgLoadScript ===
false ) {
50 $wgLoadScript =
"$wgScriptPath/load$wgScriptExtension";
54 if ( $wgUsePathInfo ) {
67 if ( $wgStylePath ===
false ) {
68 $wgStylePath =
"$wgScriptPath/skins";
70 if ( $wgLocalStylePath ===
false ) {
71 $wgLocalStylePath =
"$wgScriptPath/skins";
73 if ( $wgStyleDirectory ===
false ) {
74 $wgStyleDirectory =
"$IP/skins";
76 if ( $wgExtensionAssetsPath ===
false ) {
77 $wgExtensionAssetsPath =
"$wgScriptPath/extensions";
80 if ( $wgLogo ===
false ) {
81 $wgLogo =
"$wgStylePath/common/images/wiki.png";
84 if ( $wgUploadPath ===
false ) {
85 $wgUploadPath =
"$wgScriptPath/images";
87 if ( $wgUploadDirectory ===
false ) {
88 $wgUploadDirectory =
"$IP/images";
90 if ( $wgReadOnlyFile ===
false ) {
91 $wgReadOnlyFile =
"{$wgUploadDirectory}/lock_yBgMBwiR";
93 if ( $wgFileCacheDirectory ===
false ) {
94 $wgFileCacheDirectory =
"{$wgUploadDirectory}/cache";
96 if ( $wgDeletedDirectory ===
false ) {
97 $wgDeletedDirectory =
"{$wgUploadDirectory}/deleted";
100 if ( isset( $wgFileStore[
'deleted'][
'directory'] ) ) {
101 $wgDeletedDirectory = $wgFileStore[
'deleted'][
'directory'];
104 if ( isset( $wgFooterIcons[
'copyright'] )
105 && isset( $wgFooterIcons[
'copyright'][
'copyright'] )
106 && $wgFooterIcons[
'copyright'][
'copyright'] ===
array()
108 if ( isset( $wgCopyrightIcon ) && $wgCopyrightIcon ) {
109 $wgFooterIcons[
'copyright'][
'copyright'] = $wgCopyrightIcon;
110 } elseif ( $wgRightsIcon || $wgRightsText ) {
111 $wgFooterIcons[
'copyright'][
'copyright'] =
array(
112 'url' => $wgRightsUrl,
113 'src' => $wgRightsIcon,
114 'alt' => $wgRightsText,
117 unset( $wgFooterIcons[
'copyright'][
'copyright'] );
121 if ( isset( $wgFooterIcons[
'poweredby'] )
122 && isset( $wgFooterIcons[
'poweredby'][
'mediawiki'] )
123 && $wgFooterIcons[
'poweredby'][
'mediawiki'][
'src'] ===
null
125 $wgFooterIcons[
'poweredby'][
'mediawiki'][
'src'] =
"$wgStylePath/common/images/poweredby_mediawiki_88x31.png";
149 'name' =>
'fsLockManager',
150 'class' =>
'FSLockManager',
151 'lockDirectory' =>
"{$wgUploadDirectory}/lockdir",
154 'name' =>
'nullLockManager',
155 'class' =>
'NullLockManager',
161 if ( !$wgLocalFileRepo ) {
162 if ( isset( $wgFileStore[
'deleted'][
'hash'] ) ) {
163 $deletedHashLevel = $wgFileStore[
'deleted'][
'hash'];
165 $deletedHashLevel = $wgHashedUploadDirectory ? 3 : 0;
167 $wgLocalFileRepo =
array(
168 'class' =>
'LocalRepo',
170 'directory' => $wgUploadDirectory,
171 'scriptDirUrl' => $wgScriptPath,
172 'scriptExtension' => $wgScriptExtension,
173 'url' => $wgUploadBaseUrl ? $wgUploadBaseUrl . $wgUploadPath : $wgUploadPath,
174 'hashLevels' => $wgHashedUploadDirectory ? 2 : 0,
175 'thumbScriptUrl' => $wgThumbnailScriptPath,
176 'transformVia404' => !$wgGenerateThumbnailOnParse,
177 'deletedDir' => $wgDeletedDirectory,
178 'deletedHashLevels' => $deletedHashLevel
184 if ( $wgUseSharedUploads ) {
185 if ( $wgSharedUploadDBname ) {
186 $wgForeignFileRepos[] =
array(
187 'class' =>
'ForeignDBRepo',
189 'directory' => $wgSharedUploadDirectory,
190 'url' => $wgSharedUploadPath,
191 'hashLevels' => $wgHashedSharedUploadDirectory ? 2 : 0,
192 'thumbScriptUrl' => $wgSharedThumbnailScriptPath,
193 'transformVia404' => !$wgGenerateThumbnailOnParse,
194 'dbType' => $wgDBtype,
195 'dbServer' => $wgDBserver,
196 'dbUser' => $wgDBuser,
197 'dbPassword' => $wgDBpassword,
198 'dbName' => $wgSharedUploadDBname,
200 'tablePrefix' => $wgSharedUploadDBprefix,
201 'hasSharedCache' => $wgCacheSharedUploads,
202 'descBaseUrl' => $wgRepositoryBaseUrl,
203 'fetchDescription' => $wgFetchCommonsDescriptions,
206 $wgForeignFileRepos[] =
array(
207 'class' =>
'FileRepo',
209 'directory' => $wgSharedUploadDirectory,
210 'url' => $wgSharedUploadPath,
211 'hashLevels' => $wgHashedSharedUploadDirectory ? 2 : 0,
212 'thumbScriptUrl' => $wgSharedThumbnailScriptPath,
213 'transformVia404' => !$wgGenerateThumbnailOnParse,
214 'descBaseUrl' => $wgRepositoryBaseUrl,
215 'fetchDescription' => $wgFetchCommonsDescriptions,
219 if ( $wgUseInstantCommons ) {
220 $wgForeignFileRepos[] =
array(
221 'class' =>
'ForeignAPIRepo',
222 'name' =>
'wikimediacommons',
224 'https://commons.wikimedia.org/w/api.php' :
225 'http://commons.wikimedia.org/w/api.php',
227 'fetchDescription' =>
true,
228 'descriptionCacheExpiry' => 43200,
229 'apiThumbCacheExpiry' => 86400,
236 if ( !isset( $wgLocalFileRepo[
'backend'] ) ) {
237 $wgLocalFileRepo[
'backend'] = $wgLocalFileRepo[
'name'] .
'-backend';
239 foreach ( $wgForeignFileRepos
as &$repo ) {
240 if ( !isset( $repo[
'directory'] ) && $repo[
'class'] ===
'ForeignAPIRepo' ) {
241 $repo[
'directory'] = $wgUploadDirectory;
243 if ( !isset( $repo[
'backend'] ) ) {
244 $repo[
'backend'] = $repo[
'name'] .
'-backend';
249 if ( $wgRCFilterByAge ) {
253 sort( $wgRCLinkDays );
254 for ( $i = 0; $i < count( $wgRCLinkDays ); $i++ ) {
255 if ( $wgRCLinkDays[$i] >= $wgRCMaxAge / ( 3600 * 24 ) ) {
256 $wgRCLinkDays = array_slice( $wgRCLinkDays, 0, $i + 1,
false );
263 $wgSkipSkins[] = $wgSkipSkin;
266 if ( $wgLocalInterwiki ) {
267 array_unshift( $wgLocalInterwikis, $wgLocalInterwiki );
271 if ( $wgSharedPrefix ===
false ) {
272 $wgSharedPrefix = $wgDBprefix;
276 if ( $wgSharedDB && $wgSharedPrefix && in_array(
'user', $wgSharedTables ) ) {
278 } elseif ( $wgSharedDB && in_array(
'user', $wgSharedTables ) ) {
280 } elseif ( $wgDBprefix ) {
290 if ( $wgMetaNamespace ===
false ) {
291 $wgMetaNamespace = str_replace(
' ',
'_', $wgSitename );
295 if ( $wgResourceLoaderMaxQueryLength ===
false ) {
296 $maxValueLength = ini_get(
'suhosin.get.max_value_length' );
297 $wgResourceLoaderMaxQueryLength = $maxValueLength > 0 ? $maxValueLength : -1;
325 if ( is_array( $wgExtraNamespaces ) ) {
336 if ( $wgUseFileCache || $wgUseSquid ) {
337 $wgShowIPinHeader =
false;
338 $wgDebugToolbar =
false;
342 if ( !$wgEnotifMinorEdits ) {
343 $wgHiddenPrefs[] =
'enotifminoredits';
352 if ( !$wgHtml5Version && $wgAllowRdfaAttributes ) {
354 if ( $wgMimeType ==
'application/xhtml+xml' ) {
355 $wgHtml5Version =
'XHTML+RDFa 1.0';
357 $wgHtml5Version =
'HTML+RDFa 1.0';
364 if ( $wgArticleCountMethod ===
null ) {
365 $wgArticleCountMethod = $wgUseCommaCount ?
'comma' :
'link';
368 if ( $wgInvalidateCacheOnLocalSettingsChange ) {
369 $wgCacheEpoch = max( $wgCacheEpoch, gmdate(
'YmdHis', @filemtime(
"$IP/LocalSettings.php" ) ) );
372 if ( $wgNewUserLog ) {
374 $wgLogTypes[] =
'newusers';
375 $wgLogNames[
'newusers'] =
'newuserlogpage';
376 $wgLogHeaders[
'newusers'] =
'newuserlogpagetext';
377 $wgLogActionsHandlers[
'newusers/newusers'] =
'NewUsersLogFormatter';
378 $wgLogActionsHandlers[
'newusers/create'] =
'NewUsersLogFormatter';
379 $wgLogActionsHandlers[
'newusers/create2'] =
'NewUsersLogFormatter';
380 $wgLogActionsHandlers[
'newusers/byemail'] =
'NewUsersLogFormatter';
381 $wgLogActionsHandlers[
'newusers/autocreate'] =
'NewUsersLogFormatter';
384 if ( $wgCookieSecure ===
'detect' ) {
388 if ( $wgRC2UDPAddress ) {
389 $wgRCFeeds[
'default'] =
array(
390 'formatter' =>
'IRCColourfulRCFeedFormatter',
391 'uri' =>
"udp://$wgRC2UDPAddress:$wgRC2UDPPort/$wgRC2UDPPrefix",
392 'add_interwiki_prefix' => &$wgRC2UDPInterwikiPrefix,
393 'omit_bots' => &$wgRC2UDPOmitBots,
408 if ( !class_exists(
'AutoLoader' ) ) {
409 require_once
"$IP/includes/AutoLoader.php";
417 require_once
"$IP/includes/normal/UtfNormalUtil.php";
418 require_once
"$IP/includes/GlobalFunctions.php";
419 require_once
"$IP/includes/normal/UtfNormalDefines.php";
423 if ( $wgSecureLogin && substr( $wgServer, 0, 2 ) !==
'//' ) {
424 $wgSecureLogin =
false;
425 wfWarn(
'Secure login was enabled on a server that only supports HTTP or HTTPS. Disabling secure login.' );
430 if ( $wgTmpDirectory ===
false ) {
436 if ( $wgCanonicalServer ===
false ) {
442 if ( !$wgHTCPRouting && $wgHTCPMulticastRouting ) {
443 $wgHTCPRouting = $wgHTCPMulticastRouting;
448 if ( !$wgHTCPRouting && $wgHTCPMulticastAddress ) {
449 $wgHTCPRouting =
array(
451 'host' => $wgHTCPMulticastAddress,
452 'port' => $wgHTCPPort,
458 if ( $wgRateLimitLog && ! array_key_exists(
'ratelimit', $wgDebugLogGroups ) ) {
459 $wgDebugLogGroups[
'ratelimit'] = $wgRateLimitLog;
462 if ( $wgProfileOnly ) {
463 $wgDebugLogGroups[
'profileoutput'] = $wgDebugLogFile;
464 $wgDebugLogFile =
'';
478 if ( is_null( $wgLocaltimezone ) ) {
480 $wgLocaltimezone = date_default_timezone_get();
484 date_default_timezone_set( $wgLocaltimezone );
485 if ( is_null( $wgLocalTZoffset ) ) {
486 $wgLocalTZoffset = date(
'Z' ) / 60;
493 wfDebug(
"\n\nStart command line script $self\n" );
498 $debug =
"\n\nStart request {$wgRequest->getMethod()} {$wgRequest->getRequestURL()}\n";
500 if ( $wgDebugPrintHttpHeaders ) {
501 $debug .=
"HTTP HEADERS:\n";
504 $debug .=
"$name: $value\n";
531 session_name( $wgSessionName ? $wgSessionName :
$wgCookiePrefix .
'_session' );
535 if ( $wgRequest->checkSessionCookie() || isset( $_COOKIE[
$wgCookiePrefix .
'Token'] ) ) {
537 $wgSessionStarted =
true;
539 $wgSessionStarted =
false;
551 $wgRequest->interpolateTitle();
569 if ( !is_object( $wgAuth ) ) {
574 # Placeholders in case of DB error
586 foreach ( $wgExtensionFunctions
as $func ) {
588 if ( is_object( $func ) && $func instanceof Closure ) {
589 $profName =
$fname .
'-extensions-closure';
590 } elseif ( is_array( $func ) ) {
591 if ( is_object( $func[0] ) ) {
592 $profName =
$fname .
'-extensions-' . get_class( $func[0] ) .
'::' . $func[1];
594 $profName =
$fname .
'-extensions-' . implode(
'::', $func );
597 $profName =
$fname .
'-extensions-' . strval( $func );
601 call_user_func( $func );
605 wfDebug(
"Fully initialised\n" );