From: Bryan Tong Minh Date: Fri, 17 Jun 2011 16:48:42 +0000 (+0000) Subject: Per comments on r88145: unlink file if it is broken X-Git-Tag: 1.31.0-rc.0~29462 X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=commitdiff_plain;h=506fd9f2b17d4d775cc4c93f7c7d695021018277;p=lhc%2Fweb%2Fwiklou.git Per comments on r88145: unlink file if it is broken --- 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; }