| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
use MediaWiki\Language\LanguageCode; |
| 8 |
use MediaWiki\MainConfigSchema; |
| 9 |
use MediaWiki\Title\NamespaceInfo; |
| 10 |
use Wikimedia\AtEase\AtEase; |
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
if ( $wgLogos !== false && isset( $wgLogos['1x'] ) ) { |
| 16 |
$wgLogo = $wgLogos['1x']; |
| 17 |
} |
| 18 |
|
| 19 |
|
| 20 |
if ( isset( $wgFileBlacklist ) ) { |
| 21 |
$wgProhibitedFileExtensions = array_merge( $wgProhibitedFileExtensions, $wgFileBlacklist ); |
| 22 |
} else { |
| 23 |
$wgFileBlacklist = $wgProhibitedFileExtensions; |
| 24 |
} |
| 25 |
if ( isset( $wgMimeTypeBlacklist ) ) { |
| 26 |
$wgMimeTypeExclusions = array_merge( $wgMimeTypeExclusions, $wgMimeTypeBlacklist ); |
| 27 |
} else { |
| 28 |
$wgMimeTypeBlacklist = $wgMimeTypeExclusions; |
| 29 |
} |
| 30 |
if ( isset( $wgEnableUserEmailBlacklist ) ) { |
| 31 |
$wgEnableUserEmailMuteList = $wgEnableUserEmailBlacklist; |
| 32 |
} else { |
| 33 |
$wgEnableUserEmailBlacklist = $wgEnableUserEmailMuteList; |
| 34 |
} |
| 35 |
if ( isset( $wgShortPagesNamespaceBlacklist ) ) { |
| 36 |
$wgShortPagesNamespaceExclusions = $wgShortPagesNamespaceBlacklist; |
| 37 |
} else { |
| 38 |
$wgShortPagesNamespaceBlacklist = $wgShortPagesNamespaceExclusions; |
| 39 |
} |
| 40 |
|
| 41 |
|
| 42 |
if ( isset( $wgRateLimits['emailuser'] ) ) { |
| 43 |
|
| 44 |
|
| 45 |
$wgSettings->warning( |
| 46 |
'RateLimit: The "emailuser" limit is deprecated, use "sendemail" instead.' |
| 47 |
); |
| 48 |
$wgRateLimits['sendemail'] = $wgRateLimits['emailuser']; |
| 49 |
} |
| 50 |
|
| 51 |
|
| 52 |
if ( isset( $wgRateLimits['changetag'] ) ) { |
| 53 |
|
| 54 |
|
| 55 |
$wgSettings->warning( |
| 56 |
'RateLimit: The "changetag" limit is deprecated, use "changetags" instead.' |
| 57 |
); |
| 58 |
$wgRateLimits['changetags'] = $wgRateLimits['changetag']; |
| 59 |
} |
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
$wgFileExtensions = array_values( array_diff( $wgFileExtensions, $wgProhibitedFileExtensions ) ); |
| 64 |
|
| 65 |
|
| 66 |
if ( $wgRightsIcon ) { |
| 67 |
$wgRightsIcon = str_replace( |
| 68 |
"{$wgStylePath}/common/images/", |
| 69 |
"{$wgResourceBasePath}/resources/assets/licenses/", |
| 70 |
$wgRightsIcon |
| 71 |
); |
| 72 |
} |
| 73 |
|
| 74 |
if ( isset( $wgFooterIcons['copyright']['copyright'] ) |
| 75 |
&& $wgFooterIcons['copyright']['copyright'] === [] |
| 76 |
) { |
| 77 |
if ( $wgRightsIcon || $wgRightsText ) { |
| 78 |
$wgFooterIcons['copyright']['copyright'] = [ |
| 79 |
'url' => $wgRightsUrl, |
| 80 |
'src' => $wgRightsIcon, |
| 81 |
'alt' => $wgRightsText, |
| 82 |
]; |
| 83 |
} |
| 84 |
} |
| 85 |
|
| 86 |
if ( isset( $wgFooterIcons['poweredby'] ) |
| 87 |
&& isset( $wgFooterIcons['poweredby']['mediawiki'] ) |
| 88 |
&& is_array( $wgFooterIcons['poweredby']['mediawiki'] ) |
| 89 |
&& $wgFooterIcons['poweredby']['mediawiki']['src'] === null |
| 90 |
) { |
| 91 |
$wgFooterIcons['poweredby']['mediawiki']['src'] = |
| 92 |
"$wgResourceBasePath/resources/assets/poweredby_mediawiki.svg"; |
| 93 |
} |
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
$wgNamespaceProtection[NS_MEDIAWIKI] = 'editinterface'; |
| 101 |
|
| 102 |
|
| 103 |
$wgLockManagers[] = [ |
| 104 |
'name' => 'fsLockManager', |
| 105 |
'class' => FSLockManager::class, |
| 106 |
'lockDirectory' => "{$wgUploadDirectory}/lockdir", |
| 107 |
]; |
| 108 |
$wgLockManagers[] = [ |
| 109 |
'name' => 'nullLockManager', |
| 110 |
'class' => NullLockManager::class, |
| 111 |
]; |
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
$wgGalleryOptions += [ |
| 116 |
'imagesPerRow' => 0, |
| 117 |
'imageWidth' => 120, |
| 118 |
'imageHeight' => 120, |
| 119 |
'captionLength' => true, |
| 120 |
'showBytes' => true, |
| 121 |
'showDimensions' => true, |
| 122 |
'mode' => 'traditional', |
| 123 |
]; |
| 124 |
|
| 125 |
if ( isset( $wgLocalFileRepo['name'] ) && !isset( $wgLocalFileRepo['backend'] ) ) { |
| 126 |
|
| 127 |
|
| 128 |
$wgLocalFileRepo['backend'] = $wgLocalFileRepo['name'] . '-backend'; |
| 129 |
} |
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
if ( $wgUseSharedUploads ) { |
| 135 |
if ( $wgSharedUploadDBname ) { |
| 136 |
$wgForeignFileRepos[] = [ |
| 137 |
'class' => ForeignDBRepo::class, |
| 138 |
'name' => 'shared', |
| 139 |
'directory' => $wgSharedUploadDirectory, |
| 140 |
'url' => $wgSharedUploadPath, |
| 141 |
'hashLevels' => $wgHashedSharedUploadDirectory ? 2 : 0, |
| 142 |
'thumbScriptUrl' => $wgSharedThumbnailScriptPath, |
| 143 |
'transformVia404' => !$wgGenerateThumbnailOnParse, |
| 144 |
'dbType' => $wgDBtype, |
| 145 |
'dbServer' => $wgDBserver, |
| 146 |
'dbUser' => $wgDBuser, |
| 147 |
'dbPassword' => $wgDBpassword, |
| 148 |
'dbName' => $wgSharedUploadDBname, |
| 149 |
'dbFlags' => ( $wgDebugDumpSql ? DBO_DEBUG : 0 ) | DBO_DEFAULT, |
| 150 |
'tablePrefix' => $wgSharedUploadDBprefix, |
| 151 |
'hasSharedCache' => $wgCacheSharedUploads, |
| 152 |
'descBaseUrl' => $wgRepositoryBaseUrl, |
| 153 |
'fetchDescription' => $wgFetchCommonsDescriptions, |
| 154 |
]; |
| 155 |
} else { |
| 156 |
$wgForeignFileRepos[] = [ |
| 157 |
'class' => FileRepo::class, |
| 158 |
'name' => 'shared', |
| 159 |
'directory' => $wgSharedUploadDirectory, |
| 160 |
'url' => $wgSharedUploadPath, |
| 161 |
'hashLevels' => $wgHashedSharedUploadDirectory ? 2 : 0, |
| 162 |
'thumbScriptUrl' => $wgSharedThumbnailScriptPath, |
| 163 |
'transformVia404' => !$wgGenerateThumbnailOnParse, |
| 164 |
'descBaseUrl' => $wgRepositoryBaseUrl, |
| 165 |
'fetchDescription' => $wgFetchCommonsDescriptions, |
| 166 |
]; |
| 167 |
} |
| 168 |
} |
| 169 |
if ( $wgUseInstantCommons ) { |
| 170 |
$wgForeignFileRepos[] = [ |
| 171 |
'class' => ForeignAPIRepo::class, |
| 172 |
'name' => 'wikimediacommons', |
| 173 |
'apibase' => 'https://commons.wikimedia.org/w/api.php', |
| 174 |
'url' => 'https://upload.wikimedia.org/wikipedia/commons', |
| 175 |
'thumbUrl' => 'https://upload.wikimedia.org/wikipedia/commons/thumb', |
| 176 |
'hashLevels' => 2, |
| 177 |
'transformVia404' => true, |
| 178 |
'fetchDescription' => true, |
| 179 |
'descriptionCacheExpiry' => 43200, |
| 180 |
'apiThumbCacheExpiry' => 0, |
| 181 |
]; |
| 182 |
} |
| 183 |
foreach ( $wgForeignFileRepos as &$repo ) { |
| 184 |
if ( !isset( $repo['directory'] ) && $repo['class'] === ForeignAPIRepo::class ) { |
| 185 |
$repo['directory'] = $wgUploadDirectory; |
| 186 |
} |
| 187 |
if ( !isset( $repo['backend'] ) ) { |
| 188 |
$repo['backend'] = $repo['name'] . '-backend'; |
| 189 |
} |
| 190 |
} |
| 191 |
unset( $repo ); |
| 192 |
|
| 193 |
$rcMaxAgeDays = $wgRCMaxAge / ( 3600 * 24 ); |
| 194 |
|
| 195 |
$wgDefaultUserOptions['rcdays'] = min( |
| 196 |
$wgDefaultUserOptions['rcdays'], |
| 197 |
ceil( $rcMaxAgeDays ) |
| 198 |
); |
| 199 |
$wgDefaultUserOptions['watchlistdays'] = min( |
| 200 |
$wgDefaultUserOptions['watchlistdays'], |
| 201 |
ceil( $rcMaxAgeDays ) |
| 202 |
); |
| 203 |
unset( $rcMaxAgeDays ); |
| 204 |
|
| 205 |
$wgCookiePrefix = strtr( $wgCookiePrefix, '=,; +."\'\\[', '__________' ); |
| 206 |
|
| 207 |
if ( !$wgEnableEmail ) { |
| 208 |
|
| 209 |
|
| 210 |
$wgAllowHTMLEmail = false; |
| 211 |
$wgEmailAuthentication = false; |
| 212 |
$wgEnableUserEmail = false; |
| 213 |
$wgEnotifFromEditor = false; |
| 214 |
$wgEnotifImpersonal = false; |
| 215 |
$wgEnotifMaxRecips = 0; |
| 216 |
$wgEnotifMinorEdits = false; |
| 217 |
$wgEnotifRevealEditorAddress = false; |
| 218 |
$wgEnotifUseRealName = false; |
| 219 |
$wgEnotifUserTalk = false; |
| 220 |
$wgEnotifWatchlist = false; |
| 221 |
unset( $wgGroupPermissions['user']['sendemail'] ); |
| 222 |
$wgUserEmailUseReplyTo = false; |
| 223 |
$wgUsersNotifiedOnAllChanges = []; |
| 224 |
} |
| 225 |
|
| 226 |
if ( !$wgLocaltimezone ) { |
| 227 |
|
| 228 |
|
| 229 |
|
| 230 |
|
| 231 |
|
| 232 |
|
| 233 |
$wgLocaltimezone = MainConfigSchema::getDefaultLocaltimezone(); |
| 234 |
$wgSettings->warning( |
| 235 |
'The Localtimezone setting must a valid timezone string or null. ' |
| 236 |
. 'It must not be an empty string or false.' |
| 237 |
); |
| 238 |
} |
| 239 |
|
| 240 |
|
| 241 |
$wgDefaultUserOptions['timecorrection'] = "System|$wgLocalTZoffset"; |
| 242 |
|
| 243 |
|
| 244 |
|
| 245 |
|
| 246 |
|
| 247 |
$wgCanonicalNamespaceNames = NamespaceInfo::CANONICAL_NAMES; |
| 248 |
|
| 249 |
|
| 250 |
if ( count( $wgDummyLanguageCodes ) !== 0 ) { |
| 251 |
$wgSettings->warning( |
| 252 |
'Do not add to DummyLanguageCodes directly, ' . |
| 253 |
'add to ExtraLanguageCodes instead.' |
| 254 |
); |
| 255 |
} |
| 256 |
|
| 257 |
$wgDummyLanguageCodes += [ |
| 258 |
|
| 259 |
|
| 260 |
'qqq' => 'qqq', |
| 261 |
'qqx' => 'qqx', |
| 262 |
] + $wgExtraLanguageCodes + LanguageCode::getDeprecatedCodeMapping(); |
| 263 |
|
| 264 |
foreach ( LanguageCode::getNonstandardLanguageCodeMapping() as $code => $bcp47 ) { |
| 265 |
$bcp47 = strtolower( $bcp47 ); |
| 266 |
if ( !isset( $wgDummyLanguageCodes[$bcp47] ) ) { |
| 267 |
$wgDummyLanguageCodes[$bcp47] = $wgDummyLanguageCodes[$code] ?? $code; |
| 268 |
} |
| 269 |
} |
| 270 |
unset( $code ); |
| 271 |
unset( $bcp47 ); |
| 272 |
if ( $wgUseXssLanguage ) { |
| 273 |
$wgDummyLanguageCodes['x-xss'] = 'x-xss'; |
| 274 |
} |
| 275 |
|
| 276 |
|
| 277 |
|
| 278 |
|
| 279 |
if ( isset( $wgSlaveLagWarning ) ) { |
| 280 |
|
| 281 |
if ( $wgDatabaseReplicaLagWarning === 10 && $wgSlaveLagWarning !== 10 ) { |
| 282 |
$wgDatabaseReplicaLagWarning = $wgSlaveLagWarning; |
| 283 |
$wgSettings->warning( 'SlaveLagWarning is no longer supported, ' . |
| 284 |
'use DatabaseReplicaLagWarning instead!' ); |
| 285 |
} |
| 286 |
} else { |
| 287 |
|
| 288 |
$wgSlaveLagWarning = $wgDatabaseReplicaLagWarning; |
| 289 |
} |
| 290 |
|
| 291 |
if ( isset( $wgSlaveLagCritical ) ) { |
| 292 |
|
| 293 |
if ( $wgDatabaseReplicaLagCritical === 30 && $wgSlaveLagCritical !== 30 ) { |
| 294 |
$wgDatabaseReplicaLagCritical = $wgSlaveLagCritical; |
| 295 |
$wgSettings->warning( 'SlaveLagCritical is no longer supported, ' . |
| 296 |
'use DatabaseReplicaLagCritical instead!' ); |
| 297 |
} |
| 298 |
} else { |
| 299 |
|
| 300 |
$wgSlaveLagCritical = $wgDatabaseReplicaLagCritical; |
| 301 |
} |
| 302 |
|
| 303 |
if ( $wgInvalidateCacheOnLocalSettingsChange && defined( 'MW_CONFIG_FILE' ) ) { |
| 304 |
AtEase::suppressWarnings(); |
| 305 |
$wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis', filemtime( MW_CONFIG_FILE ) ) ); |
| 306 |
AtEase::restoreWarnings(); |
| 307 |
} |
| 308 |
|
| 309 |
if ( $wgNewUserLog ) { |
| 310 |
|
| 311 |
$wgLogTypes[] = 'newusers'; |
| 312 |
$wgLogNames['newusers'] = 'newuserlogpage'; |
| 313 |
$wgLogHeaders['newusers'] = 'newuserlogpagetext'; |
| 314 |
$wgLogActionsHandlers['newusers/newusers'] = NewUsersLogFormatter::class; |
| 315 |
$wgLogActionsHandlers['newusers/create'] = NewUsersLogFormatter::class; |
| 316 |
$wgLogActionsHandlers['newusers/create2'] = NewUsersLogFormatter::class; |
| 317 |
$wgLogActionsHandlers['newusers/byemail'] = NewUsersLogFormatter::class; |
| 318 |
$wgLogActionsHandlers['newusers/autocreate'] = NewUsersLogFormatter::class; |
| 319 |
} |
| 320 |
|
| 321 |
if ( $wgPageCreationLog ) { |
| 322 |
|
| 323 |
$wgLogTypes[] = 'create'; |
| 324 |
$wgLogActionsHandlers['create/create'] = LogFormatter::class; |
| 325 |
} |
| 326 |
|
| 327 |
if ( $wgPageLanguageUseDB ) { |
| 328 |
$wgLogTypes[] = 'pagelang'; |
| 329 |
$wgLogActionsHandlers['pagelang/pagelang'] = [ |
| 330 |
'class' => PageLangLogFormatter::class, |
| 331 |
'services' => [ |
| 332 |
'LanguageNameUtils', |
| 333 |
] |
| 334 |
]; |
| 335 |
} |
| 336 |
|
| 337 |
if ( $wgPHPSessionHandling !== 'enable' && |
| 338 |
$wgPHPSessionHandling !== 'warn' && |
| 339 |
$wgPHPSessionHandling !== 'disable' |
| 340 |
) { |
| 341 |
$wgPHPSessionHandling = 'warn'; |
| 342 |
} |
| 343 |
if ( defined( 'MW_NO_SESSION' ) ) { |
| 344 |
|
| 345 |
|
| 346 |
$wgPHPSessionHandling = MW_NO_SESSION === 'warn' ? 'warn' : 'disable'; |
| 347 |
} |
| 348 |
|
| 349 |
|
| 350 |
if ( !$wgVirtualDomainsMapping ) { |
| 351 |
$wgVirtualDomainsMapping = []; |
| 352 |
} |
| 353 |
if ( $wgBotPasswordsCluster ) { |
| 354 |
$wgVirtualDomainsMapping['virtual-botpasswords']['cluster'] = $wgBotPasswordsCluster; |
| 355 |
} |
| 356 |
|
| 357 |
if ( $wgBotPasswordsDatabase ) { |
| 358 |
$wgVirtualDomainsMapping['virtual-botpasswords']['db'] = $wgBotPasswordsDatabase; |
| 359 |
} |