Index: branches/wmf/1.19wmf1/maintenance/fixBug35048Files.php |
— | — | @@ -93,6 +93,7 @@ |
94 | 94 | $this->output( "Switching '$currentFilePath' with '$archivedFilePath'.\n" ); |
95 | 95 | $tmpFilePath = "$wgUploadDirectory/lost+found/" . md5( $currentFilePath ); |
96 | 96 | if ( !is_writable( $currentFilePath ) || !is_writable( $archivedFilePath ) ) { |
| 97 | + $this->output( "'$currentFilePath' or '$archivedFilePath' not writable\n" ); |
97 | 98 | continue; |
98 | 99 | } |
99 | 100 | $ok = rename( $currentFilePath, $tmpFilePath ) // temp |
— | — | @@ -108,17 +109,21 @@ |
109 | 110 | } |
110 | 111 | // Update DB to point to former current version next run (in $history loop)... |
111 | 112 | } else { |
| 113 | + if ( !is_writable( $currentFilePath ) || !is_writable( $archivedFilePath ) ) { |
| 114 | + $this->output( "'$currentFilePath' or '$archivedFilePath' not writable\n" ); |
| 115 | + continue; |
| 116 | + } |
112 | 117 | // Evict the current version to lost+found so it can be properly |
113 | 118 | // re-uploaded later, with the username, comment, and log entry. |
114 | 119 | $this->output( "Evicting '$currentFilePath' to '$wgUploadDirectory/lost+found/$name'.\n" ); |
115 | | - #rename( $currentFilePath, "$wgUploadDirectory/lost+found/" . $file->getName() ); |
| 120 | + rename( $currentFilePath, "$wgUploadDirectory/lost+found/" . $file->getName() ); |
116 | 121 | // Restore the orphaned archived version to current version file |
117 | 122 | // name so that it matches up with the current version metadata. |
118 | 123 | $this->output( "Moving '$archivedFilePath' back to '$currentFilePath'.\n" ); |
119 | | - #rename( $archivedFilePath, $currentFilePath ); |
| 124 | + rename( $archivedFilePath, $currentFilePath ); |
120 | 125 | if ( $outDir ) { // log changes |
121 | | - #file_put_contents( "$outDir/$wgDBname", "$currentFilePath $wgUploadDirectory/lost+found/$name\n", FILE_APPEND ); |
122 | | - #file_put_contents( "$outDir/$wgDBname", "$archivedFilePath $currentFilePath\n", FILE_APPEND ); |
| 126 | + file_put_contents( "$outDir/$wgDBname", "$currentFilePath $wgUploadDirectory/lost+found/$name\n", FILE_APPEND ); |
| 127 | + file_put_contents( "$outDir/$wgDBname", "$archivedFilePath $currentFilePath\n", FILE_APPEND ); |
123 | 128 | } |
124 | 129 | } |
125 | 130 | } |