Index: trunk/phase3/includes/filerepo/ForeignAPIFile.php |
— | — | @@ -209,8 +209,11 @@ |
210 | 210 | return $files; |
211 | 211 | } |
212 | 212 | |
213 | | - function purgeCache() { |
214 | | - $this->purgeThumbnails(); |
| 213 | + /** |
| 214 | + * @see File::purgeCache() |
| 215 | + */ |
| 216 | + function purgeCache( $options = array() ) { |
| 217 | + $this->purgeThumbnails( $options ); |
215 | 218 | $this->purgeDescriptionPage(); |
216 | 219 | } |
217 | 220 | |
— | — | @@ -221,11 +224,18 @@ |
222 | 225 | $wgMemc->delete( $key ); |
223 | 226 | } |
224 | 227 | |
225 | | - function purgeThumbnails() { |
| 228 | + function purgeThumbnails( $options = array() ) { |
226 | 229 | global $wgMemc; |
227 | 230 | $key = $this->repo->getLocalCacheKey( 'ForeignAPIRepo', 'ThumbUrl', $this->getName() ); |
228 | 231 | $wgMemc->delete( $key ); |
| 232 | + |
229 | 233 | $files = $this->getThumbnails(); |
| 234 | + // Give media handler a chance to filter the purge list |
| 235 | + $handler = $this->getHandler(); |
| 236 | + if ( $handler ) { |
| 237 | + $handler->filterThumbnailPurgeList( $files, $options ); |
| 238 | + } |
| 239 | + |
230 | 240 | $dir = $this->getThumbPath( $this->getName() ); |
231 | 241 | foreach ( $files as $file ) { |
232 | 242 | unlink( $dir . $file ); |
Index: trunk/phase3/includes/filerepo/LocalFile.php |
— | — | @@ -675,12 +675,12 @@ |
676 | 676 | /** |
677 | 677 | * Delete all previously generated thumbnails, refresh metadata in memcached and purge the squid |
678 | 678 | */ |
679 | | - function purgeCache() { |
| 679 | + function purgeCache( $options = array() ) { |
680 | 680 | // Refresh metadata cache |
681 | 681 | $this->purgeMetadataCache(); |
682 | 682 | |
683 | 683 | // Delete thumbnails |
684 | | - $this->purgeThumbnails(); |
| 684 | + $this->purgeThumbnails( $options ); |
685 | 685 | |
686 | 686 | // Purge squid cache for this file |
687 | 687 | SquidUpdate::purge( array( $this->getURL() ) ); |
— | — | @@ -720,10 +720,18 @@ |
721 | 721 | /** |
722 | 722 | * Delete cached transformed files for the current version only. |
723 | 723 | */ |
724 | | - function purgeThumbnails() { |
| 724 | + function purgeThumbnails( $options = array() ) { |
725 | 725 | global $wgUseSquid; |
726 | | - // get a list of thumbnails and URLs |
| 726 | + |
| 727 | + // Get a list of thumbnails and URLs |
727 | 728 | $files = $this->getThumbnails(); |
| 729 | + |
| 730 | + // Give media handler a chance to filter the purge list |
| 731 | + $handler = $this->getHandler(); |
| 732 | + if ( $handler ) { |
| 733 | + $handler->filterThumbnailPurgeList( $files, $options ); |
| 734 | + } |
| 735 | + |
728 | 736 | $dir = array_shift( $files ); |
729 | 737 | $this->purgeThumbList( $dir, $files ); |
730 | 738 | |
Index: trunk/phase3/includes/filerepo/File.php |
— | — | @@ -823,8 +823,9 @@ |
824 | 824 | * Purge shared caches such as thumbnails and DB data caching |
825 | 825 | * STUB |
826 | 826 | * Overridden by LocalFile |
| 827 | + * @param array $options Array with options, currently undefined |
827 | 828 | */ |
828 | | - function purgeCache() {} |
| 829 | + function purgeCache( $options = array() ) {} |
829 | 830 | |
830 | 831 | /** |
831 | 832 | * Purge the file description page, but don't go after |
Index: trunk/phase3/includes/media/Generic.php |
— | — | @@ -504,6 +504,16 @@ |
505 | 505 | } |
506 | 506 | return false; |
507 | 507 | } |
| 508 | + |
| 509 | + /** |
| 510 | + * Remove files from the purge list |
| 511 | + * |
| 512 | + * @param array $files |
| 513 | + * @param array $options |
| 514 | + */ |
| 515 | + public function filterThumbnailPurgeList( &$files, $options ) { |
| 516 | + // Do nothing |
| 517 | + } |
508 | 518 | } |
509 | 519 | |
510 | 520 | /** |