r114434 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r114433‎ | r114434 | r114435 >
Date:00:25, 23 March 2012
Author:aaron
Status:deferred
Tags:
Comment:
Committed live changes to file cleanup script
Modified paths:
  • /branches/wmf/1.19wmf1/maintenance/fixBug35048Files.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.19wmf1/maintenance/fixBug35048Files.php
@@ -93,6 +93,7 @@
9494 $this->output( "Switching '$currentFilePath' with '$archivedFilePath'.\n" );
9595 $tmpFilePath = "$wgUploadDirectory/lost+found/" . md5( $currentFilePath );
9696 if ( !is_writable( $currentFilePath ) || !is_writable( $archivedFilePath ) ) {
 97+ $this->output( "'$currentFilePath' or '$archivedFilePath' not writable\n" );
9798 continue;
9899 }
99100 $ok = rename( $currentFilePath, $tmpFilePath ) // temp
@@ -108,17 +109,21 @@
109110 }
110111 // Update DB to point to former current version next run (in $history loop)...
111112 } else {
 113+ if ( !is_writable( $currentFilePath ) || !is_writable( $archivedFilePath ) ) {
 114+ $this->output( "'$currentFilePath' or '$archivedFilePath' not writable\n" );
 115+ continue;
 116+ }
112117 // Evict the current version to lost+found so it can be properly
113118 // re-uploaded later, with the username, comment, and log entry.
114119 $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() );
116121 // Restore the orphaned archived version to current version file
117122 // name so that it matches up with the current version metadata.
118123 $this->output( "Moving '$archivedFilePath' back to '$currentFilePath'.\n" );
119 - #rename( $archivedFilePath, $currentFilePath );
 124+ rename( $archivedFilePath, $currentFilePath );
120125 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 );
123128 }
124129 }
125130 }

Status & tagging log