// To determine the user language, use $wgLang->getCode()
$wgContLanguageCode = $wgLanguageCode;
-// Easy to forget to falsify $wgShowIPinHeader for static caches.
-// If file cache or squid cache is on, just disable this (DWIMD).
-// Do the same for $wgDebugToolbar.
+// Easy to forget to falsify $wgDebugToolbar for static caches.
+// If file cache or CDN cache is on, just disable this (DWIMD).
if ( $wgUseFileCache || $wgUseSquid ) {
- $wgShowIPinHeader = false;
$wgDebugToolbar = false;
}
$wgCookieSecure = ( WebRequest::detectProtocol() === 'https' );
}
-// Back compatibility for $wgRateLimitLog deprecated with 1.23
-if ( $wgRateLimitLog && !array_key_exists( 'ratelimit', $wgDebugLogGroups ) ) {
- $wgDebugLogGroups['ratelimit'] = $wgRateLimitLog;
-}
-
if ( $wgProfileOnly ) {
$wgDebugLogGroups['profileoutput'] = $wgDebugLogFile;
$wgDebugLogFile = '';
require_once "$IP/includes/compat/normal/UtfNormalUtil.php";
-
$ps_validation = Profiler::instance()->scopedProfileIn( $fname . '-validation' );
// T48998: Bail out early if $wgArticlePath is non-absolute
$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 ) {
Profiler::instance()->scopedProfileOut( $ps_extensions );
Profiler::instance()->scopedProfileOut( $ps_setup );
-
* @file
*/
+use MediaWiki\Logger\LoggerFactory;
+
/**
* Group all the pieces relevant to the context of a request into one instance
*/
*/
public function getRequest() {
if ( $this->request === null ) {
- global $wgRequest; # fallback to $wg till we can improve this
- $this->request = $wgRequest;
+ global $wgCommandLineMode;
+ // create the WebRequest object on the fly
+ if ( $wgCommandLineMode ) {
+ $this->request = new FauxRequest( array() );
+ } else {
+ $this->request = new WebRequest();
+ }
}
return $this->request;
*/
public function getStats() {
if ( $this->stats === null ) {
- $config = $this->getConfig();
- $prefix = $config->get( 'StatsdMetricPrefix' )
- ? rtrim( $config->get( 'StatsdMetricPrefix' ), '.' )
- : 'MediaWiki';
+ $prefix = rtrim( $this->getConfig()->get( 'StatsdMetricPrefix' ), '.' );
$this->stats = new BufferingStatsdDataFactory( $prefix );
}
return $this->stats;
*/
public function getTiming() {
if ( $this->timing === null ) {
- $this->timing = new Timing();
+ $this->timing = new Timing( array(
+ 'logger' => LoggerFactory::getInstance( 'Timing' )
+ ) );
}
return $this->timing;
}