// Note that we allow 1 link higher than the max for things like 56 days but a 60 day link.
sort( $wgRCLinkDays );
- // phpcs:ignore Generic.CodeAnalysis.ForLoopWithTestFunctionCall
- for ( $i = 0; $i < count( $wgRCLinkDays ); $i++ ) {
- if ( $wgRCLinkDays[$i] >= $rcMaxAgeDays ) {
- $wgRCLinkDays = array_slice( $wgRCLinkDays, 0, $i + 1, false );
+ foreach ( $wgRCLinkDays as $i => $days ) {
+ if ( $days >= $rcMaxAgeDays ) {
+ array_splice( $wgRCLinkDays, $i + 1 );
break;
}
}
$wgCanonicalNamespaceNames = $wgCanonicalNamespaceNames + $wgExtraNamespaces;
}
+// Hard-deprecate setting $wgDummyLanguageCodes in LocalSettings.php
+if ( count( $wgDummyLanguageCodes ) !== 0 ) {
+ wfDeprecated( '$wgDummyLanguageCodes', '1.29' );
+}
// Merge in the legacy language codes, incorporating overrides from the config
$wgDummyLanguageCodes += [
+ // Internal language codes of the private-use area which get mapped to
+ // themselves.
'qqq' => 'qqq', // Used for message documentation
'qqx' => 'qqx', // Used for viewing message keys
] + $wgExtraLanguageCodes + LanguageCode::getDeprecatedCodeMapping();
+// Merge in (inverted) BCP 47 mappings
+foreach ( LanguageCode::getNonstandardLanguageCodeMapping() as $code => $bcp47 ) {
+ $bcp47 = strtolower( $bcp47 ); // force case-insensitivity
+ if ( !isset( $wgDummyLanguageCodes[$bcp47] ) ) {
+ $wgDummyLanguageCodes[$bcp47] = $wgDummyLanguageCodes[$code] ?? $code;
+ }
+}
// These are now the same, always
// To determine the user language, use $wgLang->getCode()
$session->renew();
if ( MediaWiki\Session\PHPSessionHandler::isEnabled() &&
- ( $session->isPersistent() || $session->shouldRememberUser() )
+ ( $session->isPersistent() || $session->shouldRememberUser() ) &&
+ session_id() !== $session->getId()
) {
// Start the PHP-session for backwards compatibility
+ if ( session_id() !== '' ) {
+ wfDebugLog( 'session', 'PHP session {old_id} was already started, changing to {new_id}', 'all', [
+ 'old_id' => session_id(),
+ 'new_id' => $session->getId(),
+ ] );
+ session_write_close();
+ }
session_id( $session->getId() );
- Wikimedia\quietCall( 'session_start' );
+ session_start();
}
unset( $session );