Index: trunk/phase3/includes/filerepo/file/LocalFile.php |
— | — | @@ -915,7 +915,10 @@ |
916 | 916 | $this->lock(); // begin |
917 | 917 | $status = $this->publish( $srcPath, $flags ); |
918 | 918 | |
919 | | - if ( $status->ok ) { |
| 919 | + if ( $status->successCount > 0 ) { |
| 920 | + # Essentially we are displacing any existing current file and saving |
| 921 | + # a new current file at the old location. If just the first succeeded, |
| 922 | + # we still need to displace the current DB entry and put in a new one. |
920 | 923 | if ( !$this->recordUpload2( $status->value, $comment, $pageText, $props, $timestamp, $user ) ) { |
921 | 924 | $status->fatal( 'filenotfound', $srcPath ); |
922 | 925 | } |
— | — | @@ -1014,8 +1017,12 @@ |
1015 | 1018 | ); |
1016 | 1019 | |
1017 | 1020 | if ( $dbw->affectedRows() == 0 ) { |
1018 | | - if ( $oldver == '' ) { |
1019 | | - throw new MWException( "Empty oi_archive_name. Database and storage out of sync?" ); |
| 1021 | + if ( $oldver == '' ) { // XXX |
| 1022 | + # (bug 34993) publish() can displace the current file and yet fail to save |
| 1023 | + # a new one. The next publish attempt will treat the file as a brand new file |
| 1024 | + # and pass an empty $oldver. Allow this bogus value so we can displace the |
| 1025 | + # `image` row to `oldimage`, leaving room for the new current file `image` row. |
| 1026 | + #throw new MWException( "Empty oi_archive_name. Database and storage out of sync?" ); |
1020 | 1027 | } |
1021 | 1028 | $reupload = true; |
1022 | 1029 | # Collision, this is an update of a file |