Index: includes/DefaultSettings.php =================================================================== --- includes/DefaultSettings.php (revision 83265) +++ includes/DefaultSettings.php (working copy) @@ -4619,6 +4619,12 @@ ); /** + * Extension of "thumbnails" that are very expensive to regenerate and should be + * excluded from normal action=purge thumbnail removal. + */ +$wgExcludeFromThumbnailPurge = array(); + +/** * Additional functions to be performed with updateSpecialPages. * Expensive Querypages are already updated. */ Index: includes/filerepo/LocalFile.php =================================================================== --- includes/filerepo/LocalFile.php (revision 83265) +++ includes/filerepo/LocalFile.php (working copy) @@ -659,7 +659,7 @@ * Delete cached transformed files */ function purgeThumbnails() { - global $wgUseSquid; + global $wgUseSquid, $wgExcludeFromThumbnailPurge; // Delete thumbnails $files = $this->getThumbnails(); @@ -667,6 +667,12 @@ $urls = array(); foreach ( $files as $file ) { + // Only remove files not in the $wgExcludeFromThumbnailPurge configuration variable + $ext = pathinfo("$dir/$file", PATHINFO_EXTENSION); + if( in_array( $ext, $wgExcludeFromThumbnailPurge ) ){ + continue; + } + # Check that the base file name is part of the thumb name # This is a basic sanity check to avoid erasing unrelated directories if ( strpos( $file, $this->getName() ) !== false ) {