r103122 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103121‎ | r103122 | r103123 >
Date:02:20, 15 November 2011
Author:aaron
Status:ok
Tags:backcompat 
Comment:
Changed new LocalFilePurgeThumbnails hook arguments and updated wmf/swift.php to actually work for archived file thumbs.
Modified paths:
  • /trunk/extensions/SwiftMedia/wmf/swift.php (modified) (history)
  • /trunk/phase3/docs/hooks.txt (modified) (history)
  • /trunk/phase3/includes/filerepo/LocalFile.php (modified) (history)

Diff [purge]

Index: trunk/phase3/docs/hooks.txt
@@ -1191,7 +1191,7 @@
11921192
11931193 'LocalFilePurgeThumbnails': called before thumbnails for a local file a purged
11941194 $file: the File object
1195 -$type: either "current" or "archive"
 1195+$archiveName: name of an old file version or false if it's the current one
11961196
11971197 'LocalisationCacheRecache': Called when loading the localisation data into cache
11981198 $cache: The LocalisationCache object
Index: trunk/phase3/includes/filerepo/LocalFile.php
@@ -687,7 +687,7 @@
688688 }
689689
690690 /**
691 - * Delete cached transformed files for archived files
 691+ * Delete cached transformed files for an archived version only.
692692 * @param $archiveName string name of the archived file
693693 */
694694 function purgeOldThumbnails( $archiveName ) {
@@ -707,7 +707,7 @@
708708 wfRestoreWarnings();
709709
710710 // Purge any custom thumbnail caches
711 - wfRunHooks( 'LocalFilePurgeThumbnails', array( $this, 'archive' ) );
 711+ wfRunHooks( 'LocalFilePurgeThumbnails', array( $this, $archiveName ) );
712712
713713 // Purge the squid
714714 if ( $wgUseSquid ) {
@@ -732,7 +732,7 @@
733733 $this->purgeThumbList( $dir, $files );
734734
735735 // Purge any custom thumbnail caches
736 - wfRunHooks( 'LocalFilePurgeThumbnails', array( $this, 'current' ) );
 736+ wfRunHooks( 'LocalFilePurgeThumbnails', array( $this, false ) );
737737
738738 // Purge the squid
739739 if ( $wgUseSquid ) {
Index: trunk/extensions/SwiftMedia/wmf/swift.php
@@ -18,18 +18,16 @@
1919 * to CommonSettings.php which includes this file and calls this function.
2020 *
2121 * @param $file File
22 - * @param $type string "current" or "old"
 22+ * @param $archiveName string|false
2323 * @return true
2424 */
25 -function wmfPurgeBackendThumbCache( File $file, $type ) {
 25+function wmfPurgeBackendThumbCache( File $file, $archiveName ) {
2626 global $site, $lang; // CommonSettings.php
2727
28 - if ( $type === 'current' ) {
29 - $thumbRel = $file->getRel();
30 - } elseif ( $type === 'archive' ) {
31 - $thumbRel = $file->getArchiveThumbRel();
 28+ if ( $archiveName !== false ) {
 29+ $thumbRel = $file->getArchiveThumbRel( $archiveName ); // old version
3230 } else {
33 - return true; // sanity
 31+ $thumbRel = $file->getRel(); // current version
3432 }
3533
3634 $container = wmfGetSwiftThumbContainer( $site, $lang );

Status & tagging log