3 headings)" was removed.
* (bug 52810) Preference "Justify paragraphs" was removed.
* OutputPage::showErrorPage raises a notice if arguments are incoherent.
+* Thumbnails that keep failing to render in thumb.php will be rate-limited
+ againt further render attempts for 1 hour. $wgAttemptFailureEpoch can be
+ altered to reset all rate-limited thumbnails at once.
==== Removed classes ====
* FakeMemCachedClient (deprecated in 1.18)
*/
$wgThumbnailEpoch = '20030516000000';
+/**
+ * Certain operations are avoided if there were too many recent failures,
+ * for example, thumbnail generation. Bump this value to invalidate all
+ * memory of failed operations and thus allow further attempts to resume.
+ * This is useful when a cause for the failures has been found and fixed.
+ */
+$wgAttemptFailureEpoch = 1;
+
/**
* If set, inline scaled images will still produce "<img>" tags ready for
* output instead of showing an error message.
'thumbnail_image-type' => 'Image type not supported',
'thumbnail_gd-library' => 'Incomplete GD library configuration: Missing function $1',
'thumbnail_image-missing' => 'File seems to be missing: $1',
+'thumbnail_image-failure-limit' => 'There have been too many recent failed attempts ($1 or more) to render this thumbnail. Please try again later.',
# Special:Import
'import' => 'Import pages',
*$1 is a function name of the GD library',
'thumbnail_image-missing' => 'This is the parameter 1 of the message {{msg-mw|thumbnail error}}.
*$1 is the path incl. filename of the missing image',
+'thumbnail_image-failure-limit' => 'This is the parameter 1 of the message {{msg-mw|thumbnail error}}.
+*$1 is the maximum allowed number of failed attempts',
# Special:Import
'import' => 'The title of the special page [[Special:Import]];',
See: [[w:Non-English usage of quotation marks|Non-English usage of quotation marks on Wikipedia]].
-Parameters:
+Parameters:
* $1 - text to be wrapped in quotation marks',
# Multipage image navigation
'thumbnail_image-type',
'thumbnail_gd-library',
'thumbnail_image-missing',
+ 'thumbnail_image-failure-limit'
),
'import' => array(
'import',
if ( $user->pingLimiter( 'renderfile' ) ) {
wfThumbError( 500, wfMessage( 'actionthrottledtext' ) );
return;
+ } elseif ( wfThumbIsAttemptThrottled( $img, $thumbName, 5 ) ) {
+ wfThumbError( 500, wfMessage( 'thumbnail_image-failure-limit', 5 ) );
+ return;
}
// Thumbnail isn't already there, so create the new thumbnail...
}
if ( $errorMsg !== false ) {
+ wfThumbIncrAttemptFailures( $img, $thumbName );
wfThumbError( 500, $errorMsg );
} else {
// Stream the file if there were no errors
}
}
+/**
+ * @param File $img
+ * @param string $thumbName
+ * @param int $limit
+ * @return int|bool
+ */
+function wfThumbIsAttemptThrottled( File $img, $thumbName, $limit ) {
+ global $wgMemc;
+
+ return ( $wgMemc->get( wfThumbAttemptKey( $img, $thumbName ) ) >= $limit );
+}
+
+/**
+ * @param File $img
+ * @param string $thumbName
+ */
+function wfThumbIncrAttemptFailures( File $img, $thumbName ) {
+ global $wgMemc;
+
+ $key = wfThumbAttemptKey( $img, $thumbName );
+ if ( !$wgMemc->incr( $key, 1 ) ) {
+ if ( !$wgMemc->add( $key, 1, 3600 ) ) {
+ $wgMemc->incr( $key, 1 );
+ }
+ }
+}
+
+/**
+ * @param File $img
+ * @param string $thumbName
+ * @return string
+ */
+function wfThumbAttemptKey( File $img, $thumbName ) {
+ global $wgAttemptFailureEpoch;
+
+ return wfMemcKey( 'attempt-failures', $wgAttemptFailureEpoch,
+ $img->getRepo()->getName(), md5( $img->getName() ), md5( $thumbName ) );
+}
+
/**
* Convert pathinfo type parameter, into normal request parameters
*