From: Brion Vibber Date: Fri, 5 Mar 2004 03:18:31 +0000 (+0000) Subject: Add $wgDebugRedirects to assist in debugging some problems hidden by X-Git-Tag: 1.3.0beta1~873 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/%7B%7B%20url_for%28%27admin_users%27%29%20%7D%7D?a=commitdiff_plain;h=59427a3d52eb9a55fb007e7c576db5785dd0330a;p=lhc%2Fweb%2Fwiklou.git Add $wgDebugRedirects to assist in debugging some problems hidden by automated http redirects. --- diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index d35ad00434..0b4ba9895b 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -100,6 +100,7 @@ $wgReadOnlyFile = "{$wgUploadDirectory}/lock_yBgMBwiR"; # The debug log file should be not be publically accessible if it is # used, as it may contain private data. $wgDebugLogFile = ""; +$wgDebugRedirects = false; $wgDebugComments = false; $wgReadOnly = false; diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 1b645df917..8aaa8d40d1 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -228,6 +228,7 @@ class OutputPage { { global $wgUser, $wgLang, $wgDebugComments, $wgCookieExpiration; global $wgInputEncoding, $wgOutputEncoding, $wgLanguageCode; + global $wgDebugRedirects; if( $this->mDoNothing ){ return; } @@ -236,25 +237,34 @@ class OutputPage { $sk = $wgUser->getSkin(); - if ( "" != $this->mRedirect ) { if( substr( $this->mRedirect, 0, 4 ) != "http" ) { # Standards require redirect URLs to be absolute global $wgServer; $this->mRedirect = $wgServer . $this->mRedirect; } - if( $this->mRdirectCode == '301') { - header("HTTP/1.1 {$this->mRedirectCode} Moved Permanently"); + if( $this->mRedirectCode == '301') { + if( !$wgDebugRedirects ) { + header("HTTP/1.1 {$this->mRedirectCode} Moved Permanently"); + } $this->mLastModified = gmdate( "D, j M Y H:i:s", wfTimestamp2Unix( max( $timestamp, $wgUser->mTouched ) ) ) . " GMT"; } $this->sendCacheControl(); - header( "Location: {$this->mRedirect}" ); + if( $wgDebugRedirects ) { + $url = htmlspecialchars( $this->mRedirect ); + print "\n\nRedirect\n\n\n"; + print "

Location: $url

\n"; + print "\n\n"; + } else { + header( "Location: {$this->mRedirect}" ); + } return; } + $this->sendCacheControl(); header( "Content-type: text/html; charset={$wgOutputEncoding}" );