Merge "[FileRepo] Added hook to let us copy thumbnails into additional places as...
authorBrion VIBBER <brion@wikimedia.org>
Thu, 26 Apr 2012 22:56:05 +0000 (22:56 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 26 Apr 2012 22:56:05 +0000 (22:56 +0000)
docs/hooks.txt
includes/filerepo/file/File.php

index 1a9f41d..33db1c5 100644 (file)
@@ -904,6 +904,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 461c255..d32a0e3 100644 (file)
@@ -878,6 +878,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