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',
223 'apibase' =>
'https://commons.wikimedia.org/w/api.php',
225 'fetchDescription' =>
true,
226 'descriptionCacheExpiry' => 43200,
227 'apiThumbCacheExpiry' => 86400,
234 if ( !isset( $wgLocalFileRepo[
'backend'] ) ) {
235 $wgLocalFileRepo[
'backend'] = $wgLocalFileRepo[
'name'] .
'-backend';
237 foreach ( $wgForeignFileRepos
as &$repo ) {
238 if ( !isset( $repo[
'directory'] ) && $repo[
'class'] ===
'ForeignAPIRepo' ) {
239 $repo[
'directory'] = $wgUploadDirectory;
241 if ( !isset( $repo[
'backend'] ) ) {
242 $repo[
'backend'] = $repo[
'name'] .
'-backend';
247 if ( $wgRCFilterByAge ) {
251 sort( $wgRCLinkDays );
252 for ( $i = 0; $i < count( $wgRCLinkDays ); $i++ ) {
253 if ( $wgRCLinkDays[$i] >= $wgRCMaxAge / ( 3600 * 24 ) ) {
254 $wgRCLinkDays = array_slice( $wgRCLinkDays, 0, $i + 1,
false );
261 $wgSkipSkins[] = $wgSkipSkin;
264 if ( $wgLocalInterwiki ) {
265 array_unshift( $wgLocalInterwikis, $wgLocalInterwiki );
269 if ( $wgSharedPrefix ===
false ) {
270 $wgSharedPrefix = $wgDBprefix;
274 if ( $wgSharedDB && $wgSharedPrefix && in_array(
'user', $wgSharedTables ) ) {
276 } elseif ( $wgSharedDB && in_array(
'user', $wgSharedTables ) ) {
278 } elseif ( $wgDBprefix ) {
288 if ( $wgMetaNamespace ===
false ) {
289 $wgMetaNamespace = str_replace(
' ',
'_', $wgSitename );
293 if ( $wgResourceLoaderMaxQueryLength ===
false ) {
294 $maxValueLength = ini_get(
'suhosin.get.max_value_length' );
295 $wgResourceLoaderMaxQueryLength = $maxValueLength > 0 ? $maxValueLength : -1;
304 wfShorthandToInteger( ini_get(
'post_max_size' ), 1e100) - 1024 # Leave room
for other parameters
332 if ( is_array( $wgExtraNamespaces ) ) {
343 if ( $wgUseFileCache || $wgUseSquid ) {
344 $wgShowIPinHeader =
false;
345 $wgDebugToolbar =
false;
349 if ( !$wgEnotifMinorEdits ) {
350 $wgHiddenPrefs[] =
'enotifminoredits';
359 if ( !$wgHtml5Version && $wgAllowRdfaAttributes ) {
361 if ( $wgMimeType ==
'application/xhtml+xml' ) {
362 $wgHtml5Version =
'XHTML+RDFa 1.0';
364 $wgHtml5Version =
'HTML+RDFa 1.0';
371 if ( $wgArticleCountMethod ===
null ) {
372 $wgArticleCountMethod = $wgUseCommaCount ?
'comma' :
'link';
375 if ( $wgInvalidateCacheOnLocalSettingsChange ) {
376 $wgCacheEpoch = max( $wgCacheEpoch, gmdate(
'YmdHis', @filemtime(
"$IP/LocalSettings.php" ) ) );
379 if ( $wgNewUserLog ) {
381 $wgLogTypes[] =
'newusers';
382 $wgLogNames[
'newusers'] =
'newuserlogpage';
383 $wgLogHeaders[
'newusers'] =
'newuserlogpagetext';
384 $wgLogActionsHandlers[
'newusers/newusers'] =
'NewUsersLogFormatter';
385 $wgLogActionsHandlers[
'newusers/create'] =
'NewUsersLogFormatter';
386 $wgLogActionsHandlers[
'newusers/create2'] =
'NewUsersLogFormatter';
387 $wgLogActionsHandlers[
'newusers/byemail'] =
'NewUsersLogFormatter';
388 $wgLogActionsHandlers[
'newusers/autocreate'] =
'NewUsersLogFormatter';
391 if ( $wgCookieSecure ===
'detect' ) {
395 if ( $wgRC2UDPAddress ) {
396 $wgRCFeeds[
'default'] =
array(
397 'formatter' =>
'IRCColourfulRCFeedFormatter',
398 'uri' =>
"udp://$wgRC2UDPAddress:$wgRC2UDPPort/$wgRC2UDPPrefix",
399 'add_interwiki_prefix' => &$wgRC2UDPInterwikiPrefix,
400 'omit_bots' => &$wgRC2UDPOmitBots,
415 if ( !class_exists(
'AutoLoader' ) ) {
416 require_once
"$IP/includes/AutoLoader.php";
424 require_once
"$IP/includes/normal/UtfNormalUtil.php";
425 require_once
"$IP/includes/normal/UtfNormalDefines.php";
433 'If you use a relative URL for $wgArticlePath, it must start ' .
434 'with a slash (<code>/</code>).<br><br>See ' .
435 '<a href="https://www.mediawiki.org/wiki/Manual:$wgArticlePath">' .
436 'https://www.mediawiki.org/wiki/Manual:$wgArticlePath</a>.'
443 if ( $wgSecureLogin && substr( $wgServer, 0, 2 ) !==
'//' ) {
444 $wgSecureLogin =
false;
445 wfWarn(
'Secure login was enabled on a server that only supports HTTP or HTTPS. Disabling secure login.' );
450 if ( $wgTmpDirectory ===
false ) {
456 if ( $wgCanonicalServer ===
false ) {
462 if ( !$wgHTCPRouting && $wgHTCPMulticastRouting ) {
463 $wgHTCPRouting = $wgHTCPMulticastRouting;
468 if ( !$wgHTCPRouting && $wgHTCPMulticastAddress ) {
469 $wgHTCPRouting =
array(
471 'host' => $wgHTCPMulticastAddress,
472 'port' => $wgHTCPPort,
478 if ( $wgRateLimitLog && ! array_key_exists(
'ratelimit', $wgDebugLogGroups ) ) {
479 $wgDebugLogGroups[
'ratelimit'] = $wgRateLimitLog;
482 if ( $wgProfileOnly ) {
483 $wgDebugLogGroups[
'profileoutput'] = $wgDebugLogFile;
484 $wgDebugLogFile =
'';
498 if ( is_null( $wgLocaltimezone ) ) {
500 $wgLocaltimezone = date_default_timezone_get();
504 date_default_timezone_set( $wgLocaltimezone );
505 if ( is_null( $wgLocalTZoffset ) ) {
506 $wgLocalTZoffset = date(
'Z' ) / 60;
513 wfDebug(
"\n\nStart command line script $self\n" );
518 $debug =
"\n\nStart request {$wgRequest->getMethod()} {$wgRequest->getRequestURL()}\n";
520 if ( $wgDebugPrintHttpHeaders ) {
521 $debug .=
"HTTP HEADERS:\n";
524 $debug .=
"$name: $value\n";
551 session_name( $wgSessionName ? $wgSessionName :
$wgCookiePrefix .
'_session' );
555 if ( $wgRequest->checkSessionCookie() || isset( $_COOKIE[
$wgCookiePrefix .
'Token'] ) ) {
557 $wgSessionStarted =
true;
559 $wgSessionStarted =
false;
571 $wgRequest->interpolateTitle();
589 if ( !is_object( $wgAuth ) ) {
594 # Placeholders in case of DB error
606 foreach ( $wgExtensionFunctions
as $func ) {
608 if ( is_object( $func ) && $func instanceof Closure ) {
609 $profName =
$fname .
'-extensions-closure';
610 } elseif ( is_array( $func ) ) {
611 if ( is_object( $func[0] ) ) {
612 $profName =
$fname .
'-extensions-' . get_class( $func[0] ) .
'::' . $func[1];
614 $profName =
$fname .
'-extensions-' . implode(
'::', $func );
617 $profName =
$fname .
'-extensions-' . strval( $func );
621 call_user_func( $func );
625 wfDebug(
"Fully initialised\n" );