Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -4646,6 +4646,12 @@ |
4647 | 4647 | ); |
4648 | 4648 | |
4649 | 4649 | /** |
| 4650 | + * Extensions of "thumbnails" that are very expensive to regenerate and should be |
| 4651 | + * excluded from normal action=purge thumbnail removal. |
| 4652 | + */ |
| 4653 | +$wgExcludeFromThumbnailPurge = array(); |
| 4654 | + |
| 4655 | +/** |
4650 | 4656 | * Additional functions to be performed with updateSpecialPages. |
4651 | 4657 | * Expensive Querypages are already updated. |
4652 | 4658 | */ |
Index: trunk/phase3/includes/filerepo/LocalFile.php |
— | — | @@ -659,7 +659,7 @@ |
660 | 660 | * Delete cached transformed files |
661 | 661 | */ |
662 | 662 | function purgeThumbnails() { |
663 | | - global $wgUseSquid; |
| 663 | + global $wgUseSquid, $wgExcludeFromThumbnailPurge; |
664 | 664 | |
665 | 665 | // Delete thumbnails |
666 | 666 | $files = $this->getThumbnails(); |
— | — | @@ -667,6 +667,12 @@ |
668 | 668 | $urls = array(); |
669 | 669 | |
670 | 670 | foreach ( $files as $file ) { |
| 671 | + // Only remove files not in the $wgExcludeFromThumbnailPurge configuration variable |
| 672 | + $ext = pathinfo( "$dir/$file", PATHINFO_EXTENSION ); |
| 673 | + if ( in_array( $ext, $wgExcludeFromThumbnailPurge ) ) { |
| 674 | + continue; |
| 675 | + } |
| 676 | + |
671 | 677 | # Check that the base file name is part of the thumb name |
672 | 678 | # This is a basic sanity check to avoid erasing unrelated directories |
673 | 679 | if ( strpos( $file, $this->getName() ) !== false ) { |