FU r100716:
authorAaron Schulz <aaron@users.mediawiki.org>
Fri, 28 Oct 2011 22:21:03 +0000 (22:21 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Fri, 28 Oct 2011 22:21:03 +0000 (22:21 +0000)
* Pass the File object in LocalFilePurgeThumbnails so handlers can use the getRel() functions and such
* Also added the hook to hooks.txt, as this could be useful for other caches or things in thumb_handler.php

docs/hooks.txt
includes/filerepo/LocalFile.php

index 5b5234f..7eeed9f 100644 (file)
@@ -1177,13 +1177,17 @@ completed
 &updater: A DatabaseUpdater subclass
 
 'LocalFile::getHistory': called before file history query performed
-$file: the file
+$file: the File object
 $tables: tables
 $fields: select fields
 $conds: conditions
 $opts: query options
 $join_conds: JOIN conditions
 
+'LocalFilePurgeThumbnails': called before thumbnails for a local file a purged
+$file: the File object
+$type: either "current" or "archive"
+
 'LocalisationCacheRecache': Called when loading the localisation data into cache
 $cache: The LocalisationCache object
 $code: language code
index c26812a..c3f0452 100644 (file)
@@ -691,7 +691,7 @@ class LocalFile extends File {
         */
        function purgeOldThumbnails( $archiveName ) {
                global $wgUseSquid;
-               // get a list of old thumbnails and URLs
+               // Get a list of old thumbnails and URLs
                $files = $this->getThumbnails( $archiveName );
                $dir = array_shift( $files );
                $this->purgeThumbList( $dir, $files );
@@ -705,8 +705,8 @@ class LocalFile extends File {
                }
                wfRestoreWarnings();
 
-               # Temporary hook for purging Swift thumbnail cache
-               wfRunHooks( 'LocalFilePurgeThumbnails', array( $dir, 'old' ) );
+               // Purge any custom thumbnail caches
+               wfRunHooks( 'LocalFilePurgeThumbnails', array( $this, 'archive' ) );
 
                // Purge the squid
                if ( $wgUseSquid ) {
@@ -730,8 +730,8 @@ class LocalFile extends File {
                $dir = array_shift( $files );
                $this->purgeThumbList( $dir, $files );
 
-               # Temporary hook for purging Swift thumbnail cache
-               wfRunHooks( 'LocalFilePurgeThumbnails', array( $dir, 'current' ) );
+               // Purge any custom thumbnail caches
+               wfRunHooks( 'LocalFilePurgeThumbnails', array( $this, 'current' ) );
 
                // Purge the squid
                if ( $wgUseSquid ) {