[FileRepo] Added hook to let us copy thumbnails into additional places as they are...
authorAaron <aschulz@wikimedia.org>
Mon, 23 Apr 2012 18:06:05 +0000 (11:06 -0700)
committerAaron <aschulz@wikimedia.org>
Tue, 24 Apr 2012 18:14:37 +0000 (11:14 -0700)
Change-Id: I673faf338e58c8230ab6da5243f921c178c47e97

docs/hooks.txt
includes/filerepo/file/File.php

index d87bd3d..d693caf 100644 (file)
@@ -899,6 +899,12 @@ $article: in case all revisions of the file are deleted a reference to the
 $user: user who performed the deletion
 $reason: reason
 
+'FileTransformed': When a file is transformed and moved into storage
+$file: reference to the File object
+$thumb: the MediaTransformOutput object
+$tmpThumbPath: The temporary file system path of the transformed file
+$thumbPath: The permanent storage path of the transformed file
+
 'FileUpload': When a file upload occurs
 $file : Image object representing the file that was uploaded
 $reupload : Boolean indicating if there was a previously another image there or not (since 1.17)
index ae11e67..8c9f7ff 100644 (file)
@@ -871,6 +871,8 @@ abstract class File {
                                } else {
                                        $thumb = $this->transformErrorOutput( $thumbPath, $thumbUrl, $params, $flags );
                                }
+                               // Give extensions a chance to do something with this thumbnail...
+                               wfRunHooks( 'FileTransformed', array( $this, $thumb, $tmpThumbPath, $thumbPath ) );
                        }
 
                        // Purge. Useful in the event of Core -> Squid connection failure or squid