Add unit test for bug 32888
[lhc/web/wiklou.git] / maintenance / deleteArchivedFiles.inc
index bcbdbc1..68394b4 100644 (file)
@@ -45,13 +45,16 @@ 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 ) {
-                                       $outpu->handleOutput( "Got --force, deleting DB entry\n" );
+                                       $output->handleOutput( "Got --force, deleting DB entry\n" );
                                        $dbw->query( "DELETE FROM $tbl_arch WHERE fa_id = $id" );
                                }
                        }