}
unset( $repo ); // no global pollution; destroy reference
+$rcMaxAgeDays = $wgRCMaxAge / ( 3600 * 24 );
if ( $wgRCFilterByAge ) {
// Trim down $wgRCLinkDays so that it only lists links which are valid
// as determined by $wgRCMaxAge.
// @codingStandardsIgnoreStart Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed
for ( $i = 0; $i < count( $wgRCLinkDays ); $i++ ) {
// @codingStandardsIgnoreEnd
- if ( $wgRCLinkDays[$i] >= $wgRCMaxAge / ( 3600 * 24 ) ) {
+ if ( $wgRCLinkDays[$i] >= $rcMaxAgeDays ) {
$wgRCLinkDays = array_slice( $wgRCLinkDays, 0, $i + 1, false );
break;
}
}
}
+// Ensure that default user options are not invalid, since that breaks Special:Preferences
+$wgDefaultUserOptions['rcdays'] = min(
+ $wgDefaultUserOptions['rcdays'],
+ ceil( $rcMaxAgeDays )
+);
+$wgDefaultUserOptions['watchlistdays'] = min(
+ $wgDefaultUserOptions['watchlistdays'],
+ ceil( $rcMaxAgeDays )
+);
+unset( $rcMaxAgeDays );
if ( $wgSkipSkin ) {
$wgSkipSkins[] = $wgSkipSkin;
$ps_validation = Profiler::instance()->scopedProfileIn( $fname . '-validation' );
// T48998: Bail out early if $wgArticlePath is non-absolute
-if ( !preg_match( '/^(https?:\/\/|\/)/', $wgArticlePath ) ) {
- throw new FatalError(
- 'If you use a relative URL for $wgArticlePath, it must start ' .
- 'with a slash (<code>/</code>).<br><br>See ' .
- '<a href="https://www.mediawiki.org/wiki/Manual:$wgArticlePath">' .
- 'https://www.mediawiki.org/wiki/Manual:$wgArticlePath</a>.'
- );
+foreach ( array( 'wgArticlePath', 'wgVariantArticlePath' ) as $varName ) {
+ if ( $$varName && !preg_match( '/^(https?:\/\/|\/)/', $$varName ) ) {
+ throw new FatalError(
+ "If you use a relative URL for \$$varName, it must start " .
+ 'with a slash (<code>/</code>).<br><br>See ' .
+ "<a href=\"https://www.mediawiki.org/wiki/Manual:\$$varName\">" .
+ "https://www.mediawiki.org/wiki/Manual:\$$varName</a>."
+ );
+ }
}
Profiler::instance()->scopedProfileOut( $ps_validation );
$wgDBerrorLogTZ = $wgLocaltimezone;
}
+// initialize the request object in $wgRequest
+$wgRequest = RequestContext::getMain()->getRequest(); // BackCompat
+
// Useful debug output
if ( $wgCommandLineMode ) {
- $wgRequest = new FauxRequest( array() );
-
wfDebug( "\n\nStart command line script $self\n" );
} else {
- // Can't stub this one, it sets up $_GET and $_REQUEST in its constructor
- $wgRequest = new WebRequest;
-
$debug = "\n\nStart request {$wgRequest->getMethod()} {$wgRequest->getRequestURL()}\n";
if ( $wgDebugPrintHttpHeaders ) {