r76685 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76684‎ | r76685 | r76686 >
Date:15:34, 15 November 2010
Author:ialex
Status:deferred
Tags:
Comment:
Convert WikiError -> Status
Modified paths:
  • /trunk/extensions/ConfirmAccount/RequestAccount_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ConfirmAccount/RequestAccount_body.php
@@ -329,7 +329,7 @@
330330 return false;
331331 }
332332 $veri = $this->verify( $this->mTempPath, $finalExt );
333 - if ( $veri !== true ) {
 333+ if ( !$veri->isGood() ) {
334334 $this->mPrevAttachment = '';
335335 $this->showForm( wfMsgHtml( 'uploadcorrupt' ) );
336336 return false;
@@ -439,7 +439,7 @@
440440 *
441441 * @param string $tmpfile the full path of the temporary file to verify
442442 * @param string $extension The filename extension that the file is to be served with
443 - * @return mixed true of the file is verified, a WikiError object otherwise.
 443+ * @return Status object
444444 */
445445 protected function verify( $tmpfile, $extension ) {
446446 # magically determine mime type
@@ -451,18 +451,18 @@
452452 wfDebug ( "\n\nmime: <$mime> extension: <$extension>\n\n" );
453453 # check mime type against file extension
454454 if ( !UploadBase::verifyExtension( $mime, $extension ) ) {
455 - return new WikiErrorMsg( 'uploadcorrupt' );
 455+ return Status::newFatal( 'uploadcorrupt' );
456456 }
457457
458458 # check mime type blacklist
459459 global $wgMimeTypeBlacklist;
460460 if ( isset( $wgMimeTypeBlacklist ) && !is_null( $wgMimeTypeBlacklist )
461461 && $this->checkFileExtension( $mime, $wgMimeTypeBlacklist ) ) {
462 - return new WikiErrorMsg( 'filetype-badmime', htmlspecialchars( $mime ) );
 462+ return Status::newFatal( 'filetype-badmime', $mime );
463463 }
464464 }
465465 wfDebug( __METHOD__ . ": all clear; passing.\n" );
466 - return true;
 466+ return Status::newGood();
467467 }
468468
469469 /**

Status & tagging log