Index: trunk/phase3/includes/upload/UploadBase.php |
— | — | @@ -371,6 +371,14 @@ |
372 | 372 | return array( 'uploadvirus', $virus ); |
373 | 373 | } |
374 | 374 | |
| 375 | + $handler = MediaHandler::getHandler( $mime ); |
| 376 | + if ( $handler ) { |
| 377 | + $handler->verifyFileHook( $this, $mime, &$status ); |
| 378 | + if ( $status !== true ) { |
| 379 | + return $status; |
| 380 | + } |
| 381 | + } |
| 382 | + |
375 | 383 | wfRunHooks( 'UploadVerifyFile', array( $this, $mime, &$status ) ); |
376 | 384 | if ( $status !== true ) { |
377 | 385 | return $status; |
Index: trunk/phase3/includes/media/Generic.php |
— | — | @@ -274,6 +274,21 @@ |
275 | 275 | function parserTransformHook( $parser, $file ) {} |
276 | 276 | |
277 | 277 | /** |
| 278 | + * File validation hook; Called by UploadBase::verifyFile, exactly like UploadVerifyFile hooks. |
| 279 | + * If the file represented by the $upload object is not valid, $error should be set to an array |
| 280 | + * in which the first item is the name of a system message describing the problem, and any |
| 281 | + * remaining items are parameters for that message. In that case, verifyFileHook should return false. |
| 282 | + * |
| 283 | + * @param $upload An instance of UploadBase, representing a freshly uploaded file |
| 284 | + * @param $mime The mime type of the uploaded file |
| 285 | + * @param $error (output) set to an array describing the problem, if there is one. If the file is OK, this should not be modified. |
| 286 | + * @return true if the file is OK, false otherwise |
| 287 | + */ |
| 288 | + function verifyFileHook( $upload, $mime, &$error ) { |
| 289 | + return true; |
| 290 | + } |
| 291 | + |
| 292 | + /** |
278 | 293 | * Check for zero-sized thumbnails. These can be generated when |
279 | 294 | * no disk space is available or some other error occurs |
280 | 295 | * |