Index: trunk/phase3/includes/filerepo/LocalFile.php |
— | — | @@ -607,7 +607,8 @@ |
608 | 608 | * is already known |
609 | 609 | * @param string $timestamp Timestamp for img_timestamp, or false to use the current time |
610 | 610 | * |
611 | | - * @return Wikitext-formatted WikiError or true on success |
| 611 | + * @return Returns the archive name on success or an empty string if it was a new upload. |
| 612 | + * Returns a wikitext-formatted WikiError on failure. |
612 | 613 | */ |
613 | 614 | function upload( $srcPath, $comment, $pageText, $flags = 0, $props = false, $timestamp = false ) { |
614 | 615 | $archive = $this->publish( $srcPath, $flags ); |
— | — | @@ -617,7 +618,7 @@ |
618 | 619 | if ( !$this->recordUpload2( $archive, $comment, $pageText, $props, $timestamp ) ) { |
619 | 620 | return new WikiErrorMsg( 'filenotfound', wfEscapeWikiText( $srcPath ) ); |
620 | 621 | } |
621 | | - return true; |
| 622 | + return $archive; |
622 | 623 | } |
623 | 624 | |
624 | 625 | /** |
Index: trunk/phase3/includes/SpecialUpload.php |
— | — | @@ -510,16 +510,22 @@ |
511 | 511 | $pageText = self::getInitialPageText( $this->mComment, $this->mLicense, |
512 | 512 | $this->mCopyrightStatus, $this->mCopyrightSource ); |
513 | 513 | |
514 | | - $error = $this->mLocalFile->upload( $this->mTempPath, $this->mComment, $pageText, |
| 514 | + $status = $this->mLocalFile->upload( $this->mTempPath, $this->mComment, $pageText, |
515 | 515 | File::DELETE_SOURCE, $this->mFileProps ); |
516 | | - if ( WikiError::isError( $error ) ) { |
517 | | - $this->showError( $error ); |
| 516 | + if ( WikiError::isError( $status ) ) { |
| 517 | + $this->showError( $status ); |
518 | 518 | } else { |
519 | 519 | if ( $this->mWatchthis ) { |
520 | 520 | global $wgUser; |
521 | 521 | $wgUser->addWatch( $this->mLocalFile->getTitle() ); |
522 | 522 | } |
523 | | - $this->showSuccess(); |
| 523 | + if ( $status === '' ) { |
| 524 | + // New upload, redirect to description page |
| 525 | + $wgOut->redirect( $this->mLocalFile->getTitle()->getFullURL() ); |
| 526 | + } else { |
| 527 | + // Reupload, show success page |
| 528 | + $this->showSuccess(); |
| 529 | + } |
524 | 530 | wfRunHooks( 'UploadComplete', array( &$img ) ); |
525 | 531 | } |
526 | 532 | } |