From 506fd9f2b17d4d775cc4c93f7c7d695021018277 Mon Sep 17 00:00:00 2001 From: Bryan Tong Minh Date: Fri, 17 Jun 2011 16:48:42 +0000 Subject: [PATCH] Per comments on r88145: unlink file if it is broken --- includes/Import.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/includes/Import.php b/includes/Import.php index 3a2c19c9a6..73a15d58a3 100644 --- a/includes/Import.php +++ b/includes/Import.php @@ -1153,6 +1153,10 @@ class WikiRevision { } $sha1 = $this->getSha1(); if ( $sha1 && ( $sha1 !== sha1_file( $source ) ) ) { + if ( $flags & File::DELETE_SOURCE ) { + # Broken file; delete it if it is a temporary file + unlink( $source ); + } wfDebug( __METHOD__ . ": Corrupt file $source.\n" ); return false; } -- 2.20.1