(bug 26848) deleteArchivedFiles.php deletes db records, but not files
authorChad Horohoe <demon@users.mediawiki.org>
Fri, 21 Jan 2011 17:42:15 +0000 (17:42 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Fri, 21 Jan 2011 17:42:15 +0000 (17:42 +0000)
maintenance/deleteArchivedFiles.inc

index e0ac225..68394b4 100644 (file)
@@ -45,9 +45,12 @@ class DeleteArchivedFilesImplementation {
                                array( 'FOR UPDATE' )
                        );
                        if ( $path && file_exists( $path ) && !$inuse ) {
-                               unlink( $path ); // delete
-                               $count++;
-                               $dbw->query( "DELETE FROM $tbl_arch WHERE fa_id = $id" );
+                               if( unlink( $path ) ) { // delete
+                                       $count++;
+                                       $dbw->query( "DELETE FROM $tbl_arch WHERE fa_id = $id" );
+                               } else {
+                                       $output->handleOutput( "Unable to remove file $path, skipping\n" );
+                               }
                        } else {
                                $output->handleOutput( "Notice - file '$key' not found in group '$group'\n" );
                                if ( $force ) {