From: Tim Düsterhus Date: Mon, 8 Sep 2014 16:24:12 +0000 (+0200) Subject: Write disk cache atomically X-Git-Tag: 2.1.0_Alpha_1~344^2~32^2~1^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a2794c70fc7cf03de0d2bf6dd0b9dd0d20d4b848;p=GitHub%2FWoltLab%2FWCF.git Write disk cache atomically --- diff --git a/wcfsetup/install/files/lib/system/cache/source/DiskCacheSource.class.php b/wcfsetup/install/files/lib/system/cache/source/DiskCacheSource.class.php index 639d8ad43e..d37cd417e9 100644 --- a/wcfsetup/install/files/lib/system/cache/source/DiskCacheSource.class.php +++ b/wcfsetup/install/files/lib/system/cache/source/DiskCacheSource.class.php @@ -1,7 +1,7 @@ getFilename($cacheName)); - $file->write("\n"); - $file->write(serialize($value)); - $file->close(); + $writer = new AtomicWriter($this->getFilename($cacheName)); + $writer->write("\n"); + $writer->write(serialize($value)); + $writer->flush(); + $writer->close(); // unset current DirectoryUtil object to make sure new cache file // can be deleted in the same request