Index: trunk/phase3/includes/upload/UploadBase.php |
— | — | @@ -373,9 +373,10 @@ |
374 | 374 | |
375 | 375 | $handler = MediaHandler::getHandler( $mime ); |
376 | 376 | if ( $handler ) { |
377 | | - $handler->verifyFileHook( $this, $mime, $status ); |
378 | | - if ( $status !== true ) { |
379 | | - return $status; |
| 377 | + $handlerStatus = $handler->verifyUpload( $this->mTempPath ); |
| 378 | + if ( !$handlerStatus->isOK() ) { |
| 379 | + $errors = $handlerStatus->getErrorsArray(); |
| 380 | + return reset( $errors ); |
380 | 381 | } |
381 | 382 | } |
382 | 383 | |
Index: trunk/phase3/includes/media/Generic.php |
— | — | @@ -274,18 +274,17 @@ |
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. |
| 278 | + * File validation hook called on upload. |
282 | 279 | * |
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 |
| 280 | + * If the file at the given local path is not valid, or its MIME type does not |
| 281 | + * match the handler class, a Status object should be returned containing |
| 282 | + * relevant errors. |
| 283 | + * |
| 284 | + * @param $fileName The local path to the file. |
| 285 | + * @return Status object |
287 | 286 | */ |
288 | | - function verifyFileHook( $upload, $mime, &$error ) { |
289 | | - return true; |
| 287 | + function verifyUpload( $fileName ) { |
| 288 | + return Status::newGood(); |
290 | 289 | } |
291 | 290 | |
292 | 291 | /** |