*/
function parserTransformHook( $parser, $file ) {}
+ /**
+ * File validation hook; Called by UploadBase::verifyFile, exactly like UploadVerifyFile hooks.
+ * If the file represented by the $upload object is not valid, $error should be set to an array
+ * in which the first item is the name of a system message describing the problem, and any
+ * remaining items are parameters for that message. In that case, verifyFileHook should return false.
+ *
+ * @param $upload An instance of UploadBase, representing a freshly uploaded file
+ * @param $mime The mime type of the uploaded file
+ * @param $error (output) set to an array describing the problem, if there is one. If the file is OK, this should not be modified.
+ * @return true if the file is OK, false otherwise
+ */
+ function verifyFileHook( $upload, $mime, &$error ) {
+ return true;
+ }
+
/**
* Check for zero-sized thumbnails. These can be generated when
* no disk space is available or some other error occurs
return array( 'uploadvirus', $virus );
}
+ $handler = MediaHandler::getHandler( $mime );
+ if ( $handler ) {
+ $handler->verifyFileHook( $this, $mime, &$status );
+ if ( $status !== true ) {
+ return $status;
+ }
+ }
+
wfRunHooks( 'UploadVerifyFile', array( $this, $mime, &$status ) );
if ( $status !== true ) {
return $status;