r17718 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r17717‎ | r17718 | r17719 >
Date:12:26, 16 November 2006
Author:brion
Status:old
Tags:
Comment:
add some debugging output to img_auth.php
Modified paths:
  • /trunk/phase3/img_auth.php (modified) (history)

Diff [purge]

Index: trunk/phase3/img_auth.php
@@ -12,31 +12,38 @@
1313 require_once( './includes/StreamFile.php' );
1414
1515 if( !isset( $_SERVER['PATH_INFO'] ) ) {
 16+ wfDebugLog( 'img_auth', "missing PATH_INFO" );
1617 wfForbidden();
1718 }
1819
1920 # Get filenames/directories
 21+wfDebugLog( 'img_auth', "PATH_INFO is: " . $_SERVER['PATH_INFO'] );
2022 $filename = realpath( $wgUploadDirectory . $_SERVER['PATH_INFO'] );
2123 $realUploadDirectory = realpath( $wgUploadDirectory );
2224 $imageName = $wgContLang->getNsText( NS_IMAGE ) . ":" . wfBaseName( $_SERVER['PATH_INFO'] );
2325
2426 # Check if the filename is in the correct directory
2527 if ( substr( $filename, 0, strlen( $realUploadDirectory ) ) != $realUploadDirectory ) {
 28+ wfDebugLog( 'img_auth', "requested path not in upload dir: $filename" );
2629 wfForbidden();
2730 }
2831
2932 if ( is_array( $wgWhitelistRead ) && !in_array( $imageName, $wgWhitelistRead ) && !$wgUser->getID() ) {
 33+ wfDebugLog( 'img_auth', "not logged in and requested file not in whitelist: $imageName" );
3034 wfForbidden();
3135 }
3236
3337 if( !file_exists( $filename ) ) {
 38+ wfDebugLog( 'img_auth', "requested file does not exist: $filename" );
3439 wfForbidden();
3540 }
3641 if( is_dir( $filename ) ) {
 42+ wfDebugLog( 'img_auth', "requested file is a directory: $filename" );
3743 wfForbidden();
3844 }
3945
4046 # Write file
 47+wfDebugLog( 'img_auth', "streaming file: $filename" );
4148 wfStreamFile( $filename );
4249 wfLogProfilingData();
4350