* (bug 8629) Document $wgFilterCallback
* (bug 1000) Clarify warning about memory_limit in installer
* Suppress PHP warning about set_time_limit in installer when safe mode is on
+* (bug 3000) Fall back to SCRIPT_NAME plus QUERY_STRING when REQUEST_URI is
+ not available, as on IIS with PHP-CGI
== Languages updated ==
}
function getLogMessage() {
+ global $wgRequest;
$file = $this->getFile();
$line = $this->getLine();
$message = $this->getMessage();
- return "{$_SERVER['REQUEST_URI']} Exception from line $line of $file: $message";
+ return $wgRequest->getRequestURL() . " Exception from line $line of $file: $message";
}
function reportHTML() {
$forward .= ' anon';
$log = sprintf( "%s\t%04.3f\t%s\n",
gmdate( 'YmdHis' ), $elapsed,
- urldecode( $_SERVER['REQUEST_URI'] . $forward ) );
+ urldecode( $wgRequest->getRequestURL() . $forward ) );
if ( '' != $wgDebugLogFile && ( $wgRequest->getVal('action') != 'raw' || $wgDebugRawPage ) ) {
error_log( $log . $prof, 3, $wgDebugLogFile );
}
function printableLink() {
global $wgOut, $wgFeedClasses, $wgRequest;
- $baseurl = $_SERVER['REQUEST_URI'];
- if( strpos( '?', $baseurl ) == false ) {
- $baseurl .= '?';
- } else {
- $baseurl .= '&';
- }
- $baseurl = htmlspecialchars( $baseurl );
$printurl = $wgRequest->escapeAppendQuery( 'printable=yes' );
$s = "<a href=\"$printurl\">" . wfMsg( 'printableversion' ) . '</a>';
* @return string
*/
function getRequestURL() {
- $base = $_SERVER['REQUEST_URI'];
+ if( isset( $_SERVER['REQUEST_URI'] ) ) {
+ $base = $_SERVER['REQUEST_URI'];
+ } elseif( isset( $_SERVER['SCRIPT_NAME'] ) ) {
+ // Probably IIS; doesn't set REQUEST_URI
+ $base = $_SERVER['SCRIPT_NAME'];
+ if( isset( $_SERVER['QUERY_STRING'] ) && $_SERVER['QUERY_STRING'] != '' ) {
+ $base .= '?' . $_SERVER['QUERY_STRING'];
+ }
+ } else {
+ // This shouldn't happen!
+ throw new MWException( "Web server doesn't provide either " .
+ "REQUEST_URI or SCRIPT_NAME. Report details of your " .
+ "web server configuration to http://bugzilla.wikimedia.org/" );
+ }
if( $base{0} == '/' ) {
return $base;
} else {
* Initialize the object to be known as $wgArticle for special cases
*/
function initializeSpecialCases ( &$title, &$output, $request ) {
-
+ global $wgRequest;
wfProfileIn( 'MediaWiki::initializeSpecialCases' );
$search = $this->getVal('Search');
$targetUrl = $title->getFullURL();
// Redirect to canonical url, make it a 301 to allow caching
global $wgServer, $wgUsePathInfo;
- if( isset( $_SERVER['REQUEST_URI'] ) &&
- $targetUrl == $wgServer . $_SERVER['REQUEST_URI'] ) {
+ if( $targetUrl == $wgRequest->getFullRequestURL() ) {
$message = "Redirect loop detected!\n\n" .
"This means the wiki got confused about what page was " .
"requested; this sometimes happens when moving a wiki " .