Index: trunk/phase3/includes/WikiFilePage.php |
— | — | @@ -156,12 +156,12 @@ |
157 | 157 | $update = new HTMLCacheUpdate( $this->mTitle, 'imagelinks' ); |
158 | 158 | $update->doUpdate(); |
159 | 159 | $this->mFile->upgradeRow(); |
160 | | - $this->mFile->purgeCache(); |
| 160 | + $this->mFile->purgeCache( array( 'forRefresh' => true ) ); |
161 | 161 | } else { |
162 | 162 | wfDebug( 'ImagePage::doPurge no image for ' . $this->mFile->getName() . "; limiting purge to cache only\n" ); |
163 | 163 | // even if the file supposedly doesn't exist, force any cached information |
164 | 164 | // to be updated (in case the cached information is wrong) |
165 | | - $this->mFile->purgeCache(); |
| 165 | + $this->mFile->purgeCache( array( 'forRefresh' => true ) ); |
166 | 166 | } |
167 | 167 | parent::doPurge(); |
168 | 168 | } |
Index: trunk/phase3/includes/filerepo/file/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() ) ); |
— | — | @@ -723,11 +723,18 @@ |
724 | 724 | /** |
725 | 725 | * Delete cached transformed files for the current version only. |
726 | 726 | */ |
727 | | - function purgeThumbnails() { |
| 727 | + function purgeThumbnails( $options ) { |
728 | 728 | global $wgUseSquid; |
729 | 729 | |
730 | 730 | // Delete thumbnails |
731 | 731 | $files = $this->getThumbnails(); |
| 732 | + |
| 733 | + // Give media handler a chance to filter the purge list |
| 734 | + $handler = $this->getHandler(); |
| 735 | + if ( $handler ) { |
| 736 | + $handler->filterThumbnailPurgeList( $files, $options ); |
| 737 | + } |
| 738 | + |
732 | 739 | $dir = array_shift( $files ); |
733 | 740 | $this->purgeThumbList( $dir, $files ); |
734 | 741 | |
Index: trunk/phase3/includes/filerepo/file/File.php |
— | — | @@ -863,8 +863,10 @@ |
864 | 864 | * Purge shared caches such as thumbnails and DB data caching |
865 | 865 | * STUB |
866 | 866 | * Overridden by LocalFile |
| 867 | + * @param $options Array Options, which include: |
| 868 | + * 'forRefresh' : The purging is only to refresh thumbnails |
867 | 869 | */ |
868 | | - function purgeCache() {} |
| 870 | + function purgeCache( $options = array() ) {} |
869 | 871 | |
870 | 872 | /** |
871 | 873 | * Purge the file description page, but don't go after |
Index: trunk/phase3/includes/filerepo/file/ForeignAPIFile.php |
— | — | @@ -214,8 +214,11 @@ |
215 | 215 | return $files; |
216 | 216 | } |
217 | 217 | |
218 | | - function purgeCache() { |
219 | | - $this->purgeThumbnails(); |
| 218 | + /** |
| 219 | + * @see File::purgeCache() |
| 220 | + */ |
| 221 | + function purgeCache( $options = array() ) { |
| 222 | + $this->purgeThumbnails( $options ); |
220 | 223 | $this->purgeDescriptionPage(); |
221 | 224 | } |
222 | 225 | |
— | — | @@ -226,11 +229,17 @@ |
227 | 230 | $wgMemc->delete( $key ); |
228 | 231 | } |
229 | 232 | |
230 | | - function purgeThumbnails() { |
| 233 | + function purgeThumbnails( $options = array() ) { |
231 | 234 | global $wgMemc; |
232 | 235 | $key = $this->repo->getLocalCacheKey( 'ForeignAPIRepo', 'ThumbUrl', $this->getName() ); |
233 | 236 | $wgMemc->delete( $key ); |
234 | 237 | $files = $this->getThumbnails(); |
| 238 | + // Give media handler a chance to filter the purge list |
| 239 | + $handler = $this->getHandler(); |
| 240 | + if ( $handler ) { |
| 241 | + $handler->filterThumbnailPurgeList( $files, $options ); |
| 242 | + } |
| 243 | + |
235 | 244 | $dir = $this->getThumbPath( $this->getName() ); |
236 | 245 | foreach ( $files as $file ) { |
237 | 246 | unlink( $dir . $file ); |
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 | /** |