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
mediawiki.Upload.Dialog: Factor out booklet layout
[lhc/web/wiklou.git]
/
thumb.php
diff --git
a/thumb.php
b/thumb.php
index
2cfe6b1
..
d39d43b
100644
(file)
--- a/
thumb.php
+++ b/
thumb.php
@@
-222,7
+222,7
@@
function wfStreamThumb( array $params ) {
wfThumbErrorText( 404, "The source file '$fileName' does not exist." );
return;
} elseif ( $img->getPath() === false ) {
wfThumbErrorText( 404, "The source file '$fileName' does not exist." );
return;
} elseif ( $img->getPath() === false ) {
- wfThumbErrorText(
5
00, "The source file '$fileName' is not locally accessible." );
+ wfThumbErrorText(
4
00, "The source file '$fileName' is not locally accessible." );
return;
}
return;
}
@@
-317,10
+317,10
@@
function wfStreamThumb( array $params ) {
$user = RequestContext::getMain()->getUser();
if ( !wfThumbIsStandard( $img, $params ) && $user->pingLimiter( 'renderfile-nonstandard' ) ) {
$user = RequestContext::getMain()->getUser();
if ( !wfThumbIsStandard( $img, $params ) && $user->pingLimiter( 'renderfile-nonstandard' ) ) {
- wfThumbError(
500
, wfMessage( 'actionthrottledtext' )->parse() );
+ wfThumbError(
429
, wfMessage( 'actionthrottledtext' )->parse() );
return;
} elseif ( $user->pingLimiter( 'renderfile' ) ) {
return;
} elseif ( $user->pingLimiter( 'renderfile' ) ) {
- wfThumbError(
500
, wfMessage( 'actionthrottledtext' )->parse() );
+ wfThumbError(
429
, wfMessage( 'actionthrottledtext' )->parse() );
return;
}
return;
}
@@
-333,6
+333,9
@@
function wfStreamThumb( array $params ) {
$errorCode = 500;
if ( !$thumb ) {
$errorMsg = $errorMsg ?: $msg->rawParams( 'File::transform() returned false' )->escaped();
$errorCode = 500;
if ( !$thumb ) {
$errorMsg = $errorMsg ?: $msg->rawParams( 'File::transform() returned false' )->escaped();
+ if ( $errorMsg instanceof MessageSpecifier && $errorMsg->getKey() === 'thumbnail_image-failure-limit' ) {
+ $errorCode = 429;
+ }
} elseif ( $thumb->isError() ) {
$errorMsg = $thumb->getHtmlMsg();
} elseif ( !$thumb->hasFile() ) {
} elseif ( $thumb->isError() ) {
$errorMsg = $thumb->getHtmlMsg();
} elseif ( !$thumb->hasFile() ) {
@@
-557,7
+560,7
@@
function wfExtractThumbParams( $file, $params ) {
* @return void
*/
function wfThumbErrorText( $status, $msgText ) {
* @return void
*/
function wfThumbErrorText( $status, $msgText ) {
-
return
wfThumbError( $status, htmlspecialchars( $msgText ) );
+ wfThumbError( $status, htmlspecialchars( $msgText ) );
}
/**
}
/**
@@
-572,10
+575,8
@@
function wfThumbError( $status, $msgHtml ) {
header( 'Cache-Control: no-cache' );
header( 'Content-Type: text/html; charset=utf-8' );
header( 'Cache-Control: no-cache' );
header( 'Content-Type: text/html; charset=utf-8' );
- if ( $status == 400 ) {
- HttpStatus::header( 400 );
- } elseif ( $status == 404 ) {
- HttpStatus::header( 404 );
+ if ( $status == 400 || $status == 404 || $status == 429 ) {
+ HttpStatus::header( $status );
} elseif ( $status == 403 ) {
HttpStatus::header( 403 );
header( 'Vary: Cookie' );
} elseif ( $status == 403 ) {
HttpStatus::header( 403 );
header( 'Vary: Cookie' );