dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Switch search-suggest message to use Message::parse()"
[lhc/web/wiklou.git]
/
thumb.php
diff --git
a/thumb.php
b/thumb.php
index
c77cddc
..
03a3f35
100644
(file)
--- a/
thumb.php
+++ b/
thumb.php
@@
-89,7
+89,6
@@
function wfThumbHandle404() {
function wfStreamThumb( array $params ) {
global $wgVaryOnXFP;
function wfStreamThumb( array $params ) {
global $wgVaryOnXFP;
-
$headers = array(); // HTTP headers to send
$fileName = isset( $params['f'] ) ? $params['f'] : '';
$headers = array(); // HTTP headers to send
$fileName = isset( $params['f'] ) ? $params['f'] : '';
@@
-214,6
+213,7
@@
function wfStreamThumb( array $params ) {
if ( count( $varyHeader ) ) {
$response->header( 'Vary: ' . implode( ', ', $varyHeader ) );
}
if ( count( $varyHeader ) ) {
$response->header( 'Vary: ' . implode( ', ', $varyHeader ) );
}
+ $response->header( 'Content-Length: 0' );
return;
}
return;
}
@@
-302,9
+302,15
@@
function wfStreamThumb( array $params ) {
// Stream the file if it exists already...
$thumbPath = $img->getThumbPath( $thumbName );
if ( $img->getRepo()->fileExists( $thumbPath ) ) {
// Stream the file if it exists already...
$thumbPath = $img->getThumbPath( $thumbName );
if ( $img->getRepo()->fileExists( $thumbPath ) ) {
+ $starttime = microtime( true );
$success = $img->getRepo()->streamFile( $thumbPath, $headers );
$success = $img->getRepo()->streamFile( $thumbPath, $headers );
+ $streamtime = microtime( true ) - $starttime;
+
if ( !$success ) {
wfThumbError( 500, 'Could not stream the file' );
if ( !$success ) {
wfThumbError( 500, 'Could not stream the file' );
+ } else {
+ RequestContext::getMain()->getStats()->timing( 'media.thumbnail.stream', $streamtime );
+ wfDebugLog( 'thumbnailaccess', time() . ' ' . $thumbPath . ' ' . ob_get_length() . ' Streamed ' );
}
return;
}
}
return;
}
@@
-318,8
+324,8
@@
function wfStreamThumb( array $params ) {
return;
}
return;
}
- // Actually generate a new thumbnail
list( $thumb, $errorMsg ) = wfGenerateThumbnail( $img, $params, $thumbName, $thumbPath );
list( $thumb, $errorMsg ) = wfGenerateThumbnail( $img, $params, $thumbName, $thumbPath );
+
/** @var MediaTransformOutput|bool $thumb */
// Check for thumbnail generation errors...
/** @var MediaTransformOutput|bool $thumb */
// Check for thumbnail generation errors...
@@
-571,7
+577,7
@@
function wfThumbError( $status, $msg ) {
} else {
$debug = '';
}
} else {
$debug = '';
}
-
echo
<<<EOT
+
$content =
<<<EOT
<!DOCTYPE html>
<html><head>
<meta charset="UTF-8" />
<!DOCTYPE html>
<html><head>
<meta charset="UTF-8" />
@@
-587,4
+593,6
@@
$debug
</html>
EOT;
</html>
EOT;
+ header( 'Content-Length: ' . strlen( $content ) );
+ echo $content;
}
}