mirror of
https://github.com/mrclay/minify.git
synced 2025-08-12 00:54:35 +02:00
Corrupted cache files are now deleted.
This commit is contained in:
@@ -82,7 +82,7 @@ class Minify_Cache_File {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Write data to file and verify its contents
|
* Write data to file and verify its contents
|
||||||
*
|
*
|
||||||
* @param string $file path
|
* @param string $file path
|
||||||
*
|
*
|
||||||
* @param string $data
|
* @param string $data
|
||||||
@@ -91,8 +91,13 @@ class Minify_Cache_File {
|
|||||||
*/
|
*/
|
||||||
private static function _verifiedWrite($file, $data)
|
private static function _verifiedWrite($file, $data)
|
||||||
{
|
{
|
||||||
return (file_put_contents($file, $data, LOCK_EX)
|
if (! @file_put_contents($file, $data, LOCK_EX)) {
|
||||||
&& (md5($data) === md5_file($file))
|
return false;
|
||||||
);
|
}
|
||||||
|
if (md5($data) !== md5_file($file)) {
|
||||||
|
@unlink($file);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user