https://www.mediawiki.org/wiki/Special:Code/MediaWiki/103122
Revision: 103122 Author: aaron Date: 2011-11-15 02:20:08 +0000 (Tue, 15 Nov 2011) Log Message: ----------- 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 trunk/phase3/docs/hooks.txt trunk/phase3/includes/filerepo/LocalFile.php Modified: trunk/extensions/SwiftMedia/wmf/swift.php =================================================================== --- trunk/extensions/SwiftMedia/wmf/swift.php 2011-11-15 01:59:32 UTC (rev 103121) +++ trunk/extensions/SwiftMedia/wmf/swift.php 2011-11-15 02:20:08 UTC (rev 103122) @@ -18,18 +18,16 @@ * to CommonSettings.php which includes this file and calls this function. * * @param $file File - * @param $type string "current" or "old" + * @param $archiveName string|false * @return true */ -function wmfPurgeBackendThumbCache( File $file, $type ) { +function wmfPurgeBackendThumbCache( File $file, $archiveName ) { global $site, $lang; // CommonSettings.php - if ( $type === 'current' ) { - $thumbRel = $file->getRel(); - } elseif ( $type === 'archive' ) { - $thumbRel = $file->getArchiveThumbRel(); + if ( $archiveName !== false ) { + $thumbRel = $file->getArchiveThumbRel( $archiveName ); // old version } else { - return true; // sanity + $thumbRel = $file->getRel(); // current version } $container = wmfGetSwiftThumbContainer( $site, $lang ); Modified: trunk/phase3/docs/hooks.txt =================================================================== --- trunk/phase3/docs/hooks.txt 2011-11-15 01:59:32 UTC (rev 103121) +++ trunk/phase3/docs/hooks.txt 2011-11-15 02:20:08 UTC (rev 103122) @@ -1191,7 +1191,7 @@ 'LocalFilePurgeThumbnails': called before thumbnails for a local file a purged $file: the File object -$type: either "current" or "archive" +$archiveName: name of an old file version or false if it's the current one 'LocalisationCacheRecache': Called when loading the localisation data into cache $cache: The LocalisationCache object Modified: trunk/phase3/includes/filerepo/LocalFile.php =================================================================== --- trunk/phase3/includes/filerepo/LocalFile.php 2011-11-15 01:59:32 UTC (rev 103121) +++ trunk/phase3/includes/filerepo/LocalFile.php 2011-11-15 02:20:08 UTC (rev 103122) @@ -687,7 +687,7 @@ } /** - * Delete cached transformed files for archived files + * Delete cached transformed files for an archived version only. * @param $archiveName string name of the archived file */ function purgeOldThumbnails( $archiveName ) { @@ -707,7 +707,7 @@ wfRestoreWarnings(); // Purge any custom thumbnail caches - wfRunHooks( 'LocalFilePurgeThumbnails', array( $this, 'archive' ) ); + wfRunHooks( 'LocalFilePurgeThumbnails', array( $this, $archiveName ) ); // Purge the squid if ( $wgUseSquid ) { @@ -732,7 +732,7 @@ $this->purgeThumbList( $dir, $files ); // Purge any custom thumbnail caches - wfRunHooks( 'LocalFilePurgeThumbnails', array( $this, 'current' ) ); + wfRunHooks( 'LocalFilePurgeThumbnails', array( $this, false ) ); // Purge the squid if ( $wgUseSquid ) { _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs