summaryrefslogtreecommitdiff
path: root/thumb.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2011-06-22 11:28:20 +0200
committerPierre Schmitz <pierre@archlinux.de>2011-06-22 11:28:20 +0200
commit9db190c7e736ec8d063187d4241b59feaf7dc2d1 (patch)
tree46d1a0dee7febef5c2d57a9f7b972be16a163b3d /thumb.php
parent78677c7bbdcc9739f6c10c75935898a20e1acd9e (diff)
update to MediaWiki 1.17.0
Diffstat (limited to 'thumb.php')
-rw-r--r--thumb.php13
1 files changed, 11 insertions, 2 deletions
diff --git a/thumb.php b/thumb.php
index 6e04f4aa..1a1dee46 100644
--- a/thumb.php
+++ b/thumb.php
@@ -56,11 +56,13 @@ function wfThumbMain() {
$bits = explode( '!', $fileName, 2 );
if( !isset($bits[1]) ) {
wfThumbError( 404, wfMsg( 'badtitletext' ) );
+ wfProfileOut( __METHOD__ );
return;
}
$title = Title::makeTitleSafe( NS_FILE, $bits[1] );
if( is_null($title) ) {
wfThumbError( 404, wfMsg( 'badtitletext' ) );
+ wfProfileOut( __METHOD__ );
return;
}
$img = RepoGroup::singleton()->getLocalRepo()->newFromArchiveName( $title, $fileName );
@@ -73,6 +75,7 @@ function wfThumbMain() {
if ( !$img->getTitle()->userCanRead() ) {
wfThumbError( 403, 'Access denied. You do not have permission to access ' .
'the source file.' );
+ wfProfileOut( __METHOD__ );
return;
}
$headers[] = 'Cache-Control: private';
@@ -81,15 +84,18 @@ function wfThumbMain() {
if ( !$img ) {
wfThumbError( 404, wfMsg( 'badtitletext' ) );
+ wfProfileOut( __METHOD__ );
return;
}
if ( !$img->exists() ) {
wfThumbError( 404, 'The source file for the specified thumbnail does not exist.' );
+ wfProfileOut( __METHOD__ );
return;
}
$sourcePath = $img->getPath();
if ( $sourcePath === false ) {
wfThumbError( 500, 'The source file is not locally accessible.' );
+ wfProfileOut( __METHOD__ );
return;
}
@@ -101,10 +107,11 @@ function wfThumbMain() {
// Calculate time
wfSuppressWarnings();
$imsUnix = strtotime( $imsString );
+ $stat = stat( $sourcePath );
wfRestoreWarnings();
- $stat = @stat( $sourcePath );
if ( $stat['mtime'] <= $imsUnix ) {
header( 'HTTP/1.1 304 Not Modified' );
+ wfProfileOut( __METHOD__ );
return;
}
}
@@ -116,11 +123,13 @@ function wfThumbMain() {
if ( is_file( $thumbPath ) ) {
wfStreamFile( $thumbPath, $headers );
+ wfProfileOut( __METHOD__ );
return;
}
}
} catch ( MWException $e ) {
wfThumbError( 500, $e->getHTML() );
+ wfProfileOut( __METHOD__ );
return;
}
@@ -164,7 +173,7 @@ function wfThumbError( $status, $msg ) {
header( 'HTTP/1.1 500 Internal server error' );
}
if( $wgShowHostnames ) {
- $url = htmlspecialchars( @$_SERVER['REQUEST_URI'] );
+ $url = htmlspecialchars( isset( $_SERVER['REQUEST_URI'] ) ? $_SERVER['REQUEST_URI'] : '' );
$hostname = htmlspecialchars( wfHostname() );
$debug = "<!-- $url -->\n<!-- $hostname -->\n";
} else {